Sha256: d0e70f5ed690204de4fddf4beb20dfb3e7cc06992f53b05fc3cb70004c73d058

Contents?: true

Size: 776 Bytes

Versions: 1

Compression:

Stored size: 776 Bytes

Contents

require "rails/generators"

module Suspenders
  module Production
    class EmailGenerator < Rails::Generators::Base
      source_root File.expand_path(
        File.join("..", "..", "..", "..", "templates"),
        File.dirname(__FILE__),
      )

      def smtp_configuration
        copy_file "smtp.rb", "config/smtp.rb"

        prepend_file "config/environments/production.rb",
          %{require Rails.root.join("config/smtp")\n}
      end

      def use_smtp
        config = <<-RUBY

  config.action_mailer.delivery_method = :smtp
  config.action_mailer.smtp_settings = SMTP_SETTINGS
        RUBY

        inject_into_file "config/environments/production.rb", config,
          after: "config.action_mailer.raise_delivery_errors = false"
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
suspenders-1.47.0 lib/suspenders/generators/production/email_generator.rb