Class: Suspenders::Production::ErrorReportingGenerator

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

Instance Method Summary collapse

Methods inherited from Generators::Base

default_source_root

Methods included from Actions

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

Instance Method Details

#add_sentryObject



7
8
9
10
# File 'lib/suspenders/generators/production/error_reporting_generator.rb', line 7

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

#configure_sentry_contextObject



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

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

#env_varsObject



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

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

#set_up_sentryObject



12
13
14
# File 'lib/suspenders/generators/production/error_reporting_generator.rb', line 12

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