mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: Upgrading Discourse to Zeitwerk (#8098)
Zeitwerk simplifies working with dependencies in dev and makes it easier reloading class chains. We no longer need to use Rails "require_dependency" anywhere and instead can just use standard Ruby patterns to require files. This is a far reaching change and we expect some followups here.
This commit is contained in:
25
lib/freedom_patches/zeitwerk.rb
Normal file
25
lib/freedom_patches/zeitwerk.rb
Normal file
@@ -0,0 +1,25 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module ActiveSupport::Dependencies::ZeitwerkIntegration::Inflector
|
||||
CUSTOM_PATHS = {
|
||||
'base' => 'Jobs',
|
||||
'canonical_url' => 'CanonicalURL',
|
||||
'clean_up_unmatched_ips' => 'CleanUpUnmatchedIPs',
|
||||
'homepage_constraint' => 'HomePageConstraint',
|
||||
'ip_addr' => 'IPAddr',
|
||||
'onpdiff' => 'ONPDiff',
|
||||
'onceoff' => 'Jobs',
|
||||
'pop3_polling_enabled_setting_validator' => 'POP3PollingEnabledSettingValidator',
|
||||
'postgresql_fallback_adapter' => 'PostgreSQLFallbackHandler',
|
||||
'regular' => 'Jobs',
|
||||
'scheduled' => 'Jobs',
|
||||
'source_url' => 'SourceURL',
|
||||
'topic_query_sql' => 'TopicQuerySQL',
|
||||
'version' => 'Discourse',
|
||||
}
|
||||
|
||||
def self.camelize(basename, _abspath)
|
||||
return basename.camelize if _abspath =~ /onceoff\.rb$/
|
||||
CUSTOM_PATHS.fetch(basename, basename.camelize)
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user