honeybadger 1.4.0 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
data/Appraisals CHANGED
@@ -15,6 +15,6 @@ appraise 'rails3.1' do
15
15
  end
16
16
 
17
17
  appraise 'rails3.2' do
18
- gem 'rails', '3.2.9'
18
+ gem 'rails', '3.2.11'
19
19
  gem 'honeybadger', :path => '../'
20
20
  end
data/Gemfile.lock CHANGED
@@ -1,14 +1,14 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- honeybadger (1.4.0)
4
+ honeybadger (1.5.0)
5
5
  activesupport
6
6
  json
7
7
 
8
8
  GEM
9
9
  remote: http://rubygems.org/
10
10
  specs:
11
- activesupport (3.2.9)
11
+ activesupport (3.2.11)
12
12
  i18n (~> 0.6)
13
13
  multi_json (~> 1.0)
14
14
  appraisal (0.5.1)
@@ -54,7 +54,7 @@ GEM
54
54
  net-ssh-gateway (1.1.0)
55
55
  net-ssh (>= 1.99.1)
56
56
  rack (1.1.3)
57
- rake (10.0.2)
57
+ rake (10.0.3)
58
58
  rspec (2.12.0)
59
59
  rspec-core (~> 2.12.0)
60
60
  rspec-expectations (~> 2.12.0)
data/README.md CHANGED
@@ -3,7 +3,7 @@ Honeybadger
3
3
 
4
4
  [![Build Status](https://secure.travis-ci.org/honeybadger-io/honeybadger-ruby.png?branch=master)](http://travis-ci.org/honeybadger-io/honeybadger-ruby)
5
5
 
6
- This is the notifier gem for integrating apps with :zap: [Honeybadger](http://honeybadger.io).
6
+ This is the notifier gem for integrating apps with the :zap: [Honeybadger Rails Error Notifier](http://honeybadger.io).
7
7
 
8
8
  When an uncaught exception occurs, Honeybadger will POST the relevant data
9
9
  to the Honeybadger server specified in your environment.
@@ -132,8 +132,8 @@ Here's an example of sending some user-specific information in a Rails
132
132
 
133
133
  before_filter do
134
134
  Honeybadger.context({
135
- user_id: current_user.id,
136
- user_email: current_user.email
135
+ :user_id => current_user.id,
136
+ :user_email => current_user.email
137
137
  }) if current_user
138
138
  end
139
139
 
@@ -186,7 +186,7 @@ examples of notifying Honeybadger asynchronously:
186
186
 
187
187
  Honeybadger.configure do |config|
188
188
  config.async do |notice|
189
- Resque.enqueue(WorkingBadger, notice)
189
+ Resque.enqueue(WorkingBadger, notice.to_json)
190
190
  end
191
191
  end
192
192
 
@@ -202,7 +202,7 @@ examples of notifying Honeybadger asynchronously:
202
202
 
203
203
  Honeybadger.configure do |config|
204
204
  config.async do |notice|
205
- WorkingBadger.perform_async(notice)
205
+ WorkingBadger.perform_async(notice.to_json)
206
206
  end
207
207
  end
208
208
 
@@ -140,32 +140,19 @@ When /^I configure the Heroku gem shim with "([^\"]*)"( and multiple app support
140
140
  heroku_script_bin = File.join(TEMP_DIR, "bin")
141
141
  FileUtils.mkdir_p(heroku_script_bin)
142
142
  heroku_script = File.join(heroku_script_bin, "heroku")
143
- heroku_env_vars = <<-VARS
144
- HONEYBADGER_API_KEY => myapikey
145
- APP_NAME => cold-moon-2929
146
- BUNDLE_WITHOUT => development:test
147
- COMMIT_HASH => lj32j42ss9332jfa2
148
- DATABASE_URL => postgres://fchovwjcyb:QLPVWmBBbf4hCG_YMrtV@ec3-107-28-193-23.compute-1.amazonaws.com/fhcvojwwcyb
149
- LANG => en_US.UTF-8
150
- LAST_GIT_BY => kensa
151
- RACK_ENV => production
152
- SHARED_DATABASE_URL => postgres://fchovwjcyb:QLPVwMbbbF8Hcg_yMrtV@ec2-94-29-181-224.compute-1.amazonaws.com/fhcvojcwwyb
153
- STACK => bamboo-mri-1.9.2
154
- URL => cold-moon-2929.heroku.com
155
- VARS
156
143
  single_app_script = <<-SINGLE
157
144
  #!/bin/bash
158
- if [ $1 == 'config' ]
145
+ if [[ $1 == 'config:get' && $2 == 'HONEYBADGER_API_KEY' ]]
159
146
  then
160
- echo "#{heroku_env_vars}"
147
+ echo "#{api_key}"
161
148
  fi
162
149
  SINGLE
163
150
 
164
151
  multi_app_script = <<-MULTI
165
152
  #!/bin/bash
166
- if [[ $1 == 'config' && $2 == '--app' ]]
153
+ if [[ $1 == 'config:get' && $2 == 'HONEYBADGER_API_KEY' && $3 == '--app' ]]
167
154
  then
168
- echo "#{heroku_env_vars}"
155
+ echo "#{api_key}"
169
156
  fi
170
157
  MULTI
171
158
 
@@ -82,6 +82,7 @@ module RailsHelpers
82
82
 
83
83
 
84
84
  response = response.last if response.last.is_a?(ActionDispatch::Response)
85
+ response = response.last.to_a if defined?(Rack::BodyProxy) && response.last.is_a?(Rack::BodyProxy)
85
86
 
86
87
  if response.is_a?(Array)
87
88
  puts response.join
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: /Users/josh/code/honeybadger-ruby
3
3
  specs:
4
- honeybadger (1.3.1)
4
+ honeybadger (1.5.0)
5
5
  activesupport
6
6
  json
7
7
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: /Users/josh/code/honeybadger-ruby
3
3
  specs:
4
- honeybadger (1.3.1)
4
+ honeybadger (1.4.0)
5
5
  activesupport
6
6
  json
7
7
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: /Users/josh/code/honeybadger-ruby
3
3
  specs:
4
- honeybadger (1.3.1)
4
+ honeybadger (1.4.0)
5
5
  activesupport
6
6
  json
7
7
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  source :rubygems
4
4
 
5
- gem "rails", "3.2.9"
5
+ gem "rails", "3.2.11"
6
6
  gem "honeybadger", :path=>"../"
7
7
 
8
8
  gemspec :path=>"../"
@@ -1,19 +1,19 @@
1
1
  PATH
2
2
  remote: /Users/josh/code/honeybadger-ruby
3
3
  specs:
4
- honeybadger (1.3.1)
4
+ honeybadger (1.4.0)
5
5
  activesupport
6
6
  json
7
7
 
8
8
  GEM
9
9
  remote: http://rubygems.org/
10
10
  specs:
11
- actionmailer (3.2.9)
12
- actionpack (= 3.2.9)
11
+ actionmailer (3.2.11)
12
+ actionpack (= 3.2.11)
13
13
  mail (~> 2.4.4)
14
- actionpack (3.2.9)
15
- activemodel (= 3.2.9)
16
- activesupport (= 3.2.9)
14
+ actionpack (3.2.11)
15
+ activemodel (= 3.2.11)
16
+ activesupport (= 3.2.11)
17
17
  builder (~> 3.0.0)
18
18
  erubis (~> 2.7.0)
19
19
  journey (~> 1.0.4)
@@ -21,18 +21,18 @@ GEM
21
21
  rack-cache (~> 1.2)
22
22
  rack-test (~> 0.6.1)
23
23
  sprockets (~> 2.2.1)
24
- activemodel (3.2.9)
25
- activesupport (= 3.2.9)
24
+ activemodel (3.2.11)
25
+ activesupport (= 3.2.11)
26
26
  builder (~> 3.0.0)
27
- activerecord (3.2.9)
28
- activemodel (= 3.2.9)
29
- activesupport (= 3.2.9)
27
+ activerecord (3.2.11)
28
+ activemodel (= 3.2.11)
29
+ activesupport (= 3.2.11)
30
30
  arel (~> 3.0.2)
31
31
  tzinfo (~> 0.3.29)
32
- activeresource (3.2.9)
33
- activemodel (= 3.2.9)
34
- activesupport (= 3.2.9)
35
- activesupport (3.2.9)
32
+ activeresource (3.2.11)
33
+ activemodel (= 3.2.11)
34
+ activesupport (= 3.2.11)
35
+ activesupport (3.2.11)
36
36
  i18n (~> 0.6)
37
37
  multi_json (~> 1.0)
38
38
  appraisal (0.5.1)
@@ -43,10 +43,10 @@ GEM
43
43
  childprocess (~> 0.3.6)
44
44
  cucumber (>= 1.1.1)
45
45
  rspec-expectations (>= 2.7.0)
46
- bourne (1.1.2)
47
- mocha (= 0.10.5)
46
+ bourne (1.3.0)
47
+ mocha (= 0.13.0)
48
48
  builder (3.0.4)
49
- capistrano (2.13.5)
49
+ capistrano (2.14.1)
50
50
  highline
51
51
  net-scp (>= 1.0.0)
52
52
  net-sftp (>= 2.0.0)
@@ -62,66 +62,66 @@ GEM
62
62
  diff-lcs (1.1.3)
63
63
  erubis (2.7.0)
64
64
  fakeweb (1.3.0)
65
- ffi (1.2.0)
65
+ ffi (1.3.1)
66
66
  gherkin (2.11.5)
67
67
  json (>= 1.4.6)
68
68
  highline (1.6.15)
69
69
  hike (1.2.1)
70
70
  i18n (0.6.1)
71
71
  journey (1.0.4)
72
- json (1.7.5)
72
+ json (1.7.6)
73
73
  mail (2.4.4)
74
74
  i18n (>= 0.4.0)
75
75
  mime-types (~> 1.16)
76
76
  treetop (~> 1.4.8)
77
77
  metaclass (0.0.1)
78
78
  mime-types (1.19)
79
- mocha (0.10.5)
79
+ mocha (0.13.0)
80
80
  metaclass (~> 0.0.1)
81
- multi_json (1.3.7)
81
+ multi_json (1.5.0)
82
82
  net-scp (1.0.4)
83
83
  net-ssh (>= 1.99.1)
84
84
  net-sftp (2.0.5)
85
85
  net-ssh (>= 2.0.9)
86
- net-ssh (2.6.2)
86
+ net-ssh (2.6.3)
87
87
  net-ssh-gateway (1.1.0)
88
88
  net-ssh (>= 1.99.1)
89
89
  polyglot (0.3.3)
90
- rack (1.4.1)
90
+ rack (1.4.4)
91
91
  rack-cache (1.2)
92
92
  rack (>= 0.4)
93
- rack-protection (1.2.0)
93
+ rack-protection (1.3.2)
94
94
  rack
95
95
  rack-ssl (1.3.2)
96
96
  rack
97
97
  rack-test (0.6.2)
98
98
  rack (>= 1.0)
99
- rails (3.2.9)
100
- actionmailer (= 3.2.9)
101
- actionpack (= 3.2.9)
102
- activerecord (= 3.2.9)
103
- activeresource (= 3.2.9)
104
- activesupport (= 3.2.9)
99
+ rails (3.2.11)
100
+ actionmailer (= 3.2.11)
101
+ actionpack (= 3.2.11)
102
+ activerecord (= 3.2.11)
103
+ activeresource (= 3.2.11)
104
+ activesupport (= 3.2.11)
105
105
  bundler (~> 1.0)
106
- railties (= 3.2.9)
107
- railties (3.2.9)
108
- actionpack (= 3.2.9)
109
- activesupport (= 3.2.9)
106
+ railties (= 3.2.11)
107
+ railties (3.2.11)
108
+ actionpack (= 3.2.11)
109
+ activesupport (= 3.2.11)
110
110
  rack-ssl (~> 1.3.2)
111
111
  rake (>= 0.8.7)
112
112
  rdoc (~> 3.4)
113
113
  thor (>= 0.14.6, < 2.0)
114
- rake (10.0.2)
114
+ rake (10.0.3)
115
115
  rdoc (3.12)
116
116
  json (~> 1.4)
117
117
  rspec (2.12.0)
118
118
  rspec-core (~> 2.12.0)
119
119
  rspec-expectations (~> 2.12.0)
120
120
  rspec-mocks (~> 2.12.0)
121
- rspec-core (2.12.0)
122
- rspec-expectations (2.12.0)
121
+ rspec-core (2.12.2)
122
+ rspec-expectations (2.12.1)
123
123
  diff-lcs (~> 1.1.3)
124
- rspec-mocks (2.12.0)
124
+ rspec-mocks (2.12.1)
125
125
  sham_rack (1.3.4)
126
126
  rack
127
127
  shoulda (2.11.3)
@@ -152,7 +152,7 @@ DEPENDENCIES
152
152
  cucumber (~> 1.2.1)
153
153
  fakeweb (~> 1.3.0)
154
154
  honeybadger!
155
- rails (= 3.2.9)
155
+ rails (= 3.2.11)
156
156
  rake
157
157
  rspec (~> 2.12.0)
158
158
  sham_rack (~> 1.3.0)
@@ -53,6 +53,7 @@ class HoneybadgerGenerator < Rails::Generator::Base
53
53
  puts "... Failed."
54
54
  puts "WARNING: We were unable to detect the Honeybadger API Key from your Heroku environment."
55
55
  puts "Your Heroku application environment may not be configured correctly."
56
+ puts "Have you configured multiple Heroku apps? Try using the '--app [app name]' flag." unless options[:app]
56
57
  exit 1
57
58
  else
58
59
  puts "... Done."
@@ -60,13 +61,13 @@ class HoneybadgerGenerator < Rails::Generator::Base
60
61
  end
61
62
  end
62
63
 
63
- def heroku_var(var,app_name = nil)
64
+ def heroku_var(var, app_name = nil)
64
65
  app = app_name ? "--app #{app_name}" : ''
65
- `heroku config #{app} | grep -E "#{var.upcase}" | awk '{ print $3; }'`.strip
66
+ `heroku config:get #{var} #{app}`
66
67
  end
67
68
 
68
69
  def heroku_api_key
69
- heroku_var("(honeybadger)_api_key",options[:app]).split.find {|x| x unless x.blank?}
70
+ heroku_var("HONEYBADGER_API_KEY",options[:app]).split.find {|x| x unless x.blank?}
70
71
  end
71
72
 
72
73
  def heroku?
@@ -1,7 +1,7 @@
1
1
  # Don't load anything when running the gems:* tasks.
2
2
  # Otherwise, honeybadger will be considered a framework gem.
3
3
  # https://thoughtbot.lighthouseapp.com/projects/14221/tickets/629
4
- unless ARGV.any? {|a| a =~ /^gems/}
4
+ unless ARGV.any? {|a| a =~ /^gems/}
5
5
 
6
6
  Dir[File.join(Rails.root, 'vendor', 'gems', 'honeybadger-*')].each do |vendored_notifier|
7
7
  $: << File.join(vendored_notifier, 'lib')
data/honeybadger.gemspec CHANGED
@@ -4,8 +4,8 @@ Gem::Specification.new do |s|
4
4
  s.rubygems_version = '1.3.5'
5
5
 
6
6
  s.name = 'honeybadger'
7
- s.version = '1.4.0'
8
- s.date = '2012-12-14'
7
+ s.version = '1.5.0'
8
+ s.date = '2013-01-16'
9
9
 
10
10
  s.summary = 'Error reports you can be happy about.'
11
11
  s.description = 'Make managing application errors a more pleasant experience.'
data/lib/honeybadger.rb CHANGED
@@ -19,7 +19,7 @@ require 'honeybadger/sender'
19
19
  require 'honeybadger/railtie' if defined?(Rails::Railtie)
20
20
 
21
21
  module Honeybadger
22
- VERSION = '1.4.0'
22
+ VERSION = '1.5.0'
23
23
  LOG_PREFIX = "** [Honeybadger] "
24
24
 
25
25
  HEADERS = {
@@ -118,7 +118,7 @@ module Honeybadger
118
118
  #
119
119
  # Returns a reference to the error in Honeybadger
120
120
  def deliver
121
- Honeybadger.sender.send_to_honeybadger(to_json)
121
+ Honeybadger.sender.send_to_honeybadger(self)
122
122
  end
123
123
 
124
124
  # Public: Template used to create JSON payload
@@ -30,10 +30,12 @@ module Honeybadger
30
30
 
31
31
  # Public: Sends the notice data off to Honeybadger for processing.
32
32
  #
33
- # data - The JSON notice to be sent off
33
+ # notice - The notice data to be sent (Hash or JSON string)
34
34
  #
35
35
  # Returns nothing
36
- def send_to_honeybadger(data)
36
+ def send_to_honeybadger(notice)
37
+ data = notice.is_a?(String) ? notice : notice.to_json
38
+
37
39
  http = setup_http_connection
38
40
  headers = HEADERS
39
41
 
@@ -29,16 +29,23 @@ namespace :honeybadger do
29
29
  namespace :heroku do
30
30
  desc "Install Heroku deploy notifications addon"
31
31
  task :add_deploy_notification => [:environment] do
32
-
33
- def heroku_var(var)
34
- `heroku config | grep -E "#{var.upcase}" | awk '{ print $3; }'`.strip
32
+ def heroku_var(var, app_name = nil)
33
+ app = app_name ? "--app #{app_name}" : ''
34
+ `heroku config:get #{var} #{app} 2> /dev/null`.strip
35
35
  end
36
36
 
37
- heroku_rails_env = heroku_var("rails_env")
38
- heroku_api_key = heroku_var("honeybadger_api_key").split.find {|x| x unless x.blank?} ||
37
+ heroku_rails_env = heroku_var('RAILS_ENV', ENV['APP'])
38
+ heroku_api_key = heroku_var('HONEYBADGER_API_KEY', ENV['APP']).split.find {|x| x unless x.blank?} ||
39
39
  Honeybadger.configuration.api_key
40
40
 
41
- command = %Q(heroku addons:add deployhooks:http --url="https://api.honeybadger.io/v1/deploys?deploy[environment]=#{heroku_rails_env}&api_key=#{heroku_api_key}")
41
+ if heroku_api_key.blank? || heroku_rails_env.blank?
42
+ puts "WARNING: We were unable to detect the configuration from your Heroku environment."
43
+ puts "Your Heroku application environment may not be configured correctly."
44
+ puts "Have you configured multiple Heroku apps? Try using APP=[app name]'" unless ENV['APP']
45
+ exit
46
+ end
47
+
48
+ command = %Q(heroku addons:add deployhooks:http --url="https://api.honeybadger.io/v1/deploys?deploy[environment]=#{heroku_rails_env}&api_key=#{heroku_api_key}"#{ENV['APP'] ? " --app #{ENV['APP']}" : ''})
42
49
 
43
50
  puts "\nRunning:\n#{command}\n"
44
51
  puts `#{command}`
@@ -63,6 +63,7 @@ class HoneybadgerGenerator < Rails::Generators::Base
63
63
  puts "... Failed."
64
64
  puts "WARNING: We were unable to detect the Honeybadger API Key from your Heroku environment."
65
65
  puts "Your Heroku application environment may not be configured correctly."
66
+ puts "Have you configured multiple Heroku apps? Try using the '--app [app name]' flag." unless options[:app]
66
67
  exit 1
67
68
  else
68
69
  puts "... Done."
@@ -70,13 +71,13 @@ class HoneybadgerGenerator < Rails::Generators::Base
70
71
  end
71
72
  end
72
73
 
73
- def heroku_var(var,app_name = nil)
74
+ def heroku_var(var, app_name = nil)
74
75
  app = app_name ? "--app #{app_name}" : ''
75
- `heroku config #{app} | grep -E "#{var.upcase}" | awk '{ print $3; }'`.strip
76
+ `heroku config:get #{var} #{app}`
76
77
  end
77
78
 
78
79
  def heroku_api_key
79
- heroku_var("honeybadger_api_key",options[:app]).split.find {|x| x unless x.blank?}
80
+ heroku_var("HONEYBADGER_API_KEY", options[:app]).split.find {|x| x unless x.blank?}
80
81
  end
81
82
 
82
83
  def heroku?
data/test/test_helper.rb CHANGED
@@ -46,7 +46,8 @@ class CollectingSender
46
46
  @collected = []
47
47
  end
48
48
 
49
- def send_to_honeybadger(data)
49
+ def send_to_honeybadger(notice)
50
+ data = notice.respond_to?(:to_json) ? notice.to_json : notice
50
51
  @collected << data
51
52
  end
52
53
  end
@@ -29,7 +29,7 @@ class NoticeTest < Test::Unit::TestCase
29
29
 
30
30
  notice.deliver
31
31
 
32
- assert_received(sender, :send_to_honeybadger) { |expect| expect.with(notice.to_json) }
32
+ assert_received(sender, :send_to_honeybadger) { |expect| expect.with(notice) }
33
33
  end
34
34
 
35
35
  should "generate json from as_json template" do
@@ -14,7 +14,7 @@ class NotifierTest < Test::Unit::TestCase
14
14
 
15
15
  def assert_sent(notice, notice_args)
16
16
  assert_received(Honeybadger::Notice, :new) {|expect| expect.with(has_entries(notice_args)) }
17
- assert_received(Honeybadger.sender, :send_to_honeybadger) {|expect| expect.with(notice.to_json) }
17
+ assert_received(Honeybadger.sender, :send_to_honeybadger) {|expect| expect.with(notice) }
18
18
  end
19
19
 
20
20
  def set_public_env
@@ -82,7 +82,7 @@ class ActionControllerCatcherTest < Test::Unit::TestCase
82
82
  end
83
83
 
84
84
  def last_sent_notice_payload
85
- assert_not_nil xml = last_sent_notice_json, "No json was sent"
85
+ assert_not_nil last_sent_notice_json, "No json was sent"
86
86
  JSON.parse(last_sent_notice_json)
87
87
  end
88
88
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: honeybadger
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.5.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-14 00:00:00.000000000 Z
12
+ date: 2013-01-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json
@@ -312,7 +312,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
312
312
  version: '0'
313
313
  segments:
314
314
  - 0
315
- hash: 2390415498026321705
315
+ hash: -995086869038998837
316
316
  required_rubygems_version: !ruby/object:Gem::Requirement
317
317
  none: false
318
318
  requirements: