Class: BugsnagGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/bugsnag/bugsnag_generator.rb

Instance Method Summary collapse

Instance Method Details

#create_initializer_fileObject



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/generators/bugsnag/bugsnag_generator.rb', line 11

def create_initializer_file
  unless /^[a-f0-9]{32}$/ =~ api_key
    raise Thor::Error, "Invalid bugsnag notifier api key #{api_key.inspect}\nYou can find the api key on the Settings tab of https://bugsnag.com/"
  end

  initializer "bugsnag.rb" do
    <<-EOF
Bugsnag.configure do |config|
config.api_key = #{api_key.inspect}
end
    EOF
  end
end