module MicMonitorGem module Generators class InstallGenerator < Rails::Generators::Base source_root File.expand_path('templates', __dir__) ENV_PATH = "#{Rails.root}/config/environments/production.rb" def add_config_email_to_env_produciton append_to_file ENV_PATH do <<-'RUBY' Rails.application.config.middleware.use ExceptionNotification::Rack, email: { deliver_with: :deliver, # Rails >= 4.2.1 do not need this option since it defaults to :deliver_now email_prefix: ENV['EMAIL_PREFIX'], sender_address: ENV['SENDER_ADDRESS'], exception_recipients: ENV['EXCEPTION_RECINPIENTS'] } RUBY end end end end end