Class: Recipes::ErrorReporting

Inherits:
Rails::AppBuilder
  • Object
show all
Defined in:
lib/potassium/recipes/error_reporting.rb

Instance Method Summary collapse

Instance Method Details

#askObject



2
3
4
5
6
7
# File 'lib/potassium/recipes/error_reporting.rb', line 2

def ask
  response = answer(:sentry) do
    Ask.confirm("Do you need to report application errors with Sentry?")
  end
  set(:report_error, response)
end

#createObject



9
10
11
12
13
14
15
16
# File 'lib/potassium/recipes/error_reporting.rb', line 9

def create
  if selected?(:report_error)
    gather_gem 'sentry-rails'
    template '../assets/config/sentry.rb.erb', 'config/initializers/sentry.rb'
    append_to_file '.env.development', "SENTRY_DSN=\n"
    add_readme_section :internal_dependencies, :sentry
  end
end

#installObject



18
19
20
21
# File 'lib/potassium/recipes/error_reporting.rb', line 18

def install
  set(:report_error, true)
  create
end

#installed?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/potassium/recipes/error_reporting.rb', line 23

def installed?
  gem_exists?(/sentry-rails/) && file_exist?('config/initializers/sentry.rb')
end