Sha256: 38ab46665b42e427080fa2dab4c3da75b42d95a76967be4a44c0e4b782402c35

Contents?: true

Size: 516 Bytes

Versions: 3

Compression:

Stored size: 516 Bytes

Contents

require "rails/generators/base"

class SentryGenerator < ::Rails::Generators::Base
  class_option :dsn, type: :string, desc: "Sentry DSN"

  def copy_initializer_file
    dsn = options[:dsn] ? "'#{options[:dsn]}'" : "ENV['SENTRY_DSN']"

    create_file "config/initializers/sentry.rb", <<~RUBY
      # frozen_string_literal: true

      Sentry.init do |config|
        config.breadcrumbs_logger = [:active_support_logger]
        config.dsn = #{dsn}
        config.enable_tracing = true
      end
    RUBY
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sentry-rails-5.18.2 lib/generators/sentry_generator.rb
sentry-rails-5.18.1 lib/generators/sentry_generator.rb
sentry-rails-5.18.0 lib/generators/sentry_generator.rb