honeybadger 1.16.7 → 2.0.0.beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (200) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +19 -0
  3. data/README.md +37 -16
  4. data/bin/honeybadger +5 -0
  5. data/lib/honeybadger.rb +167 -191
  6. data/lib/honeybadger/agent.rb +136 -0
  7. data/lib/honeybadger/backend.rb +26 -0
  8. data/lib/honeybadger/backend/base.rb +66 -0
  9. data/lib/honeybadger/backend/debug.rb +12 -0
  10. data/lib/honeybadger/backend/null.rb +16 -0
  11. data/lib/honeybadger/backend/server.rb +51 -0
  12. data/lib/honeybadger/backend/test.rb +24 -0
  13. data/lib/honeybadger/backtrace.rb +29 -24
  14. data/lib/honeybadger/cli.rb +367 -0
  15. data/lib/honeybadger/config.rb +333 -0
  16. data/lib/honeybadger/config/callbacks.rb +70 -0
  17. data/lib/honeybadger/config/defaults.rb +175 -0
  18. data/lib/honeybadger/config/env.rb +40 -0
  19. data/lib/honeybadger/config/yaml.rb +43 -0
  20. data/lib/honeybadger/const.rb +28 -0
  21. data/lib/honeybadger/init/rails.rb +84 -0
  22. data/lib/honeybadger/init/sinatra.rb +27 -0
  23. data/lib/honeybadger/logging.rb +133 -0
  24. data/lib/honeybadger/notice.rb +243 -280
  25. data/lib/honeybadger/plugin.rb +110 -0
  26. data/lib/honeybadger/plugins/delayed_job.rb +22 -0
  27. data/lib/honeybadger/{integrations → plugins}/delayed_job/plugin.rb +6 -7
  28. data/lib/honeybadger/{integrations → plugins}/local_variables.rb +7 -8
  29. data/lib/honeybadger/{integrations → plugins}/net_http.rb +10 -8
  30. data/lib/honeybadger/plugins/passenger.rb +24 -0
  31. data/lib/honeybadger/plugins/rails.rb +61 -0
  32. data/lib/honeybadger/plugins/sidekiq.rb +35 -0
  33. data/lib/honeybadger/{integrations → plugins}/thor.rb +9 -8
  34. data/lib/honeybadger/{integrations → plugins}/unicorn.rb +10 -9
  35. data/lib/honeybadger/rack/error_notifier.rb +44 -27
  36. data/lib/honeybadger/rack/metrics_reporter.rb +41 -0
  37. data/lib/honeybadger/rack/request_hash.rb +50 -0
  38. data/lib/honeybadger/rack/user_feedback.rb +15 -10
  39. data/lib/honeybadger/rack/user_informer.rb +14 -3
  40. data/lib/honeybadger/trace.rb +185 -0
  41. data/lib/honeybadger/util/http.rb +79 -0
  42. data/lib/honeybadger/util/request_sanitizer.rb +35 -0
  43. data/lib/honeybadger/util/sanitizer.rb +71 -0
  44. data/lib/honeybadger/util/stats.rb +31 -0
  45. data/lib/honeybadger/version.rb +4 -0
  46. data/lib/honeybadger/worker.rb +224 -0
  47. data/lib/honeybadger/worker/batch.rb +50 -0
  48. data/lib/honeybadger/worker/metered_queue.rb +80 -0
  49. data/lib/honeybadger/worker/metrics_collection.rb +61 -0
  50. data/lib/honeybadger/worker/metrics_collector.rb +96 -0
  51. data/{lib/honeybadger/capistrano.rb → vendor/capistrano-honeybadger/lib/capistrano/honeybadger.rb} +1 -3
  52. data/vendor/capistrano-honeybadger/lib/capistrano/tasks/deploy.cap +76 -0
  53. data/vendor/capistrano-honeybadger/lib/honeybadger/capistrano.rb +2 -0
  54. data/{lib → vendor/capistrano-honeybadger/lib}/honeybadger/capistrano/legacy.rb +16 -15
  55. data/vendor/thor/lib/thor.rb +484 -0
  56. data/vendor/thor/lib/thor/actions.rb +319 -0
  57. data/vendor/thor/lib/thor/actions/create_file.rb +103 -0
  58. data/vendor/thor/lib/thor/actions/create_link.rb +59 -0
  59. data/vendor/thor/lib/thor/actions/directory.rb +118 -0
  60. data/vendor/thor/lib/thor/actions/empty_directory.rb +135 -0
  61. data/vendor/thor/lib/thor/actions/file_manipulation.rb +316 -0
  62. data/vendor/thor/lib/thor/actions/inject_into_file.rb +107 -0
  63. data/vendor/thor/lib/thor/base.rb +656 -0
  64. data/vendor/thor/lib/thor/command.rb +133 -0
  65. data/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb +77 -0
  66. data/vendor/thor/lib/thor/core_ext/io_binary_read.rb +10 -0
  67. data/vendor/thor/lib/thor/core_ext/ordered_hash.rb +98 -0
  68. data/vendor/thor/lib/thor/error.rb +32 -0
  69. data/vendor/thor/lib/thor/group.rb +281 -0
  70. data/vendor/thor/lib/thor/invocation.rb +178 -0
  71. data/vendor/thor/lib/thor/line_editor.rb +17 -0
  72. data/vendor/thor/lib/thor/line_editor/basic.rb +35 -0
  73. data/vendor/thor/lib/thor/line_editor/readline.rb +88 -0
  74. data/vendor/thor/lib/thor/parser.rb +4 -0
  75. data/vendor/thor/lib/thor/parser/argument.rb +73 -0
  76. data/vendor/thor/lib/thor/parser/arguments.rb +175 -0
  77. data/vendor/thor/lib/thor/parser/option.rb +125 -0
  78. data/vendor/thor/lib/thor/parser/options.rb +218 -0
  79. data/vendor/thor/lib/thor/rake_compat.rb +71 -0
  80. data/vendor/thor/lib/thor/runner.rb +322 -0
  81. data/vendor/thor/lib/thor/shell.rb +81 -0
  82. data/vendor/thor/lib/thor/shell/basic.rb +421 -0
  83. data/vendor/thor/lib/thor/shell/color.rb +149 -0
  84. data/vendor/thor/lib/thor/shell/html.rb +126 -0
  85. data/vendor/thor/lib/thor/util.rb +267 -0
  86. data/vendor/thor/lib/thor/version.rb +3 -0
  87. metadata +97 -305
  88. data/Appraisals +0 -95
  89. data/CHANGELOG.md +0 -422
  90. data/Gemfile +0 -8
  91. data/Gemfile.lock +0 -136
  92. data/Guardfile +0 -5
  93. data/MIT-LICENSE +0 -32
  94. data/Rakefile +0 -159
  95. data/features/metal.feature +0 -20
  96. data/features/rack.feature +0 -55
  97. data/features/rails.feature +0 -343
  98. data/features/rails3.x.feature +0 -26
  99. data/features/rake.feature +0 -25
  100. data/features/sinatra.feature +0 -27
  101. data/features/standalone.feature +0 -73
  102. data/features/step_definitions/metal_steps.rb +0 -24
  103. data/features/step_definitions/rack_steps.rb +0 -18
  104. data/features/step_definitions/rails_steps.rb +0 -270
  105. data/features/step_definitions/rake_steps.rb +0 -17
  106. data/features/step_definitions/standalone_steps.rb +0 -12
  107. data/features/step_definitions/thor_steps.rb +0 -4
  108. data/features/support/env.rb +0 -22
  109. data/features/support/honeybadger_failure_shim.rb.template +0 -5
  110. data/features/support/honeybadger_shim.rb.template +0 -6
  111. data/features/support/rails.rb +0 -202
  112. data/features/support/rake/Rakefile +0 -68
  113. data/features/support/test.thor +0 -22
  114. data/features/thor.feature +0 -5
  115. data/gemfiles/binding_of_caller.gemfile +0 -13
  116. data/gemfiles/delayed_job.gemfile +0 -13
  117. data/gemfiles/rack.gemfile +0 -13
  118. data/gemfiles/rails.gemfile +0 -16
  119. data/gemfiles/rails2.3.gemfile +0 -15
  120. data/gemfiles/rails3.0.gemfile +0 -16
  121. data/gemfiles/rails3.1.gemfile +0 -16
  122. data/gemfiles/rails3.2.gemfile +0 -16
  123. data/gemfiles/rails4.0.gemfile +0 -16
  124. data/gemfiles/rails4.1.gemfile +0 -16
  125. data/gemfiles/rake.gemfile +0 -13
  126. data/gemfiles/sinatra.gemfile +0 -13
  127. data/gemfiles/standalone.gemfile +0 -12
  128. data/gemfiles/thor.gemfile +0 -13
  129. data/generators/honeybadger/honeybadger_generator.rb +0 -95
  130. data/generators/honeybadger/lib/insert_commands.rb +0 -34
  131. data/generators/honeybadger/lib/rake_commands.rb +0 -24
  132. data/generators/honeybadger/templates/capistrano_hook.rb +0 -6
  133. data/generators/honeybadger/templates/honeybadger_tasks.rake +0 -25
  134. data/generators/honeybadger/templates/initializer.rb +0 -6
  135. data/honeybadger.gemspec +0 -174
  136. data/lib/honeybadger/array.rb +0 -53
  137. data/lib/honeybadger/capistrano/tasks.rake +0 -73
  138. data/lib/honeybadger/configuration.rb +0 -397
  139. data/lib/honeybadger/dependency.rb +0 -65
  140. data/lib/honeybadger/integrations.rb +0 -9
  141. data/lib/honeybadger/integrations/delayed_job.rb +0 -20
  142. data/lib/honeybadger/integrations/passenger.rb +0 -18
  143. data/lib/honeybadger/integrations/sidekiq.rb +0 -37
  144. data/lib/honeybadger/monitor.rb +0 -17
  145. data/lib/honeybadger/monitor/railtie.rb +0 -53
  146. data/lib/honeybadger/monitor/sender.rb +0 -44
  147. data/lib/honeybadger/monitor/trace.rb +0 -187
  148. data/lib/honeybadger/monitor/worker.rb +0 -169
  149. data/lib/honeybadger/payload.rb +0 -101
  150. data/lib/honeybadger/rack.rb +0 -12
  151. data/lib/honeybadger/rails.rb +0 -45
  152. data/lib/honeybadger/rails/action_controller_catcher.rb +0 -30
  153. data/lib/honeybadger/rails/controller_methods.rb +0 -78
  154. data/lib/honeybadger/rails/middleware/exceptions_catcher.rb +0 -29
  155. data/lib/honeybadger/rails3_tasks.rb +0 -94
  156. data/lib/honeybadger/railtie.rb +0 -52
  157. data/lib/honeybadger/rake_handler.rb +0 -66
  158. data/lib/honeybadger/sender.rb +0 -185
  159. data/lib/honeybadger/shared_tasks.rb +0 -56
  160. data/lib/honeybadger/stats.rb +0 -29
  161. data/lib/honeybadger/tasks.rb +0 -95
  162. data/lib/honeybadger/user_feedback.rb +0 -8
  163. data/lib/honeybadger/user_informer.rb +0 -8
  164. data/lib/honeybadger_tasks.rb +0 -69
  165. data/lib/rails/generators/honeybadger/honeybadger_generator.rb +0 -99
  166. data/rails/init.rb +0 -1
  167. data/resources/README.md +0 -34
  168. data/script/integration_test.rb +0 -38
  169. data/spec/allocation_stats.rb +0 -32
  170. data/spec/honeybadger/backtrace_spec.rb +0 -242
  171. data/spec/honeybadger/capistrano_spec.rb +0 -36
  172. data/spec/honeybadger/configuration_spec.rb +0 -328
  173. data/spec/honeybadger/dependency_spec.rb +0 -134
  174. data/spec/honeybadger/integrations/delayed_job_spec.rb +0 -82
  175. data/spec/honeybadger/integrations/local_variables_spec.rb +0 -60
  176. data/spec/honeybadger/integrations/net_http_spec.rb +0 -29
  177. data/spec/honeybadger/integrations/passenger_spec.rb +0 -29
  178. data/spec/honeybadger/integrations/sidekiq_spec.rb +0 -60
  179. data/spec/honeybadger/integrations/thor_spec.rb +0 -32
  180. data/spec/honeybadger/integrations/unicorn_spec.rb +0 -40
  181. data/spec/honeybadger/logger_spec.rb +0 -79
  182. data/spec/honeybadger/monitor/trace_spec.rb +0 -65
  183. data/spec/honeybadger/monitor/worker_spec.rb +0 -274
  184. data/spec/honeybadger/notice_spec.rb +0 -669
  185. data/spec/honeybadger/notifier_spec.rb +0 -328
  186. data/spec/honeybadger/payload_spec.rb +0 -162
  187. data/spec/honeybadger/rack_spec.rb +0 -85
  188. data/spec/honeybadger/rails/action_controller_spec.rb +0 -328
  189. data/spec/honeybadger/rails_spec.rb +0 -37
  190. data/spec/honeybadger/sender_spec.rb +0 -317
  191. data/spec/honeybadger/stats_spec.rb +0 -57
  192. data/spec/honeybadger/user_feedback_spec.rb +0 -80
  193. data/spec/honeybadger/user_informer_spec.rb +0 -30
  194. data/spec/honeybadger_tasks_spec.rb +0 -171
  195. data/spec/spec_helper.rb +0 -24
  196. data/spec/support/array_including.rb +0 -31
  197. data/spec/support/backtraced_exception.rb +0 -9
  198. data/spec/support/collected_sender.rb +0 -12
  199. data/spec/support/defines_constants.rb +0 -18
  200. data/spec/support/helpers.rb +0 -101
@@ -1,17 +0,0 @@
1
- When /I run rake with (.+)/ do |command|
2
- @rake_command = "rake #{command.gsub(' ','_')}"
3
- @rake_result = `cd features/support/rake && #{@rake_command} 2>&1`
4
- end
5
-
6
- Then /Honeybadger should (|not) ?catch the exception/ do |condition|
7
- if condition=='not'
8
- @rake_result.should_not =~ /^honeybadger/
9
- else
10
- @rake_result.should =~ /^honeybadger/
11
- end
12
- end
13
-
14
- Then /Honeybadger should send the rake command line as the component name/ do
15
- component = @rake_result.match(/^honeybadger (.*)$/)[1]
16
- component.should == @rake_command
17
- end
@@ -1,12 +0,0 @@
1
- Given /^the following Ruby app:$/ do |definition|
2
- File.open(RUBY_FILE, 'w') do |file|
3
- file.puts "require 'rubygems'"
4
- file.write(IO.read(SHIM_FILE))
5
- file.write(definition)
6
- end
7
- end
8
-
9
- When /^I execute the file$/ do
10
- step %(I run `ruby #{RUBY_FILE}`)
11
- end
12
-
@@ -1,4 +0,0 @@
1
- When /I run thor with (.+)/ do |command|
2
- FileUtils.cp(File.expand_path('../../support/test.thor', __FILE__), TEMP_DIR)
3
- step %(I run `thor #{command.gsub(' ','_')}`)
4
- end
@@ -1,22 +0,0 @@
1
- require 'rspec'
2
- require 'aruba/cucumber'
3
-
4
- # For Rails 4.2 default config/secret.yml in production.
5
- ENV['SECRET_KEY_BASE'] = '7bc6db16868d67417ea7acade8c409c0b6a5d14bd578dcc8ef269a5a18d84e95dfcb12d6e5370a5655bc14db17be68f3900344aa87d7d97c01139e2fa6656bdc'
6
-
7
- PROJECT_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..', '..')).freeze
8
- TEMP_DIR = File.join(PROJECT_ROOT, 'tmp').freeze
9
- LOCAL_RAILS_ROOT = File.join(TEMP_DIR, 'rails_root').freeze
10
- RACK_FILE = File.join(TEMP_DIR, 'rack_app.rb').freeze
11
- RUBY_FILE = File.join(TEMP_DIR, 'ruby_app.rb').freeze
12
- SHIM_FILE = File.join(PROJECT_ROOT, 'features', 'support', 'honeybadger_shim.rb.template')
13
-
14
- Before do
15
- FileUtils.rm_rf(LOCAL_RAILS_ROOT)
16
- end
17
-
18
- Before do
19
- @dirs = ["tmp"]
20
- @aruba_timeout_seconds = 45
21
- @aruba_io_wait_seconds = 5
22
- end
@@ -1,5 +0,0 @@
1
- require 'sham_rack'
2
-
3
- ShamRack.at("api.honeybadger.io", 443) do |env|
4
- ["500 Internal Error", { "Content-type" => "text/html" }, ['']]
5
- end
@@ -1,6 +0,0 @@
1
- require 'sham_rack'
2
-
3
- ShamRack.at("api.honeybadger.io", 443).stub.tap do |app|
4
- app.register_resource("/v1/notices/", %({"id":"123456789"}), "application/json")
5
- app.register_resource("/v1/ping/", %({"features":{"notices":true,"feedback":true}, "limit":null}), "application/json")
6
- end
@@ -1,202 +0,0 @@
1
- module RailsHelpers
2
- def application_controller_filename
3
- controller_filename = File.join(rails_root, 'app', 'controllers', "application_controller.rb")
4
- end
5
-
6
- def rails2?
7
- rails_version =~ /^2/
8
- end
9
-
10
- def rails3?
11
- rails_version =~ /^3/
12
- end
13
-
14
- def rails4?
15
- rails_version =~ /^4/
16
- end
17
-
18
- def rails_root
19
- LOCAL_RAILS_ROOT
20
- end
21
-
22
- def rails_uses_rack?
23
- rails4? || rails3? || rails_version =~ /^2\.3/
24
- end
25
-
26
- def capify?
27
- require 'capistrano/version'
28
- !(defined?(Capistrano::VERSION) && Gem::Version.new(Capistrano::VERSION) >= Gem::Version.new('3.0.0'))
29
- end
30
-
31
- def rails_version
32
- @rails_version ||= `bundle exec rails -v`[/\d.+/]
33
- end
34
-
35
- def rails_uses_bundler?
36
- rails4? || rails3?
37
- end
38
-
39
- def rails_manages_gems?
40
- rails_version =~ /^2\.[123]/
41
- end
42
-
43
- def rails_supports_initializers?
44
- rails4? || rails3? || rails_version =~ /^2\./
45
- end
46
-
47
- def rails_finds_generators_in_gems?
48
- rails4? || rails3? || rails_version =~ /^2\./
49
- end
50
-
51
- def environment_path
52
- File.join(rails_root, 'config', 'environment.rb')
53
- end
54
-
55
- def rakefile_path
56
- File.join(rails_root, 'Rakefile')
57
- end
58
-
59
- def rails_initializer_file
60
- File.join(rails_root, 'config', 'initializers', 'honeybadger.rb')
61
- end
62
-
63
- def rails_non_initializer_honeybadger_config_file
64
- File.join(rails_root, 'config', 'honeybadger.rb')
65
- end
66
-
67
- def config_gem(gem_name, version = nil)
68
- run = "Rails::Initializer.run do |config|"
69
- insert = " config.gem '#{gem_name}'"
70
- insert += ", :version => '#{version}'" if version
71
- content = File.read(environment_path)
72
- content = "require 'thread'\n#{content}"
73
- if content.sub!(run, "#{run}\n#{insert}")
74
- File.open(environment_path, 'wb') { |file| file.write(content) }
75
- else
76
- raise "Couldn't find #{run.inspect} in #{environment_path}"
77
- end
78
- end
79
-
80
- def disable_activerecord
81
- run = "Rails::Initializer.run do |config|"
82
- insert = " config.frameworks -= [ :active_record ]"
83
- content = File.read(environment_path)
84
- if content.sub!(run, "#{run}\n#{insert}")
85
- File.open(environment_path, 'wb') { |file| file.write(content) }
86
- else
87
- raise "Couldn't find #{run.inspect} in #{environment_path}"
88
- end
89
- end
90
-
91
- def perform_request(uri, environment = 'production')
92
- if rails4? || rails3?
93
- request_script = <<-SCRIPT
94
- require File.expand_path('../config/environment', __FILE__)
95
-
96
-
97
- env = Rack::MockRequest.env_for(#{uri.inspect})
98
- response = RailsRoot::Application.call(env)
99
-
100
-
101
- response = response.last if response.last.is_a?(ActionDispatch::Response)
102
- response = response.last.to_a if defined?(Rack::BodyProxy) && response.last.is_a?(Rack::BodyProxy)
103
-
104
- if response.is_a?(Array)
105
- puts response.join
106
- else
107
- puts response.body
108
- end
109
- SCRIPT
110
- File.open(File.join(rails_root, 'request.rb'), 'w') { |file| file.write(request_script) }
111
- step %(I run `rails runner -e #{environment} request.rb`)
112
- elsif rails_uses_rack?
113
- request_script = <<-SCRIPT
114
- require File.expand_path('../config/environment', __FILE__)
115
-
116
- env = Rack::MockRequest.env_for(#{uri.inspect})
117
- app = Rack::Lint.new(ActionController::Dispatcher.new)
118
-
119
- status, headers, body = app.call(env)
120
-
121
- response = ""
122
- if body.respond_to?(:to_str)
123
- response << body
124
- else
125
- body.each { |part| response << part }
126
- end
127
-
128
- puts response
129
- SCRIPT
130
- File.open(File.join(rails_root, 'request.rb'), 'w') { |file| file.write(request_script) }
131
- step %(I run `ruby -rthread ./script/runner -e #{environment} request.rb`)
132
- else
133
- uri = URI.parse(uri)
134
- request_script = <<-SCRIPT
135
- require 'cgi'
136
- class CGIWrapper < CGI
137
- def initialize(*args)
138
- @env_table = {}
139
- @stdinput = $stdin
140
- super(*args)
141
- end
142
- attr_reader :env_table
143
- end
144
- $stdin = StringIO.new("")
145
- cgi = CGIWrapper.new
146
- cgi.env_table.update({
147
- 'HTTPS' => 'off',
148
- 'REQUEST_METHOD' => "GET",
149
- 'HTTP_HOST' => #{[uri.host, uri.port].join(':').inspect},
150
- 'SERVER_PORT' => #{uri.port.inspect},
151
- 'REQUEST_URI' => #{uri.request_uri.inspect},
152
- 'PATH_INFO' => #{uri.path.inspect},
153
- 'QUERY_STRING' => #{uri.query.inspect}
154
- })
155
- require 'dispatcher' unless defined?(ActionController::Dispatcher)
156
- Dispatcher.dispatch(cgi)
157
- SCRIPT
158
- File.open(File.join(rails_root, 'request.rb'), 'w') { |file| file.write(request_script) }
159
- step %(I run `ruby -rthread ./script/runner -e #{environment} request.rb`)
160
- end
161
- end
162
-
163
- def monkeypatch_old_version
164
- monkeypatchin= <<-MONKEYPATCHIN
165
-
166
- MissingSourceFile::REGEXPS << [/^cannot load such file -- (.+)$/i, 1]
167
-
168
- MONKEYPATCHIN
169
-
170
- File.open(File.join(rails_root,"config","initializers", 'monkeypatchin.rb'), 'w') { |file| file.write(monkeypatchin) }
171
- end
172
-
173
- def config_gem_dependencies
174
- insert = <<-END
175
- if Gem::VERSION >= "1.3.6"
176
- module Rails
177
- class GemDependency
178
- def requirement
179
- r = super
180
- (r == Gem::Requirement.default) ? nil : r
181
- end
182
- end
183
- end
184
- end
185
- END
186
- run = "Rails::Initializer.run do |config|"
187
- content = File.read(environment_path)
188
- if content.sub!(run, "#{insert}\n#{run}")
189
- File.open(environment_path, 'wb') { |file| file.write(content) }
190
- else
191
- raise "Couldn't find #{run.inspect} in #{environment_path}"
192
- end
193
- end
194
-
195
- def require_thread
196
- content = File.read(rakefile_path)
197
- content = "require 'thread'\n#{content}"
198
- File.open(rakefile_path, 'wb') { |file| file.write(content) }
199
- end
200
- end
201
-
202
- World(RailsHelpers)
@@ -1,68 +0,0 @@
1
- # A test harness for RakeHandler
2
- #
3
- require 'rake'
4
- require 'rubygems'
5
- require 'honeybadger'
6
- require 'honeybadger/rake_handler'
7
-
8
- Honeybadger.configure do |c|
9
- end
10
-
11
- # Should catch exception
12
- task :honeybadger do
13
- Honeybadger.configuration.rescue_rake_exceptions = true
14
- stub_tty_output(true)
15
- raise_exception
16
- end
17
-
18
- # Should not catch exception
19
- task :honeybadger_disabled do
20
- Honeybadger.configuration.rescue_rake_exceptions = false
21
- stub_tty_output(true)
22
- raise_exception
23
- end
24
-
25
- # Should not catch exception as tty_output is true
26
- task :honeybadger_autodetect_from_terminal do
27
- Honeybadger.configuration.rescue_rake_exceptions = nil
28
- stub_tty_output(true)
29
- raise_exception
30
- end
31
-
32
- # Should catch exception as tty_output is false
33
- task :honeybadger_autodetect_not_from_terminal do
34
- Honeybadger.configuration.rescue_rake_exceptions = nil
35
- stub_tty_output(false)
36
- raise_exception
37
- end
38
-
39
- task :honeybadger_not_yet_configured do
40
- Honeybadger.configuration.rescue_rake_exceptions = true
41
- stub_tty_output(true)
42
- stub_empty_sender
43
- raise_exception
44
- end
45
-
46
- module Honeybadger
47
- def self.notify_or_ignore(*args)
48
- # TODO if you need to check more params, you'll have to use json.dump or something
49
- $stderr.puts "honeybadger #{args[1][:component]}"
50
- end
51
- end
52
-
53
- def stub_empty_sender
54
- Honeybadger.sender = nil
55
- end
56
-
57
- def stub_tty_output(value)
58
- Rake.application.instance_eval do
59
- @tty_output_stub = value
60
- def tty_output?
61
- @tty_output_stub
62
- end
63
- end
64
- end
65
-
66
- def raise_exception
67
- raise 'TEST'
68
- end
@@ -1,22 +0,0 @@
1
- require 'thor'
2
- require 'honeybadger'
3
-
4
- require 'sham_rack'
5
-
6
- ShamRack.at("api.honeybadger.io", 443).stub.tap do |app|
7
- app.register_resource("/v1/notices/", %({"id":"123456789"}), "application/json")
8
- app.register_resource("/v1/ping/", %({"features":{"notices":true,"feedback":true}, "limit":null}), "application/json")
9
- end
10
-
11
- Honeybadger.configure do |config|
12
- config.api_key = 'asdf'
13
- config.debug = true
14
- config.logger = Logger.new(STDOUT)
15
- end
16
-
17
- class Test < Thor
18
- desc "honeybadger", "this goes boom"
19
- def honeybadger
20
- fail 'boom'
21
- end
22
- end
@@ -1,5 +0,0 @@
1
- Feature: Use the Gem to catch errors in a Thor application
2
-
3
- Scenario: Catching exceptions in Thor
4
- When I run thor with test:honeybadger
5
- Then I should receive a Honeybadger notification
@@ -1,13 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "allocation_stats", :platforms => :mri_21
6
- gem "binding_of_caller"
7
- gem "honeybadger", :path => "../"
8
-
9
- group :development, :test do
10
- gem "cucumber", "~> 1.3.10", :github => "cucumber/cucumber", :branch => "v1.3.x-bugfix"
11
- end
12
-
13
- gemspec :path => "../"
@@ -1,13 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "allocation_stats", :platforms => :mri_21
6
- gem "delayed_job"
7
- gem "honeybadger", :path => "../"
8
-
9
- group :development, :test do
10
- gem "cucumber", "~> 1.3.10", :github => "cucumber/cucumber", :branch => "v1.3.x-bugfix"
11
- end
12
-
13
- gemspec :path => "../"
@@ -1,13 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "allocation_stats", :platforms => :mri_21
6
- gem "rack"
7
- gem "honeybadger", :path => "../"
8
-
9
- group :development, :test do
10
- gem "cucumber", "~> 1.3.10", :github => "cucumber/cucumber", :branch => "v1.3.x-bugfix"
11
- end
12
-
13
- gemspec :path => "../"
@@ -1,16 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "allocation_stats", :platforms => :mri_21
6
- gem "rails", "~> 4.2.0"
7
- gem "honeybadger", :path => "../"
8
- gem "capistrano", "~> 3.0"
9
- gem "better_errors", "~> 1.0", :require => false
10
- gem "rack-mini-profiler", :require => false
11
-
12
- group :development, :test do
13
- gem "cucumber", "~> 1.3.10", :github => "cucumber/cucumber", :branch => "v1.3.x-bugfix"
14
- end
15
-
16
- gemspec :path => "../"
@@ -1,15 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "allocation_stats", :platforms => :mri_21
6
- gem "rails", "~> 2.3.18"
7
- gem "rake", "0.9.5"
8
- gem "honeybadger", :path => "../"
9
- gem "capistrano", "~> 2.0"
10
-
11
- group :development, :test do
12
- gem "cucumber", "~> 1.3.10", :github => "cucumber/cucumber", :branch => "v1.3.x-bugfix"
13
- end
14
-
15
- gemspec :path => "../"