Skip to content
Snippets Groups Projects
Commit 6e009f16 authored by Adam Cooke's avatar Adam Cooke
Browse files

use explicit autoloads rather than from paths

parent 9f4568e8
No related branches found
No related tags found
No related merge requests found
web: bundle exec puma -C config/puma.rb
fast: bundle exec rake postal:fast_server
worker: bundle exec rake postal:worker
worker: bundle exec ruby script/worker.rb
cron: bundle exec rake postal:cron
smtp: bundle exec rake postal:smtp_server
requeuer: bundle exec rake postal:requeuer
Loading
Loading
@@ -27,7 +27,7 @@ module Postal
end
 
# Include from lib
config.eager_load_paths += %W(#{config.root}/lib #{config.root}/app/jobs)
config.eager_load_namespaces << Postal
 
# Disable field_with_errors
config.action_view.field_error_proc = Proc.new { |t, i| t }
Loading
Loading
require 'postal/error'
require 'postal'
require 'postal/message_db/mysql'
module Postal
extend ActiveSupport::Autoload
eager_autoload do
autoload :AppLogger
autoload :BounceMessage
autoload :Config
autoload :Countries
autoload :DKIMHeader
autoload :Error
autoload :FastServer
autoload :Helpers
autoload :HTTP
autoload :HTTPSender
autoload :Job
autoload :LetsEncrypt
autoload :MessageDB
autoload :MessageInspection
autoload :MessageParser
autoload :MessageRequeuer
autoload :QueryString
autoload :RabbitMQ
autoload :ReplySeparator
autoload :RspecHelpers
autoload :SendResult
autoload :Sender
autoload :SMTPServer
autoload :SpamCheck
autoload :UserCreator
autoload :Version
autoload :Worker
end
def self.eager_load!
super
Postal::MessageDB.eager_load!
Postal::FastServer.eager_load!
Postal::SMTPServer.eager_load!
end
end
module Postal
module FastServer
extend ActiveSupport::Autoload
eager_autoload do
autoload :Client
autoload :HTTPHeader
autoload :HTTPHeaderSet
autoload :Interface
autoload :Server
end
end
end
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
module Postal
module SMTPServer
extend ActiveSupport::Autoload
eager_autoload do
autoload :Client
autoload :Server
end
end
end
namespace :postal do
 
desc "Start the backend job worker"
task :worker => :environment do
Postal::Worker.new([:main]).work
end
desc "Start the cron worker"
task :cron => :environment do
require 'clockwork'
Loading
Loading
#!/usr/bin/env ruby
require_relative '../config/environment'
Postal::Worker.new([:main]).work
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment