airbrake 3.0.2 → 3.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,10 @@
1
+ Version 3.0.3 - Sat Sep 03 13:18:26 -0400 2011
2
+ ===============================================================================
3
+ David Czarnecki(1):
4
+ Use capistrano's logger, improve tests around capistrano deploy.
5
+ Florent Guilleux(1):
6
+ README updates
7
+
1
8
  Version 3.0.2 - Mon Aug 29 10:32:04 -0400 2011
2
9
  ===============================================================================
3
10
  Harold Gimenez(1)
@@ -464,5 +471,6 @@ Nick Quaranto (3):
464
471
 
465
472
 
466
473
 
474
+
467
475
 
468
476
 
data/README.md CHANGED
@@ -130,7 +130,7 @@ this rake task (from RAILS_ROOT):
130
130
 
131
131
  rake airbrake:test
132
132
 
133
- If everything is configured properly, that task will send a notice to Hoptoad
133
+ If everything is configured properly, that task will send a notice to Airbrake
134
134
  which will be visible immediately.
135
135
 
136
136
  Rack
@@ -219,8 +219,8 @@ ID of the error that is returned from Airbrake.
219
219
 
220
220
  You can also turn the middleware that handles this completely off by setting `config.user_information` to false.
221
221
 
222
- Tracking deployments in Hoptoad
223
- -------------------------------
222
+ Tracking deployments in Airbrake
223
+ --------------------------------
224
224
 
225
225
  Paying Airbrake plans support the ability to track deployments of your application in Airbrake.
226
226
  By notifying Airbrake of your application deployments, all errors are resolved when a deploy occurs,
@@ -263,7 +263,7 @@ While in your controllers you use the `notify_airbrake` method, anywhere else in
263
263
  your code, use `Airbrake.notify`. Airbrake will get all the information
264
264
  about the error itself. As for a hash, these are the keys you should pass:
265
265
 
266
- * `:error_class` - Use this to group similar errors together. When Hoptoad catches an exception it sends the class name of that exception object.
266
+ * `:error_class` - Use this to group similar errors together. When Airbrake catches an exception it sends the class name of that exception object.
267
267
  * `:error_message` - This is the title of the error you see in the errors list. For exceptions it is "#{exception.class.name}: #{exception.message}"
268
268
  * `:parameters` - While there are several ways to send additional data to Airbrake, passing a Hash as :parameters as in the example above is the most common use case. When Airbrake catches an exception in a controller, the actual HTTP client request parameters are sent using this key.
269
269
 
@@ -298,7 +298,7 @@ them even logged.
298
298
  This filter will only be applied to automatic notifications, not manual
299
299
  notifications (when #notify is called directly).
300
300
 
301
- Hoptoad ignores the following exceptions by default:
301
+ Airbrake ignores the following exceptions by default:
302
302
 
303
303
  AbstractController::ActionNotFound
304
304
  ActiveRecord::RecordNotFound
@@ -341,7 +341,7 @@ To ignore exceptions based on other conditions, use #ignore_by_filter:
341
341
  end
342
342
  end
343
343
 
344
- To replace sensitive information sent to the Hoptoad service with [FILTERED] use #params_filters:
344
+ To replace sensitive information sent to the Airbrake service with [FILTERED] use #params_filters:
345
345
 
346
346
  Airbrake.configure do |config|
347
347
  config.api_key = '1234567890abcdef'
@@ -421,7 +421,7 @@ Credits
421
421
 
422
422
  Airbrake is maintained and funded by [thoughtbot, inc](http://thoughtbot.com/community)
423
423
 
424
- Thank you to all [the contributors](https://github.com/thoughtbot/hoptoad_notifier/contributors)!
424
+ Thank you to all [the contributors](https://github.com/thoughtbot/airbrake/contributors)!
425
425
 
426
426
  The names and logos for thoughtbot are trademarks of thoughtbot, inc.
427
427
 
data/airbrake.gemspec CHANGED
@@ -24,6 +24,7 @@ Gem::Specification.new do |s|
24
24
  s.add_development_dependency("rspec", "~> 2.6.0")
25
25
  s.add_development_dependency("sham_rack", "~> 1.3.0")
26
26
  s.add_development_dependency("shoulda", "~> 2.11.3")
27
+ s.add_development_dependency("capistrano", "~> 2.8.0")
27
28
 
28
29
  s.authors = ["thoughtbot, inc"]
29
30
  s.email = %q{support@airbrakeapp.com}
data/lib/airbrake.rb CHANGED
@@ -35,7 +35,7 @@ module Airbrake
35
35
 
36
36
  # A Airbrake configuration object. Must act like a hash and return sensible
37
37
  # values for all Airbrake configuration options. See Airbrake::Configuration.
38
- attr_accessor :configuration
38
+ attr_writer :configuration
39
39
 
40
40
  # Tell the log that the Notifier is good to go
41
41
  def report_ready
@@ -77,12 +77,17 @@ module Airbrake
77
77
  # config.secure = false
78
78
  # end
79
79
  def configure(silent = false)
80
- self.configuration ||= Configuration.new
81
80
  yield(configuration)
82
81
  self.sender = Sender.new(configuration)
83
82
  report_ready unless silent
84
83
  end
85
84
 
85
+ # The configuration object.
86
+ # @see Airbrake.configure
87
+ def configuration
88
+ @configuration ||= Configuration.new
89
+ end
90
+
86
91
  # Sends an exception manually using this method, even when you are not in a controller.
87
92
  #
88
93
  # @param [Exception] exception The exception you want to notify Airbrake about.
@@ -1,21 +1,32 @@
1
1
  # Defines deploy:notify_airbrake which will send information about the deploy to Airbrake.
2
+ require 'capistrano'
2
3
 
3
- Capistrano::Configuration.instance(:must_exist).load do
4
- after "deploy", "deploy:notify_airbrake"
5
- after "deploy:migrations", "deploy:notify_airbrake"
4
+ module Airbrake
5
+ module Capistrano
6
+ def self.load_into(configuration)
7
+ configuration.load do
8
+ after "deploy", "airbrake:notify"
9
+ after "deploy:migrations", "airbrake:notify"
6
10
 
7
- namespace :deploy do
8
- desc "Notify Airbrake of the deployment"
9
- task :notify_airbrake, :except => { :no_release => true } do
10
- rails_env = fetch(:airbrake_env, fetch(:rails_env, "production"))
11
- local_user = ENV['USER'] || ENV['USERNAME']
12
- executable = RUBY_PLATFORM.downcase.include?('mswin') ? fetch(:rake, 'rake.bat') : fetch(:rake, 'rake')
13
- notify_command = "#{executable} airbrake:deploy TO=#{rails_env} REVISION=#{current_revision} REPO=#{repository} USER=#{local_user}"
14
- notify_command << " DRY_RUN=true" if dry_run
15
- notify_command << " API_KEY=#{ENV['API_KEY']}" if ENV['API_KEY']
16
- puts "Notifying Airbrake of Deploy (#{notify_command})"
17
- `#{notify_command}`
18
- puts "Airbrake Notification Complete."
11
+ namespace :airbrake do
12
+ desc "Notify Airbrake of the deployment"
13
+ task :notify, :except => { :no_release => true } do
14
+ rails_env = fetch(:airbrake_env, fetch(:rails_env, "production"))
15
+ local_user = ENV['USER'] || ENV['USERNAME']
16
+ executable = RUBY_PLATFORM.downcase.include?('mswin') ? fetch(:rake, 'rake.bat') : fetch(:rake, 'rake')
17
+ notify_command = "#{executable} airbrake:deploy TO=#{rails_env} REVISION=#{current_revision} REPO=#{repository} USER=#{local_user}"
18
+ notify_command << " DRY_RUN=true" if dry_run
19
+ notify_command << " API_KEY=#{ENV['API_KEY']}" if ENV['API_KEY']
20
+ logger.info "Notifying Airbrake of Deploy (#{notify_command})"
21
+ `#{notify_command}` if !configuration.dry_run
22
+ logger.info "Airbrake Notification Complete."
23
+ end
24
+ end
25
+ end
19
26
  end
20
27
  end
21
28
  end
29
+
30
+ if Capistrano::Configuration.instance
31
+ Airbrake::Capistrano.load_into(Capistrano::Configuration.instance)
32
+ end
@@ -1,3 +1,3 @@
1
1
  module Airbrake
2
- VERSION = "3.0.2".freeze
2
+ VERSION = "3.0.3".freeze
3
3
  end
@@ -0,0 +1,33 @@
1
+ require File.dirname(__FILE__) + '/helper'
2
+
3
+ require 'capistrano/configuration'
4
+ require 'airbrake/capistrano'
5
+
6
+ class CapistranoTest < Test::Unit::TestCase
7
+ def setup
8
+ super
9
+ reset_config
10
+
11
+ @configuration = Capistrano::Configuration.new
12
+ Airbrake::Capistrano.load_into(@configuration)
13
+ @configuration.dry_run = true
14
+ end
15
+
16
+ should "define deploy:notify_airbrake task" do
17
+ assert_not_nil @configuration.find_task('airbrake:notify')
18
+ end
19
+
20
+ should "log when calling deploy:notify_airbrake task" do
21
+ @configuration.set(:current_revision, '084505b1c0e0bcf1526e673bb6ac99fbcb18aecc')
22
+ @configuration.set(:repository, 'repository')
23
+ io = StringIO.new
24
+ logger = Capistrano::Logger.new(:output => io)
25
+ logger.level = Capistrano::Logger::MAX_LEVEL
26
+
27
+ @configuration.logger = logger
28
+ @configuration.find_and_execute_task('airbrake:notify')
29
+
30
+ assert io.string.include?('** Notifying Airbrake of Deploy')
31
+ assert io.string.include?('** Airbrake Notification Complete')
32
+ end
33
+ end
@@ -181,6 +181,11 @@ class ConfigurationTest < Test::Unit::TestCase
181
181
  assert_equal "CUSTOM LOGGER", config.logger
182
182
  end
183
183
 
184
+ should 'give a new instance if non defined' do
185
+ Airbrake.configuration = nil
186
+ assert_kind_of Airbrake::Configuration, Airbrake.configuration
187
+ end
188
+
184
189
  def assert_config_default(option, default_value, config = nil)
185
190
  config ||= Airbrake::Configuration.new
186
191
  assert_equal default_value, config.send(option)
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: airbrake
3
3
  version: !ruby/object:Gem::Version
4
- hash: 3
4
+ hash: 1
5
5
  prerelease:
6
6
  segments:
7
7
  - 3
8
8
  - 0
9
- - 2
10
- version: 3.0.2
9
+ - 3
10
+ version: 3.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - thoughtbot, inc
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-08-29 00:00:00 Z
18
+ date: 2011-09-03 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: builder
@@ -205,6 +205,22 @@ dependencies:
205
205
  version: 2.11.3
206
206
  type: :development
207
207
  version_requirements: *id012
208
+ - !ruby/object:Gem::Dependency
209
+ name: capistrano
210
+ prerelease: false
211
+ requirement: &id013 !ruby/object:Gem::Requirement
212
+ none: false
213
+ requirements:
214
+ - - ~>
215
+ - !ruby/object:Gem::Version
216
+ hash: 47
217
+ segments:
218
+ - 2
219
+ - 8
220
+ - 0
221
+ version: 2.8.0
222
+ type: :development
223
+ version_requirements: *id013
208
224
  description:
209
225
  email: support@airbrakeapp.com
210
226
  executables: []
@@ -280,6 +296,7 @@ files:
280
296
  - test/airbrake_2_2.xsd
281
297
  - test/airbrake_tasks_test.rb
282
298
  - test/backtrace_test.rb
299
+ - test/capistrano_test.rb
283
300
  - test/catcher_test.rb
284
301
  - test/configuration_test.rb
285
302
  - test/helper.rb
@@ -348,6 +365,7 @@ test_files:
348
365
  - test/airbrake_2_2.xsd
349
366
  - test/airbrake_tasks_test.rb
350
367
  - test/backtrace_test.rb
368
+ - test/capistrano_test.rb
351
369
  - test/catcher_test.rb
352
370
  - test/configuration_test.rb
353
371
  - test/helper.rb