end
end
end
-
-require_dependency 'redmine/field_format'
end
end
end
-
-# Force load the subclasses in development mode
-require_dependency 'time_entry_activity'
-require_dependency 'document_category'
-require_dependency 'issue_priority'
Watcher.where('user_id = ?', id).delete_all
end
end
-
-require_dependency "group_builtin"
private :create_instance
end
end
-
-require_dependency "group_anonymous"
-require_dependency "group_non_member"
end
end
end
-
-require_dependency "user"
-require_dependency "group"
# -- all .rb files in that directory are automatically loaded.
# Custom directories with classes and modules you want to be autoloadable.
- config.autoload_paths += %W(#{config.root}/lib)
+ config.autoloader = :zeitwerk
# Only load the plugins named here, in the order given (default is alphabetical).
# :all can be used as a placeholder for all plugins not explicitly named.
--- /dev/null
+# frozen_string_literal: true
+
+lib = Rails.root.join('lib/redmine')
+Rails.autoloaders.main.push_dir lib, namespace: Redmine
+
+IGNORE_LIST = [
+ 'wiki_formatting/textile/redcloth3.rb',
+ 'core_ext.rb',
+ 'core_ext'
+]
+
+class RedmineInflector < Zeitwerk::Inflector
+ def camelize(basename, abspath)
+ abspath.match?('redmine\/version.rb\z') ? 'VERSION' : super
+ end
+end
+
+Rails.autoloaders.each do |loader|
+ loader.inflector = RedmineInflector.new
+ loader.inflector.inflect(
+ 'html' => 'HTML',
+ 'csv' => 'CSV',
+ 'pdf' => 'PDF',
+ 'url' => 'URL',
+ 'pop3' => 'POP3',
+ 'imap' => 'IMAP'
+ )
+ IGNORE_LIST.each do |mod|
+ loader.ignore lib.join(mod)
+ end
+end
def self.create_assets_reloader
plugin_assets_dirs = {}
- @plugin_directories.each do |dir|
+ directories.each do |dir|
plugin_assets_dirs[dir.assets_dir] = ['*']
end
ActiveSupport::FileUpdateChecker.new([], plugin_assets_dirs) do
# Add the plugin directories to rails autoload paths
engine_cfg = Rails::Engine::Configuration.new(directory.to_s)
engine_cfg.paths.add 'lib', eager_load: true
- Rails.application.config.eager_load_paths += engine_cfg.eager_load_paths
- Rails.application.config.autoload_once_paths += engine_cfg.autoload_once_paths
- Rails.application.config.autoload_paths += engine_cfg.autoload_paths
+ engine_cfg.eager_load_paths.each do |dir|
+ Rails.autoloaders.main.push_dir dir
+ end
end
end
def self.scan_builtin_schemes
Dir[Rails.root.join('lib', 'redmine', 'twofa', '*.rb')].each do |file|
- require_dependency file
+ require file
end
end
private_class_method :scan_builtin_schemes