Sha256: aa405f1035637573874e4205d25514e0adb147354491c2b60e87d2f79a5df306

Contents?: true

Size: 986 Bytes

Versions: 1

Compression:

Stored size: 986 Bytes

Contents

#!/usr/bin/env ruby

$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib')

require 'ar_mailer_aws'
require 'daemons'

require 'ostruct'
require 'optparse'

# require Rails environment expect running tests
name = File.basename $0
unless name == 'rspec'
  begin
    require Dir.pwd + '/config/environment'
    ActiveRecord::Base.connection.disconnect!
  rescue LoadError
    <<-EOF
      #{name} must be run from a Rails application's root to deliver email.
      #{Dir.pwd} does not appear to be a Rails application root.
    EOF
  end
end

options = ArMailerAWS.parse_options(ARGV)
daemon_options = options.pid_dir ? {dir_mode: :normal, dir: options.pid_dir} : {}
Daemons.run_proc('ar_mailer_aws', daemon_options) do
  if defined? Rails
    ActiveRecord::Base.establish_connection
    Rails.logger = ActiveRecord::Base.logger = ActionMailer::Base.logger = ActiveSupport::BufferedLogger.new(Rails.root.join("log/#{Rails.env}.log"))
  end
  ArMailerAWS.run(options)
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ar_mailer_aws-0.0.2 bin/ar_mailer_aws