Sha256: 2f8b5f1d4886ec3dab9a7cbc95eb8e779a49ef5b2dc8089138d66452d347da3d

Contents?: true

Size: 927 Bytes

Versions: 4

Compression:

Stored size: 927 Bytes

Contents

require_relative "../base"

module Bulldozer
  module Production
    class EmailGenerator < Generators::Base
      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.perform_caching = false"
      end

      def env_vars
        expand_json(
          "app.json",
          env: {
            SMTP_ADDRESS: { required: true },
            SMTP_DOMAIN: { required: true },
            SMTP_PASSWORD: { required: true },
            SMTP_USERNAME: { required: true },
          },
        )
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
bulldozer-1.6.3 lib/bulldozer/generators/production/email_generator.rb
bulldozer-1.6.2 lib/bulldozer/generators/production/email_generator.rb
bulldozer-1.6.1 lib/bulldozer/generators/production/email_generator.rb
bulldozer-1.6.0 lib/bulldozer/generators/production/email_generator.rb