honeybadger 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -2,9 +2,10 @@ source "https://rubygems.org"
2
2
 
3
3
  gemspec
4
4
 
5
+ gem 'rake'
6
+
5
7
  if true
6
8
  group :test do
7
- gem 'turn'
8
9
  gem 'pry'
9
10
  gem 'guard'
10
11
  gem 'guard-test'
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- honeybadger (0.0.1)
4
+ honeybadger (1.1.0)
5
5
  activesupport
6
6
  json
7
7
 
@@ -14,7 +14,6 @@ GEM
14
14
  activerecord (2.3.14)
15
15
  activesupport (= 2.3.14)
16
16
  activesupport (2.3.14)
17
- ansi (1.4.2)
18
17
  bourne (1.1.2)
19
18
  mocha (= 0.10.5)
20
19
  builder (3.0.0)
@@ -65,6 +64,7 @@ GEM
65
64
  method_source (~> 0.7.1)
66
65
  slop (>= 2.4.4, < 3)
67
66
  rack (1.1.3)
67
+ rake (0.9.2.2)
68
68
  rb-fchange (0.0.5)
69
69
  ffi
70
70
  rb-fsevent (0.9.1)
@@ -89,8 +89,6 @@ GEM
89
89
  term-ansicolor (1.0.7)
90
90
  test-unit (2.5.0)
91
91
  thor (0.15.3)
92
- turn (0.9.5)
93
- ansi
94
92
 
95
93
  PLATFORMS
96
94
  ruby
@@ -107,8 +105,8 @@ DEPENDENCIES
107
105
  guard-test
108
106
  honeybadger!
109
107
  pry
108
+ rake
110
109
  rspec (~> 2.6.0)
111
110
  sham_rack (~> 1.3.0)
112
111
  shoulda (~> 2.11.3)
113
112
  simplecov
114
- turn
data/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  Honeybadger
2
2
  ===============
3
3
 
4
+ [![Build Status](https://secure.travis-ci.org/honeybadger-io/honeybadger-ruby.png?branch=master)](http://travis-ci.org/honeybadger-io/honeybadger-ruby)
5
+
4
6
  This is the notifier gem for integrating apps with [Honeybadger](http://honeybadger.io).
5
7
 
6
8
  When an uncaught exception occurs, Honeybadger will POST the relevant data
@@ -256,7 +258,7 @@ added the following information to your Honeybadger configuration block.
256
258
 
257
259
  ## Supported Rails versions
258
260
 
259
- Honeybadger supports Rails 2.3.14 through rails 3.2.6.
261
+ Honeybadger supports Rails 3.0.0 through rails 3.2.6.
260
262
 
261
263
  ## Credits
262
264
 
data/Rakefile CHANGED
@@ -86,7 +86,7 @@ end
86
86
  FEATURES = ['sinatra', 'rack', 'metal']
87
87
 
88
88
  desc 'Default: run unit & acceptance tests.'
89
- task :default => [:test, "cucumber:rails:all"] + FEATURES
89
+ task :default => [:test, :vendor_test_gems , "cucumber:rails:all"] + FEATURES
90
90
 
91
91
  GEM_ROOT = File.dirname(__FILE__).freeze
92
92
 
@@ -94,15 +94,16 @@ LOCAL_GEM_ROOT = File.join(GEM_ROOT, 'tmp', 'local_gems').freeze
94
94
  RAILS_VERSIONS = IO.read('SUPPORTED_RAILS_VERSIONS').strip.split("\n")
95
95
  LOCAL_GEMS =
96
96
  [
97
- ["rack","1.3.2"],
97
+ ['rake', nil],
98
+ ['rack','1.3.2']
98
99
  ] +
99
100
  RAILS_VERSIONS.collect { |version| ['rails', version] } +
100
101
  [
101
102
  ['sham_rack', nil],
102
103
  ['capistrano', nil],
103
104
  ['sqlite3-ruby', nil],
104
- ["therubyracer",nil],
105
- ["sinatra",nil]
105
+ ['therubyracer',nil],
106
+ ['sinatra',nil]
106
107
  ]
107
108
 
108
109
  desc "Vendor test gems: Run this once to prepare your test environment"
@@ -1,4 +1,3 @@
1
- 2.3.14
2
1
  3.0.0
3
2
  3.0.1
4
3
  3.0.2
@@ -1,6 +1,6 @@
1
1
  require 'sham_rack'
2
2
 
3
- ShamRack.at("api.honeybadger.io") do |env|
3
+ ShamRack.at("api.honeybadger.io", 443) do |env|
4
4
  response = <<-end_json
5
5
  {"id":"123456789"}
6
6
  end_json
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.0.0'
8
- s.date = '2012-06-27'
7
+ s.version = '1.1.0'
8
+ s.date = '2012-07-26'
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 = '0.0.1'
22
+ VERSION = '1.1.0'
23
23
  LOG_PREFIX = "** [Honeybadger] "
24
24
 
25
25
  HEADERS = {
@@ -121,23 +121,23 @@ module Honeybadger
121
121
  alias_method :use_system_ssl_cert_chain?, :use_system_ssl_cert_chain
122
122
 
123
123
  def initialize
124
- @secure = false
125
- @use_system_ssl_cert_chain= false
126
- @host = 'api.honeybadger.io'
127
- @http_open_timeout = 2
128
- @http_read_timeout = 5
129
- @params_filters = DEFAULT_PARAMS_FILTERS.dup
130
- @backtrace_filters = DEFAULT_BACKTRACE_FILTERS.dup
131
- @ignore_by_filters = []
132
- @ignore = IGNORE_DEFAULT.dup
133
- @ignore_user_agent = []
134
- @development_environments = %w(development test cucumber)
135
- @notifier_name = 'Honeybadger Notifier'
136
- @notifier_version = VERSION
137
- @notifier_url = 'https://github.com/honeybadger/honeybadger'
138
- @framework = 'Standalone'
139
- @user_information = 'Honeybadger Error {{error_id}}'
140
- @rescue_rake_exceptions = nil
124
+ @secure = true
125
+ @use_system_ssl_cert_chain = false
126
+ @host = 'api.honeybadger.io'
127
+ @http_open_timeout = 2
128
+ @http_read_timeout = 5
129
+ @params_filters = DEFAULT_PARAMS_FILTERS.dup
130
+ @backtrace_filters = DEFAULT_BACKTRACE_FILTERS.dup
131
+ @ignore_by_filters = []
132
+ @ignore = IGNORE_DEFAULT.dup
133
+ @ignore_user_agent = []
134
+ @development_environments = %w(development test cucumber)
135
+ @notifier_name = 'Honeybadger Notifier'
136
+ @notifier_version = VERSION
137
+ @notifier_url = 'https://github.com/honeybadger/honeybadger'
138
+ @framework = 'Standalone'
139
+ @user_information = 'Honeybadger Error {{error_id}}'
140
+ @rescue_rake_exceptions = nil
141
141
  end
142
142
 
143
143
  # Public: Takes a block and adds it to the list of backtrace filters. When
@@ -2,12 +2,12 @@ namespace :honeybadger do
2
2
  desc "Notify Honeybadger of a new deploy."
3
3
  task :deploy => :environment do
4
4
  require 'honeybadger_tasks'
5
- HoneybadgerTasks.deploy(:rails_env => ENV['TO'],
6
- :scm_revision => ENV['REVISION'],
7
- :scm_repository => ENV['REPO'],
8
- :local_username => ENV['USER'],
9
- :api_key => ENV['API_KEY'],
10
- :dry_run => ENV['DRY_RUN'])
5
+ HoneybadgerTasks.deploy(:environment => ENV['TO'],
6
+ :revision => ENV['REVISION'],
7
+ :repository => ENV['REPO'],
8
+ :local_username => ENV['USER'],
9
+ :api_key => ENV['API_KEY'],
10
+ :dry_run => ENV['DRY_RUN'])
11
11
  end
12
12
 
13
13
  task :log_stdout do
@@ -24,10 +24,10 @@ namespace :honeybadger do
24
24
  end
25
25
 
26
26
  heroku_rails_env = heroku_var("rails_env")
27
- heroku_api_key = heroku_var("(hoptoad|honeybadger)_api_key").split.find {|x| x unless x.blank?} ||
27
+ heroku_api_key = heroku_var("(honeybadger)_api_key").split.find {|x| x unless x.blank?} ||
28
28
  Honeybadger.configuration.api_key
29
29
 
30
- command = %Q(heroku addons:add deployhooks:http --url="http://honeybadger.io/deploys.txt?deploy[rails_env]=#{heroku_rails_env}&api_key=#{heroku_api_key}")
30
+ command = %Q(heroku addons:add deployhooks:http --url="https://api.honeybadger.io/v1/deploys?deploy[environment]=#{heroku_rails_env}&api_key=#{heroku_api_key}")
31
31
 
32
32
  puts "\nRunning:\n#{command}\n"
33
33
  puts `#{command}`
@@ -9,9 +9,9 @@ module HoneybadgerTasks
9
9
  #
10
10
  # opts - Data about the deploy that is set to Honeybadger
11
11
  # :api_key - Api key of you Honeybadger application
12
- # :rails_env - Environment of the deploy (production, staging)
13
- # :scm_revision - The given revision/sha that is being deployed
14
- # :scm_repository - Address of your repository to help with code lookups
12
+ # :environment - Environment of the deploy (production, staging)
13
+ # :revision - The given revision/sha that is being deployed
14
+ # :repository - Address of your repository to help with code lookups
15
15
  # :local_username - Who is deploying
16
16
  #
17
17
  # Returns true or false
@@ -22,8 +22,8 @@ module HoneybadgerTasks
22
22
  return false
23
23
  end
24
24
 
25
- if opts[:rails_env].blank?
26
- puts "I don't know to which Rails environment you are deploying (use the TO=production option)."
25
+ if opts[:environment].blank?
26
+ puts "I don't know to which environment you are deploying (use the TO=production option)."
27
27
  return false
28
28
  end
29
29
 
@@ -47,7 +47,7 @@ module HoneybadgerTasks
47
47
  http.verify_mode = OpenSSL::SSL::VERIFY_PEER
48
48
  end
49
49
 
50
- post = Net::HTTP::Post.new("/deploys.txt")
50
+ post = Net::HTTP::Post.new("/v1/deploys")
51
51
  post.set_form_data(params)
52
52
  post['X-API-Key'] = api_key
53
53
 
@@ -14,7 +14,7 @@ class ConfigurationTest < Honeybadger::UnitTest
14
14
  assert_config_default :notifier_version, Honeybadger::VERSION
15
15
  assert_config_default :notifier_name, 'Honeybadger Notifier'
16
16
  assert_config_default :notifier_url, 'https://github.com/honeybadger/honeybadger'
17
- assert_config_default :secure, false
17
+ assert_config_default :secure, true
18
18
  assert_config_default :host, 'api.honeybadger.io'
19
19
  assert_config_default :http_open_timeout, 2
20
20
  assert_config_default :http_read_timeout, 5
@@ -29,7 +29,7 @@ class HoneybadgerTasksTest < Honeybadger::UnitTest
29
29
  setup { @output = HoneybadgerTasks.deploy({}) }
30
30
 
31
31
  before_should "complain about missing rails env" do
32
- HoneybadgerTasks.expects(:puts).with(regexp_matches(/rails environment/i))
32
+ HoneybadgerTasks.expects(:puts).with(regexp_matches(/which environment/i))
33
33
  end
34
34
 
35
35
  should "return false" do
@@ -40,7 +40,10 @@ class HoneybadgerTasksTest < Honeybadger::UnitTest
40
40
  context "given an optional HTTP proxy and valid options" do
41
41
  setup do
42
42
  @response = stub("response", :body => "stub body")
43
- @http_proxy = stub("proxy", :request => @response)
43
+ @http_proxy = stub("proxy", :request => @response,
44
+ :use_ssl= => nil,
45
+ :ca_file= => nil,
46
+ :verify_mode= => nil)
44
47
  @http_proxy_class = stub("proxy_class", :new => @http_proxy)
45
48
  @post = stub("post", :set_form_data => nil)
46
49
 
@@ -52,9 +55,9 @@ class HoneybadgerTasksTest < Honeybadger::UnitTest
52
55
  Honeybadger.configuration.proxy_user,
53
56
  Honeybadger.configuration.proxy_pass).
54
57
  returns(@http_proxy_class)
55
- Net::HTTP::Post.expects(:new).with("/deploys.txt").returns(@post)
58
+ Net::HTTP::Post.expects(:new).with("/v1/deploys").returns(@post)
56
59
 
57
- @options = { :rails_env => "staging", :dry_run => false }
60
+ @options = { :environment => "staging", :dry_run => false }
58
61
  end
59
62
 
60
63
  context "performing a dry run" do
@@ -73,18 +76,18 @@ class HoneybadgerTasksTest < Honeybadger::UnitTest
73
76
  @output = HoneybadgerTasks.deploy(@options)
74
77
  end
75
78
 
76
- before_should "post to http://api.honeybadger.io:80/deploys.txt" do
77
- @http_proxy_class.expects(:new).with("api.honeybadger.io", 80).returns(@http_proxy)
79
+ before_should "post to https://api.honeybadger.io:443/v1/deploys" do
80
+ @http_proxy_class.expects(:new).with("api.honeybadger.io", 443).returns(@http_proxy)
78
81
  @post.expects(:set_form_data).with(kind_of(Hash))
79
82
  @http_proxy.expects(:request).with(any_parameters).returns(successful_response)
80
83
  end
81
84
 
82
- before_should "use send the rails_env param" do
85
+ before_should "use send the environment param" do
83
86
  @post.expects(:set_form_data).
84
- with(has_entries("deploy[rails_env]" => "staging"))
87
+ with(has_entries("deploy[environment]" => "staging"))
85
88
  end
86
89
 
87
- [:local_username, :scm_repository, :scm_revision].each do |key|
90
+ [:local_username, :repository, :revision].each do |key|
88
91
  before_should "use send the #{key} param if it's passed in." do
89
92
  @options[key] = "value"
90
93
  @post.expects(:set_form_data).
@@ -122,11 +125,12 @@ class HoneybadgerTasksTest < Honeybadger::UnitTest
122
125
  Honeybadger.configure do |config|
123
126
  config.api_key = "1234123412341234"
124
127
  config.host = "custom.host"
128
+ config.secure = false
125
129
  end
126
130
  end
127
131
 
128
- context "on deploy(:rails_env => 'staging')" do
129
- setup { @output = HoneybadgerTasks.deploy(:rails_env => "staging") }
132
+ context "on deploy(:environment => 'staging')" do
133
+ setup { @output = HoneybadgerTasks.deploy(:environment => "staging") }
130
134
 
131
135
  before_should "post to the custom host" do
132
136
  @post = stub("post", :set_form_data => nil)
@@ -137,7 +141,7 @@ class HoneybadgerTasksTest < Honeybadger::UnitTest
137
141
  @http_proxy_class = stub("proxy_class", :new => @http_proxy)
138
142
  @http_proxy_class.expects(:new).with("custom.host", 80).returns(@http_proxy)
139
143
  Net::HTTP.expects(:Proxy).with(any_parameters).returns(@http_proxy_class)
140
- Net::HTTP::Post.expects(:new).with("/deploys.txt").returns(@post)
144
+ Net::HTTP::Post.expects(:new).with("/v1/deploys").returns(@post)
141
145
  @post.expects(:set_form_data).with(kind_of(Hash))
142
146
  @http_proxy.expects(:request).with(any_parameters).returns(successful_response)
143
147
  end
@@ -147,8 +151,8 @@ class HoneybadgerTasksTest < Honeybadger::UnitTest
147
151
  context "when not configured" do
148
152
  setup { Honeybadger.configure { |config| config.api_key = "" } }
149
153
 
150
- context "on deploy(:rails_env => 'staging')" do
151
- setup { @output = HoneybadgerTasks.deploy(:rails_env => "staging") }
154
+ context "on deploy(:environment => 'staging')" do
155
+ setup { @output = HoneybadgerTasks.deploy(:environment => "staging") }
152
156
 
153
157
  before_should "complain about missing api key" do
154
158
  HoneybadgerTasks.expects(:puts).with(regexp_matches(/api key/i))
@@ -6,7 +6,9 @@ class LoggerTest < Honeybadger::UnitTest
6
6
  @http = stub(:post => response,
7
7
  :read_timeout= => nil,
8
8
  :open_timeout= => nil,
9
- :use_ssl= => nil)
9
+ :use_ssl= => nil,
10
+ :ca_file= => nil,
11
+ :verify_mode= => nil)
10
12
  Net::HTTP.stubs(:new).returns(@http)
11
13
  end
12
14
 
@@ -188,7 +188,7 @@ class NotifierTest < Honeybadger::UnitTest
188
188
  assert_match /honeybadger\/rack_test\.rb$/, @hash[:file]
189
189
  end
190
190
 
191
- should "set rails_env to production" do
191
+ should "set environment_name to production" do
192
192
  assert_equal 'production', @hash[:environment_name]
193
193
  end
194
194
 
@@ -34,7 +34,9 @@ class SenderTest < Honeybadger::UnitTest
34
34
  http = stub(:post => response,
35
35
  :read_timeout= => nil,
36
36
  :open_timeout= => nil,
37
- :use_ssl= => nil)
37
+ :use_ssl= => nil,
38
+ :ca_file= => nil,
39
+ :verify_mode= => nil)
38
40
  proxy = stub(:new => http)
39
41
  Net::HTTP.stubs(:Proxy => proxy)
40
42
 
@@ -174,14 +176,19 @@ class SenderTest < Honeybadger::UnitTest
174
176
  end
175
177
 
176
178
  should "use the default DEFAULT_CERT_FILE if asked to" do
177
- config = Honeybadger::Configuration.new
178
- config.use_system_ssl_cert_chain = true
179
- sender = Honeybadger::Sender.new(config)
179
+ File.expects(:exist?).with(OpenSSL::X509::DEFAULT_CERT_FILE).returns(true)
180
+
181
+ Honeybadger.configure do |config|
182
+ config.secure = true
183
+ config.use_system_ssl_cert_chain = true
184
+ end
185
+
186
+ sender = Honeybadger::Sender.new(Honeybadger.configuration)
180
187
 
181
188
  assert(sender.use_system_ssl_cert_chain?)
182
189
 
183
190
  http = sender.send(:setup_http_connection)
184
- assert_not_equal http.ca_file, config.local_cert_path
191
+ assert_not_equal http.ca_file, Honeybadger.configuration.local_cert_path
185
192
  end
186
193
 
187
194
  should "verify the connection when the use_ssl option is set (VERIFY_PEER)" do
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.0.0
4
+ version: 1.1.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-06-27 00:00:00.000000000 Z
12
+ date: 2012-07-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json