Class: Suspenders::Production::ErrorReportingGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Includes:
Actions
Defined in:
lib/suspenders/generators/production/error_reporting_generator.rb

Instance Method Summary collapse

Methods included from Actions

#action_mailer_asset_host, #action_mailer_host, #configure_environment, #expand_json, #replace_in_file

Instance Method Details

#add_sentryObject



14
15
16
17
# File 'lib/suspenders/generators/production/error_reporting_generator.rb', line 14

def add_sentry
  gem "sentry-raven"
  Bundler.with_clean_env { run "bundle install" }
end

#configure_sentry_contextObject



23
24
25
26
27
28
29
# File 'lib/suspenders/generators/production/error_reporting_generator.rb', line 23

def configure_sentry_context
  inject_into_class(
    "app/controllers/application_controller.rb",
    'ApplicationController',
    context_configuration
  )
end

#env_varsObject



31
32
33
34
35
36
37
38
39
# File 'lib/suspenders/generators/production/error_reporting_generator.rb', line 31

def env_vars
  expand_json(
    "app.json",
    env: {
      SENTRY_DSN: { required: true },
      SENTRY_ENV: { required: true }
    }
  )
end

#set_up_sentryObject



19
20
21
# File 'lib/suspenders/generators/production/error_reporting_generator.rb', line 19

def set_up_sentry
  copy_file "sentry.rb", "config/initializers/sentry.rb"
end