Sha256: 4b46b18a3f9fd2ca5a4d587fe4891c4bfcadf3e1af2c73ea9f216de77f23e4f6

Contents?: true

Size: 881 Bytes

Versions: 11

Compression:

Stored size: 881 Bytes

Contents

# frozen_string_literal: true

# Creates the Airbrake initializer file for Rails apps.
#
# @example Invokation from terminal
#   rails generate airbrake PROJECT_KEY PROJECT_ID [NAME]
#
class AirbrakeGenerator < Rails::Generators::Base
  # Adds current directory to source paths, so we can find the template file.
  source_root File.expand_path(__dir__)

  argument :project_id, required: false
  argument :project_key, required: false

  # Makes the NAME option optional, which allows to subclass from Base, so we
  # can pass arguments to the ERB template.
  #
  # @see http://asciicasts.com/episodes/218-making-generators-in-rails-3
  argument :name, type: :string, default: 'application'

  desc 'Configures the Airbrake notifier with your project id and project key'
  def generate_layout
    template 'airbrake_initializer.rb.erb', 'config/initializers/airbrake.rb'
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
airbrake-11.0.3 lib/generators/airbrake_generator.rb
airbrake-11.0.2 lib/generators/airbrake_generator.rb
airbrake-11.0.1 lib/generators/airbrake_generator.rb
airbrake-10.0.6 lib/generators/airbrake_generator.rb
airbrake-11.0.0 lib/generators/airbrake_generator.rb
airbrake-10.1.0.rc.1 lib/generators/airbrake_generator.rb
airbrake-10.0.5 lib/generators/airbrake_generator.rb
airbrake-10.0.4 lib/generators/airbrake_generator.rb
airbrake-10.0.3 lib/generators/airbrake_generator.rb
airbrake-10.0.2 lib/generators/airbrake_generator.rb
airbrake-10.0.1 lib/generators/airbrake_generator.rb