airbrake 3.1.6 → 11.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (134) hide show
  1. checksums.yaml +7 -0
  2. data/lib/airbrake.rb +23 -150
  3. data/lib/airbrake/capistrano.rb +6 -42
  4. data/lib/airbrake/capistrano/capistrano2.rb +40 -0
  5. data/lib/airbrake/capistrano/capistrano3.rb +23 -0
  6. data/lib/airbrake/delayed_job.rb +66 -0
  7. data/lib/airbrake/logger.rb +103 -0
  8. data/lib/airbrake/rack.rb +30 -45
  9. data/lib/airbrake/rack/context_filter.rb +65 -0
  10. data/lib/airbrake/rack/http_headers_filter.rb +44 -0
  11. data/lib/airbrake/rack/http_params_filter.rb +27 -0
  12. data/lib/airbrake/rack/instrumentable.rb +136 -0
  13. data/lib/airbrake/rack/middleware.rb +102 -0
  14. data/lib/airbrake/rack/request_body_filter.rb +33 -0
  15. data/lib/airbrake/rack/request_store.rb +34 -0
  16. data/lib/airbrake/rack/route_filter.rb +51 -0
  17. data/lib/airbrake/rack/session_filter.rb +25 -0
  18. data/lib/airbrake/rack/user.rb +74 -0
  19. data/lib/airbrake/rack/user_filter.rb +25 -0
  20. data/lib/airbrake/rails.rb +25 -31
  21. data/lib/airbrake/rails/action_cable.rb +35 -0
  22. data/lib/airbrake/rails/action_cable/notify_callback.rb +22 -0
  23. data/lib/airbrake/rails/action_controller.rb +40 -0
  24. data/lib/airbrake/rails/action_controller_notify_subscriber.rb +32 -0
  25. data/lib/airbrake/rails/action_controller_performance_breakdown_subscriber.rb +51 -0
  26. data/lib/airbrake/rails/action_controller_route_subscriber.rb +33 -0
  27. data/lib/airbrake/rails/active_job.rb +50 -0
  28. data/lib/airbrake/rails/active_record.rb +36 -0
  29. data/lib/airbrake/rails/active_record_subscriber.rb +46 -0
  30. data/lib/airbrake/rails/app.rb +78 -0
  31. data/lib/airbrake/rails/backtrace_cleaner.rb +23 -0
  32. data/lib/airbrake/rails/curb.rb +32 -0
  33. data/lib/airbrake/rails/event.rb +81 -0
  34. data/lib/airbrake/rails/excon_subscriber.rb +25 -0
  35. data/lib/airbrake/rails/http.rb +14 -0
  36. data/lib/airbrake/rails/http_client.rb +16 -0
  37. data/lib/airbrake/rails/net_http.rb +18 -0
  38. data/lib/airbrake/rails/railtie.rb +151 -0
  39. data/lib/airbrake/rails/typhoeus.rb +16 -0
  40. data/lib/airbrake/rake.rb +65 -0
  41. data/lib/airbrake/rake/tasks.rb +112 -0
  42. data/lib/airbrake/resque.rb +61 -0
  43. data/lib/airbrake/shoryuken.rb +54 -0
  44. data/lib/airbrake/sidekiq.rb +55 -0
  45. data/lib/airbrake/sidekiq/retryable_jobs_filter.rb +53 -0
  46. data/lib/airbrake/sneakers.rb +72 -0
  47. data/lib/airbrake/version.rb +5 -1
  48. data/lib/generators/airbrake_generator.rb +25 -0
  49. data/lib/generators/airbrake_initializer.rb.erb +80 -0
  50. metadata +206 -259
  51. data/CHANGELOG +0 -944
  52. data/Gemfile +0 -3
  53. data/Guardfile +0 -6
  54. data/INSTALL +0 -20
  55. data/MIT-LICENSE +0 -22
  56. data/README.md +0 -556
  57. data/README_FOR_HEROKU_ADDON.md +0 -94
  58. data/Rakefile +0 -223
  59. data/SUPPORTED_RAILS_VERSIONS +0 -38
  60. data/TESTING.md +0 -41
  61. data/airbrake.gemspec +0 -40
  62. data/bin/airbrake +0 -12
  63. data/features/metal.feature +0 -18
  64. data/features/rack.feature +0 -60
  65. data/features/rails.feature +0 -272
  66. data/features/rails_with_js_notifier.feature +0 -97
  67. data/features/rake.feature +0 -27
  68. data/features/sinatra.feature +0 -29
  69. data/features/step_definitions/file_steps.rb +0 -10
  70. data/features/step_definitions/metal_steps.rb +0 -23
  71. data/features/step_definitions/rack_steps.rb +0 -23
  72. data/features/step_definitions/rails_application_steps.rb +0 -478
  73. data/features/step_definitions/rake_steps.rb +0 -17
  74. data/features/support/airbrake_shim.rb.template +0 -16
  75. data/features/support/env.rb +0 -18
  76. data/features/support/matchers.rb +0 -35
  77. data/features/support/rails.rb +0 -201
  78. data/features/support/rake/Rakefile +0 -68
  79. data/features/support/terminal.rb +0 -107
  80. data/features/user_informer.feature +0 -63
  81. data/generators/airbrake/airbrake_generator.rb +0 -94
  82. data/generators/airbrake/lib/insert_commands.rb +0 -34
  83. data/generators/airbrake/lib/rake_commands.rb +0 -24
  84. data/generators/airbrake/templates/airbrake_tasks.rake +0 -25
  85. data/generators/airbrake/templates/capistrano_hook.rb +0 -6
  86. data/generators/airbrake/templates/initializer.rb +0 -6
  87. data/install.rb +0 -1
  88. data/lib/airbrake/backtrace.rb +0 -108
  89. data/lib/airbrake/cli/client.rb +0 -68
  90. data/lib/airbrake/cli/options.rb +0 -41
  91. data/lib/airbrake/cli/printer.rb +0 -30
  92. data/lib/airbrake/cli/project.rb +0 -17
  93. data/lib/airbrake/cli/project_factory.rb +0 -36
  94. data/lib/airbrake/cli/runner.rb +0 -48
  95. data/lib/airbrake/cli/validator.rb +0 -8
  96. data/lib/airbrake/configuration.rb +0 -311
  97. data/lib/airbrake/extensions/blank.rb +0 -73
  98. data/lib/airbrake/notice.rb +0 -390
  99. data/lib/airbrake/rails/action_controller_catcher.rb +0 -30
  100. data/lib/airbrake/rails/controller_methods.rb +0 -87
  101. data/lib/airbrake/rails/error_lookup.rb +0 -33
  102. data/lib/airbrake/rails/javascript_notifier.rb +0 -47
  103. data/lib/airbrake/rails/middleware/exceptions_catcher.rb +0 -33
  104. data/lib/airbrake/rails3_tasks.rb +0 -98
  105. data/lib/airbrake/railtie.rb +0 -48
  106. data/lib/airbrake/rake_handler.rb +0 -71
  107. data/lib/airbrake/sender.rb +0 -128
  108. data/lib/airbrake/shared_tasks.rb +0 -47
  109. data/lib/airbrake/tasks.rb +0 -83
  110. data/lib/airbrake/user_informer.rb +0 -27
  111. data/lib/airbrake_tasks.rb +0 -64
  112. data/lib/rails/generators/airbrake/airbrake_generator.rb +0 -100
  113. data/lib/templates/javascript_notifier.erb +0 -15
  114. data/lib/templates/rescue.erb +0 -91
  115. data/rails/init.rb +0 -1
  116. data/resources/README.md +0 -34
  117. data/resources/ca-bundle.crt +0 -3376
  118. data/script/integration_test.rb +0 -38
  119. data/test/airbrake_2_3.xsd +0 -88
  120. data/test/airbrake_tasks_test.rb +0 -170
  121. data/test/backtrace_test.rb +0 -162
  122. data/test/capistrano_test.rb +0 -34
  123. data/test/catcher_test.rb +0 -333
  124. data/test/configuration_test.rb +0 -233
  125. data/test/helper.rb +0 -263
  126. data/test/javascript_notifier_test.rb +0 -51
  127. data/test/logger_test.rb +0 -79
  128. data/test/notice_test.rb +0 -490
  129. data/test/notifier_test.rb +0 -276
  130. data/test/rack_test.rb +0 -58
  131. data/test/rails_initializer_test.rb +0 -36
  132. data/test/recursion_test.rb +0 -10
  133. data/test/sender_test.rb +0 -288
  134. data/test/user_informer_test.rb +0 -29
@@ -1,63 +0,0 @@
1
- Feature: Inform the user of the airbrake notice that was just created
2
-
3
- Background:
4
- Given I have built and installed the "airbrake" gem
5
-
6
- Scenario: Rescue an exception in a controller
7
- When I generate a new Rails application
8
- And I configure the Airbrake shim
9
- And I configure my application to require the "airbrake" gem
10
- And I run the airbrake generator with "-k myapikey"
11
- And I define a response for "TestController#index":
12
- """
13
- raise RuntimeError, "some message"
14
- """
15
- And the response page for a "500" error is
16
- """
17
- <!-- AIRBRAKE ERROR -->
18
- """
19
- And I route "/test/index" to "test#index"
20
- And I perform a request to "http://example.com:123/test/index?param=value"
21
- Then I should see "Airbrake Error b6817316-9c45-ed26-45eb-780dbb86aadb"
22
-
23
- Scenario: Rescue an exception in a controller with a custom error string
24
- When I generate a new Rails application
25
- And I configure the Airbrake shim
26
- And I configure my application to require the "airbrake" gem
27
- And I configure the notifier to use the following configuration lines:
28
- """
29
- config.user_information = 'Error #{{ error_id }}'
30
- """
31
- And I run the airbrake generator with "-k myapikey"
32
- And I define a response for "TestController#index":
33
- """
34
- raise RuntimeError, "some message"
35
- """
36
- And the response page for a "500" error is
37
- """
38
- <!-- AIRBRAKE ERROR -->
39
- """
40
- And I route "/test/index" to "test#index"
41
- And I perform a request to "http://example.com:123/test/index?param=value"
42
- Then I should see "Error #b6817316-9c45-ed26-45eb-780dbb86aadb"
43
-
44
- Scenario: Don't inform them user
45
- When I generate a new Rails application
46
- And I configure the Airbrake shim
47
- And I configure my application to require the "airbrake" gem
48
- And I configure the notifier to use the following configuration lines:
49
- """
50
- config.user_information = false
51
- """
52
- And I run the airbrake generator with "-k myapikey"
53
- And I define a response for "TestController#index":
54
- """
55
- raise RuntimeError, "some message"
56
- """
57
- And the response page for a "500" error is
58
- """
59
- <!-- AIRBRAKE ERROR -->
60
- """
61
- And I route "/test/index" to "test#index"
62
- And I perform a request to "http://example.com:123/test/index?param=value"
63
- Then I should not see "Airbrake Error b6817316-9c45-ed26-45eb-780dbb86aadb"
@@ -1,94 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + "/lib/insert_commands.rb")
2
- require File.expand_path(File.dirname(__FILE__) + "/lib/rake_commands.rb")
3
-
4
- class AirbrakeGenerator < Rails::Generator::Base
5
- def add_options!(opt)
6
- opt.on('-k', '--api-key=key', String, "Your Airbrake API key") { |v| options[:api_key] = v}
7
- opt.on('-h', '--heroku', "Use the Heroku addon to provide your Airbrake API key") { |v| options[:heroku] = v}
8
- opt.on('-a', '--app=myapp', String, "Your Heroku app name (only required if deploying to >1 Heroku app)") { |v| options[:app] = v}
9
- end
10
-
11
- def manifest
12
- if !api_key_configured? && !options[:api_key] && !options[:heroku]
13
- puts "Must pass --api-key or --heroku or create config/initializers/airbrake.rb"
14
- exit
15
- end
16
- if plugin_is_present?
17
- puts "You must first remove the airbrake plugin. Please run: script/plugin remove airbrake"
18
- exit
19
- end
20
- record do |m|
21
- m.directory 'lib/tasks'
22
- m.file 'airbrake_tasks.rake', 'lib/tasks/airbrake_tasks.rake'
23
- if ['config/deploy.rb', 'Capfile'].all? { |file| File.exists?(file) }
24
- m.append_to 'config/deploy.rb', capistrano_hook
25
- end
26
- if api_key_expression
27
- if use_initializer?
28
- m.template 'initializer.rb', 'config/initializers/airbrake.rb',
29
- :assigns => {:api_key => api_key_expression}
30
- else
31
- m.template 'initializer.rb', 'config/airbrake.rb',
32
- :assigns => {:api_key => api_key_expression}
33
- m.append_to 'config/environment.rb', "require 'config/airbrake'"
34
- end
35
- end
36
- determine_api_key if heroku?
37
- m.rake "airbrake:test --trace", :generate_only => true
38
- end
39
- end
40
-
41
- def api_key_expression
42
- s = if options[:api_key]
43
- "'#{options[:api_key]}'"
44
- elsif options[:heroku]
45
- "ENV['HOPTOAD_API_KEY']"
46
- end
47
- end
48
-
49
- def determine_api_key
50
- puts "Attempting to determine your API Key from Heroku..."
51
- ENV['HOPTOAD_API_KEY'] = heroku_api_key
52
- if ENV['HOPTOAD_API_KEY'].blank?
53
- puts "... Failed."
54
- puts "WARNING: We were unable to detect the Airbrake API Key from your Heroku environment."
55
- puts "Your Heroku application environment may not be configured correctly."
56
- exit 1
57
- else
58
- puts "... Done."
59
- puts "Heroku's Airbrake API Key is '#{ENV['HOPTOAD_API_KEY']}'"
60
- end
61
- end
62
-
63
- def heroku_var(var,app_name = nil)
64
- app = app_name ? "--app #{app_name}" : ''
65
- `heroku config #{app} | grep -E "#{var.upcase}" | awk '{ print $3; }'`.strip
66
- end
67
-
68
- def heroku_api_key
69
- heroku_var("(hoptoad|airbrake)_api_key",options[:app]).split.find {|x| x unless x.blank?}
70
- end
71
-
72
- def heroku?
73
- options[:heroku] ||
74
- system("grep HOPTOAD_API_KEY config/initializers/airbrake.rb") ||
75
- system("grep HOPTOAD_API_KEY config/environment.rb")
76
- end
77
-
78
- def use_initializer?
79
- Rails::VERSION::MAJOR > 1
80
- end
81
-
82
- def api_key_configured?
83
- File.exists?('config/initializers/airbrake.rb') ||
84
- system("grep Airbrake config/environment.rb")
85
- end
86
-
87
- def capistrano_hook
88
- IO.read(source_path('capistrano_hook.rb'))
89
- end
90
-
91
- def plugin_is_present?
92
- File.exists?('vendor/plugins/airbrake')
93
- end
94
- end
@@ -1,34 +0,0 @@
1
- # Mostly pinched from http://github.com/ryanb/nifty-generators/tree/master
2
-
3
- Rails::Generator::Commands::Base.class_eval do
4
- def file_contains?(relative_destination, line)
5
- File.read(destination_path(relative_destination)).include?(line)
6
- end
7
- end
8
-
9
- Rails::Generator::Commands::Create.class_eval do
10
- def append_to(file, line)
11
- logger.insert "#{line} appended to #{file}"
12
- unless options[:pretend] || file_contains?(file, line)
13
- File.open(file, "a") do |file|
14
- file.puts
15
- file.puts line
16
- end
17
- end
18
- end
19
- end
20
-
21
- Rails::Generator::Commands::Destroy.class_eval do
22
- def append_to(file, line)
23
- logger.remove "#{line} removed from #{file}"
24
- unless options[:pretend]
25
- gsub_file file, "\n#{line}", ''
26
- end
27
- end
28
- end
29
-
30
- Rails::Generator::Commands::List.class_eval do
31
- def append_to(file, line)
32
- logger.insert "#{line} appended to #{file}"
33
- end
34
- end
@@ -1,24 +0,0 @@
1
- Rails::Generator::Commands::Create.class_eval do
2
- def rake(cmd, opts = {})
3
- logger.rake "rake #{cmd}"
4
- unless system("rake #{cmd}")
5
- logger.rake "#{cmd} failed. Rolling back"
6
- command(:destroy).invoke!
7
- end
8
- end
9
- end
10
-
11
- Rails::Generator::Commands::Destroy.class_eval do
12
- def rake(cmd, opts = {})
13
- unless opts[:generate_only]
14
- logger.rake "rake #{cmd}"
15
- system "rake #{cmd}"
16
- end
17
- end
18
- end
19
-
20
- Rails::Generator::Commands::List.class_eval do
21
- def rake(cmd, opts = {})
22
- logger.rake "rake #{cmd}"
23
- end
24
- end
@@ -1,25 +0,0 @@
1
- # Don't load anything when running the gems:* tasks.
2
- # Otherwise, airbrake will be considered a framework gem.
3
- # https://thoughtbot.lighthouseapp.com/projects/14221/tickets/629
4
- unless ARGV.any? {|a| a =~ /^gems/}
5
-
6
- Dir[File.join(Rails.root, 'vendor', 'gems', 'airbrake-*')].each do |vendored_notifier|
7
- $: << File.join(vendored_notifier, 'lib')
8
- end
9
-
10
- begin
11
- require 'airbrake/tasks'
12
- rescue LoadError => exception
13
- namespace :airbrake do
14
- %w(deploy test log_stdout).each do |task_name|
15
- desc "Missing dependency for airbrake:#{task_name}"
16
- task task_name do
17
- $stderr.puts "Failed to run airbrake:#{task_name} because of missing dependency."
18
- $stderr.puts "You probably need to run `rake gems:install` to install the airbrake gem"
19
- abort exception.inspect
20
- end
21
- end
22
- end
23
- end
24
-
25
- end
@@ -1,6 +0,0 @@
1
-
2
- Dir[File.join(File.dirname(__FILE__), '..', 'vendor', 'gems', 'airbrake-*')].each do |vendored_notifier|
3
- $: << File.join(vendored_notifier, 'lib')
4
- end
5
-
6
- require 'airbrake/capistrano'
@@ -1,6 +0,0 @@
1
- <% if Rails::VERSION::MAJOR < 3 && Rails::VERSION::MINOR < 2 -%>
2
- require 'airbrake/rails'
3
- <% end -%>
4
- Airbrake.configure do |config|
5
- config.api_key = <%= api_key_expression %>
6
- end
data/install.rb DELETED
@@ -1 +0,0 @@
1
- puts IO.read(File.join(File.dirname(__FILE__), 'INSTALL'))
@@ -1,108 +0,0 @@
1
- module Airbrake
2
- # Front end to parsing the backtrace for each notice
3
- class Backtrace
4
-
5
- # Handles backtrace parsing line by line
6
- class Line
7
-
8
- # regexp (optionnally allowing leading X: for windows support)
9
- INPUT_FORMAT = %r{^((?:[a-zA-Z]:)?[^:]+):(\d+)(?::in `([^']+)')?$}.freeze
10
-
11
- # The file portion of the line (such as app/models/user.rb)
12
- attr_reader :file
13
-
14
- # The line number portion of the line
15
- attr_reader :number
16
-
17
- # The method of the line (such as index)
18
- attr_reader :method
19
-
20
- # Parses a single line of a given backtrace
21
- # @param [String] unparsed_line The raw line from +caller+ or some backtrace
22
- # @return [Line] The parsed backtrace line
23
- def self.parse(unparsed_line)
24
- _, file, number, method = unparsed_line.match(INPUT_FORMAT).to_a
25
- new(file, number, method)
26
- end
27
-
28
- def initialize(file, number, method)
29
- self.file = file
30
- self.number = number
31
- self.method = method
32
- end
33
-
34
- # Reconstructs the line in a readable fashion
35
- def to_s
36
- "#{file}:#{number}:in `#{method}'"
37
- end
38
-
39
- def ==(other)
40
- to_s == other.to_s
41
- end
42
-
43
- def inspect
44
- "<Line:#{to_s}>"
45
- end
46
-
47
- private
48
-
49
- attr_writer :file, :number, :method
50
- end
51
-
52
- # holder for an Array of Backtrace::Line instances
53
- attr_reader :lines
54
-
55
- def self.parse(ruby_backtrace, opts = {})
56
- ruby_lines = split_multiline_backtrace(ruby_backtrace)
57
-
58
- filters = opts[:filters] || []
59
- filtered_lines = ruby_lines.to_a.map do |line|
60
- filters.inject(line) do |line, proc|
61
- proc.call(line)
62
- end
63
- end.compact
64
-
65
- lines = filtered_lines.collect do |unparsed_line|
66
- Line.parse(unparsed_line)
67
- end
68
-
69
- instance = new(lines)
70
- end
71
-
72
- def initialize(lines)
73
- self.lines = lines
74
- end
75
-
76
- def inspect
77
- "<Backtrace: " + lines.collect { |line| line.inspect }.join(", ") + ">"
78
- end
79
-
80
- def to_s
81
- content = []
82
- lines.each do |line|
83
- content << line
84
- end
85
- content.join("\n")
86
- end
87
-
88
- def ==(other)
89
- if other.respond_to?(:lines)
90
- lines == other.lines
91
- else
92
- false
93
- end
94
- end
95
-
96
- private
97
-
98
- attr_writer :lines
99
-
100
- def self.split_multiline_backtrace(backtrace)
101
- if backtrace.to_a.size == 1
102
- backtrace.to_a.first.split(/\n\s*/)
103
- else
104
- backtrace
105
- end
106
- end
107
- end
108
- end
@@ -1,68 +0,0 @@
1
- require File.expand_path( "../runner", __FILE__)
2
-
3
- module Client
4
- extend self
5
-
6
- def options
7
- Runner.options
8
- end
9
-
10
- def fetch_projects
11
- uri = URI.parse "http://#{options.account}.airbrake.io"\
12
- "/data_api/v1/projects.xml?auth_token=#{options.auth_token}"
13
- http = Net::HTTP.new(uri.host,uri.port)
14
- request = Net::HTTP::Get.new(uri.request_uri)
15
- response = http.request(request)
16
- response.body
17
- end
18
-
19
- def create_project
20
- uri = URI.parse "http://#{options.account}.airbrake.io"\
21
- "/data_api/v1/projects.xml"
22
- http = Net::HTTP.new(uri.host,uri.port)
23
- request = Net::HTTP::Post.new(uri.request_uri)
24
- request.set_form_data('project[name]' => options.name,'auth_token' => options.auth_token)
25
- response = http.request(request)
26
- response.body
27
-
28
- print_project_response(response.body)
29
- end
30
-
31
- def create_deploy
32
- uri = URI.parse "http://airbrake.io"\
33
- "/projects/1/deploys.xml"
34
- http = Net::HTTP.new(uri.host,uri.port)
35
- request = Net::HTTP::Post.new(uri.request_uri)
36
- request.set_form_data('deploy[rails_env]' => options.rails_env,"api_key" => options.api_key)
37
- response = http.request(request)
38
- puts response.body
39
- end
40
-
41
- def print_projects
42
- factory = ProjectFactory.new
43
- projects = fetch_projects
44
- factory.create_projects_from_xml(projects)
45
- abort "No projects were fetched. Did you provide the correct auth token?" if projects.match(/error/m)
46
- puts "\nProjects\n" + "".rjust(63,"#")
47
- factory.projects.each do |project|
48
- puts project
49
- end
50
- puts
51
- end
52
-
53
- def print_project_response(response)
54
- case response
55
- when /errors/
56
- puts "Error creating project: #{response.gsub("\n","").scan(/.*<error[^>]*>(.*?)<\/error>.*/).last.first.gsub(/\s{1,}/," ")}"
57
- when /project/
58
- project = Project.new(:id => response[/<id[^>]*>(.*?)<\/id>/,1],
59
- :name => response[/<name[^>]*>(.*?)<\/name>/,1],
60
- :api_key => response[/<api-key[^>]*>(.*?)<\/api-key>/,1])
61
- puts "\nProject details\n" + "".rjust(63,"#")
62
- puts project
63
- else
64
- puts "Unexpected error. Please try again!\n"
65
- puts response
66
- end
67
- end
68
- end
@@ -1,41 +0,0 @@
1
- class Options
2
-
3
- ATTRIBUTES = [:error, :message, :api_key, :host, :port, :auth_token, :name, :account, :rails_env]
4
-
5
- ATTRIBUTES.each do |attribute|
6
- attr_reader attribute
7
- end
8
-
9
- private
10
-
11
- # You should not write to this from outside
12
- ATTRIBUTES.each do |attribute|
13
- attr_writer attribute
14
- end
15
-
16
- public
17
-
18
- # Parses all the options passed and stores them in attributes
19
- def initialize(array = [])
20
- opts = Hash[*array]
21
- self.error = opts.delete("-e") || opts.delete("--error") { RuntimeError }
22
- self.message = opts.delete("-m") || opts.delete("--message") { "I've made a huge mistake" }
23
- self.api_key = opts.delete("-k") || opts.delete("--api-key") || config_from_file.api_key || ENV["AIRBRAKE_API_KEY"]
24
- self.host = opts.delete("-h") || opts.delete("--host") || config_from_file.host
25
- self.port = opts.delete("-p") || opts.delete("--port") || config_from_file.port
26
- self.auth_token = opts.delete("-t") || opts.delete("--auth-token") || ENV["AIRBRAKE_AUTH_TOKEN"]
27
- self.name = opts.delete("-n") || opts.delete("--name")
28
- self.account = opts.delete("-a") || opts.delete("--account") || ENV["AIRBRAKE_ACCOUNT"]
29
- self.rails_env = opts.delete("-E") || opts.delete("--rails-env") || ENV["RAILS_ENV"] || "production"
30
- opts
31
- end
32
-
33
- # Fallback to read from the initializer
34
- def config_from_file
35
- begin
36
- load "config/initializers/airbrake.rb"
37
- rescue LoadError
38
- end
39
- Airbrake.configuration
40
- end
41
- end