Skip to content

Commit

Permalink
refactor: remove explicit autoload
Browse files Browse the repository at this point in the history
  • Loading branch information
adamcooke committed Jan 30, 2024
1 parent 26aae29 commit 0f9882f
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 80 deletions.
2 changes: 1 addition & 1 deletion config/application.rb
Expand Up @@ -27,7 +27,7 @@ class Application < Rails::Application
end

# Include from lib
config.eager_load_namespaces << Postal
config.eager_load_paths << Rails.root.join("lib")

# Disable field_with_errors
config.action_view.field_error_proc = proc { |t, i| t }
Expand Down
14 changes: 9 additions & 5 deletions config/initializers/inflections.rb
Expand Up @@ -12,13 +12,17 @@

# These inflection rules are supported but not enabled by default:
ActiveSupport::Inflector.inflections(:en) do |inflect|
inflect.acronym "API"

inflect.acronym "DKIM"
inflect.acronym "HTTP"
inflect.acronym "SMTP"
inflect.acronym "IP"
inflect.acronym "DNS"
inflect.acronym "UUID"
inflect.acronym "HTTP"

inflect.acronym "API"
inflect.acronym "DNS"

inflect.acronym "DB"
inflect.acronym "IP"
inflect.acronym "MQ"
inflect.acronym "MX"
inflect.acronym "DKIM"
end
43 changes: 0 additions & 43 deletions lib/postal.rb
@@ -1,45 +1,2 @@
module Postal

extend ActiveSupport::Autoload

eager_autoload do
autoload :AppLogger
autoload :BounceMessage
autoload :Config
autoload :Countries
autoload :DKIMHeader
autoload :Error
autoload :Helpers
autoload :HTTP
autoload :HTTPSender
autoload :Job
autoload :MessageDB
autoload :MessageInspection
autoload :MessageInspector
autoload :MessageInspectors
autoload :MessageParser
autoload :MessageRequeuer
autoload :MXLookup
autoload :QueryString
autoload :RabbitMQ
autoload :ReplySeparator
autoload :RspecHelpers
autoload :Sender
autoload :SendResult
autoload :SMTPSender
autoload :SMTPServer
autoload :SpamCheck
autoload :TrackingMiddleware
autoload :UserCreator
autoload :Version
autoload :Worker
end

def self.eager_load!
super
Postal::MessageDB.eager_load!
Postal::SMTPServer.eager_load!
Postal::MessageInspectors.eager_load!
end

end
16 changes: 0 additions & 16 deletions lib/postal/message_db.rb
@@ -1,20 +1,4 @@
module Postal
module MessageDB

extend ActiveSupport::Autoload
eager_autoload do
autoload :Click
autoload :Database
autoload :Delivery
autoload :LiveStats
autoload :Load
autoload :Message
autoload :Migration
autoload :Provisioner
autoload :Statistics
autoload :SuppressionList
autoload :Webhooks
end

end
end
8 changes: 0 additions & 8 deletions lib/postal/message_inspectors.rb
@@ -1,12 +1,4 @@
module Postal
module MessageInspectors

extend ActiveSupport::Autoload
eager_autoload do
autoload :Clamav
autoload :Rspamd
autoload :SpamAssassin
end

end
end
7 changes: 0 additions & 7 deletions lib/postal/smtp_server.rb
@@ -1,11 +1,4 @@
module Postal
module SMTPServer

extend ActiveSupport::Autoload
eager_autoload do
autoload :Client
autoload :Server
end

end
end

0 comments on commit 0f9882f

Please sign in to comment.