Sha256: 2506f98398bfa218dfc3fbc439a5f5847f7ecd5681e194437a99c5851b0adcf4
Contents?: true
Size: 1.13 KB
Versions: 2
Compression:
Stored size: 1.13 KB
Contents
require "rails/generators" require_relative "../actions" module Suspenders class ErrorReportingGenerator < Rails::Generators::Base include Suspenders::Actions source_root File.expand_path( File.join("..", "..", "..", "templates"), File.dirname(__FILE__), ) def add_sentry gem "sentry-raven" Bundler.with_clean_env { run "bundle install" } end def set_up_sentry copy_file "sentry.rb", "config/initializers/sentry.rb" end def configure_sentry_context inject_into_class( "app/controllers/application_controller.rb", 'ApplicationController', context_configuration ) end def env_vars expand_json( "app.json", env: { SENTRY_DSN: { required: true }, SENTRY_CURRENT_ENV: { required: true } } ) end private def context_configuration <<-RUBY before_action :set_raven_context private def set_raven_context Raven.user_context(id: session[:current_user_id]) Raven.extra_context(params: params.to_unsafe_h, url: request.url) end RUBY end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
welaika-suspenders-2.29.0.alpha.2 | lib/suspenders/generators/error_reporting_generator.rb |
welaika-suspenders-2.29.0.alpha.1 | lib/suspenders/generators/error_reporting_generator.rb |