honeybadger 3.0.0.beta4 → 3.0.0.beta5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +2 -0
- data/lib/honeybadger/backend/server.rb +0 -1
- data/lib/honeybadger/cli/main.rb +6 -1
- data/lib/honeybadger/config.rb +11 -42
- data/lib/honeybadger/config/defaults.rb +5 -0
- data/lib/honeybadger/notice.rb +1 -0
- data/lib/honeybadger/util/revision.rb +34 -0
- data/lib/honeybadger/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 024a03997f1e5a8f37ba751c32c6adb21e7cc3ea
|
4
|
+
data.tar.gz: f33bea69c33344b3bdc8c2d351cdf616063f7e1d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 398c8575b8c3098e82d8a607ca039579af21bed972f5332df0de82d358613b83af4c6a1a4966ef947558374bc3d66051d71bb923ea6b08d4144120e6f8235aae
|
7
|
+
data.tar.gz: 438d726976ec17fa2de5e41faac98cd366ced5ef61183b262816bbe09a999647c0a7ee1f10e337864929c66edd4ee80d2d644a433671bdc87c6b786b712c0416
|
data/CHANGELOG.md
CHANGED
@@ -28,6 +28,8 @@ adheres to [Semantic Versioning](http://semver.org/).
|
|
28
28
|
- `Honeybadger.notify` now converts arguments which are not `Exception` or
|
29
29
|
`Hash` types to strings and assigns them as the error message. Example:
|
30
30
|
`Honeybadger.notify("Something went wrong")`.
|
31
|
+
- The currently deployed git revision is now detected automatically and sent
|
32
|
+
with error reports.
|
31
33
|
|
32
34
|
### Changed
|
33
35
|
- `Honeybadger.start` has been deprecated and has no effect.
|
data/lib/honeybadger/cli/main.rb
CHANGED
@@ -109,10 +109,15 @@ WELCOME
|
|
109
109
|
project_options
|
110
110
|
option :quiet, required: false, type: :boolean, aliases: :'-q', default: false, desc: 'Suppress all output unless notification fails.'
|
111
111
|
def exec(*args)
|
112
|
+
if args.size == 0
|
113
|
+
say("honeybadger: exec needs a command to run", :red)
|
114
|
+
exit(1)
|
115
|
+
end
|
116
|
+
|
112
117
|
config = build_config(options)
|
113
118
|
|
114
119
|
if config.get(:api_key).to_s =~ BLANK
|
115
|
-
say("No value provided for required options '--api-key'")
|
120
|
+
say("No value provided for required options '--api-key'", :red)
|
116
121
|
exit(1)
|
117
122
|
end
|
118
123
|
|
data/lib/honeybadger/config.rb
CHANGED
@@ -9,9 +9,11 @@ require 'honeybadger/logging'
|
|
9
9
|
require 'honeybadger/backend'
|
10
10
|
require 'honeybadger/config/defaults'
|
11
11
|
require 'honeybadger/util/http'
|
12
|
+
require 'honeybadger/util/revision'
|
12
13
|
require 'honeybadger/logging'
|
13
14
|
|
14
15
|
module Honeybadger
|
16
|
+
# Internal
|
15
17
|
class Config
|
16
18
|
extend Forwardable
|
17
19
|
|
@@ -42,17 +44,18 @@ module Honeybadger
|
|
42
44
|
|
43
45
|
attr_accessor :ruby, :env, :yaml, :framework
|
44
46
|
|
47
|
+
# Called by framework (see lib/honeybadger/init/) at the point of
|
48
|
+
# initialization. This is not required for the notifier to work (i.e. with
|
49
|
+
# `require 'honeybadger/ruby'`).
|
45
50
|
def init!(opts = {}, env = ENV)
|
46
51
|
self.framework = opts.freeze
|
47
52
|
self.env = Env.new(env).freeze
|
48
53
|
load_config_from_disk {|yaml| self.yaml = yaml.freeze }
|
54
|
+
detect_revision!
|
49
55
|
init_logging!
|
50
56
|
init_backend!
|
51
57
|
logger.info(sprintf('Initializing Honeybadger Error Tracker for Ruby. Ship it! version=%s framework=%s', Honeybadger::VERSION, detected_framework))
|
52
58
|
logger.warn('Entering development mode: data will not be reported.') if dev? && backend.kind_of?(Backend::Null)
|
53
|
-
if valid? && !ping
|
54
|
-
logger.warn('Failed to connect to Honeybadger service -- please verify that api.honeybadger.io is reachable (connection will be retried).')
|
55
|
-
end
|
56
59
|
self
|
57
60
|
end
|
58
61
|
|
@@ -139,10 +142,6 @@ module Honeybadger
|
|
139
142
|
!self[:env] || !dev?
|
140
143
|
end
|
141
144
|
|
142
|
-
def valid?
|
143
|
-
self[:api_key].to_s =~ /\S/
|
144
|
-
end
|
145
|
-
|
146
145
|
def debug?
|
147
146
|
!!self[:debug]
|
148
147
|
end
|
@@ -239,14 +238,6 @@ module Honeybadger
|
|
239
238
|
@root_regexp = Regexp.new("^#{ Regexp.escape(root) }")
|
240
239
|
end
|
241
240
|
|
242
|
-
def ping
|
243
|
-
if result = send_ping
|
244
|
-
return true
|
245
|
-
end
|
246
|
-
|
247
|
-
false
|
248
|
-
end
|
249
|
-
|
250
241
|
def detected_framework
|
251
242
|
if self[:framework] =~ NOT_BLANK
|
252
243
|
self[:framework].to_sym
|
@@ -273,6 +264,11 @@ module Honeybadger
|
|
273
264
|
|
274
265
|
private
|
275
266
|
|
267
|
+
def detect_revision!
|
268
|
+
return if self[:revision]
|
269
|
+
set(:revision, Util::Revision.detect(self[:root]))
|
270
|
+
end
|
271
|
+
|
276
272
|
# Internal: Optional path to honeybadger.log log file.
|
277
273
|
#
|
278
274
|
# Returns the Pathname log path if a log path was specified.
|
@@ -369,33 +365,6 @@ module Honeybadger
|
|
369
365
|
obj.map(&:to_sym).include?(value.to_sym)
|
370
366
|
end
|
371
367
|
|
372
|
-
def ping_payload
|
373
|
-
{
|
374
|
-
version: VERSION,
|
375
|
-
framework: framework_name,
|
376
|
-
environment: self[:env],
|
377
|
-
hostname: self[:hostname],
|
378
|
-
config: to_hash
|
379
|
-
}
|
380
|
-
end
|
381
|
-
|
382
|
-
def send_ping
|
383
|
-
payload = ping_payload
|
384
|
-
debug { sprintf('ping payload=%s', payload.to_json.dump) }
|
385
|
-
response = backend.notify(:ping, payload)
|
386
|
-
if response.success?
|
387
|
-
debug { sprintf('ping response=%s', response.body.dump) }
|
388
|
-
JSON.parse(response.body)
|
389
|
-
else
|
390
|
-
warn do
|
391
|
-
msg = sprintf('ping failure code=%s', response.code)
|
392
|
-
msg << sprintf(' message=%s', response.message.dump) if response.message =~ NOT_BLANK
|
393
|
-
msg
|
394
|
-
end
|
395
|
-
nil
|
396
|
-
end
|
397
|
-
end
|
398
|
-
|
399
368
|
def locate_absolute_path(path, root)
|
400
369
|
path = Pathname.new(path.to_s)
|
401
370
|
if path.absolute?
|
@@ -46,6 +46,11 @@ module Honeybadger
|
|
46
46
|
default: Dir.pwd,
|
47
47
|
type: String
|
48
48
|
},
|
49
|
+
revision: {
|
50
|
+
description: 'The git revision of the project.',
|
51
|
+
default: nil,
|
52
|
+
type: String
|
53
|
+
},
|
49
54
|
hostname: {
|
50
55
|
description: 'The hostname of the current box.',
|
51
56
|
default: Socket.gethostname,
|
data/lib/honeybadger/notice.rb
CHANGED
@@ -0,0 +1,34 @@
|
|
1
|
+
module Honeybadger
|
2
|
+
module Util
|
3
|
+
class Revision
|
4
|
+
class << self
|
5
|
+
def detect(root = Dir.pwd)
|
6
|
+
from_heroku ||
|
7
|
+
from_capistrano(root) ||
|
8
|
+
from_git
|
9
|
+
end
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
# Requires (currently) alpha platform feature
|
14
|
+
# `heroku labs:enable runtime-dyno-metadata`
|
15
|
+
#
|
16
|
+
# See https://devcenter.heroku.com/articles/dyno-metadata
|
17
|
+
def from_heroku
|
18
|
+
ENV['HEROKU_SLUG_COMMIT']
|
19
|
+
end
|
20
|
+
|
21
|
+
def from_capistrano(root)
|
22
|
+
file = File.join(root, 'REVISION')
|
23
|
+
return nil unless File.file?(file)
|
24
|
+
File.read(file).strip rescue nil
|
25
|
+
end
|
26
|
+
|
27
|
+
def from_git
|
28
|
+
return nil unless File.directory?('.git')
|
29
|
+
`git rev-parse HEAD`.strip rescue nil
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
data/lib/honeybadger/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: honeybadger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.0.
|
4
|
+
version: 3.0.0.beta5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Honeybadger Industries LLC
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-01-
|
11
|
+
date: 2017-01-25 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Make managing application errors a more pleasant experience.
|
14
14
|
email:
|
@@ -75,6 +75,7 @@ files:
|
|
75
75
|
- lib/honeybadger/util/http.rb
|
76
76
|
- lib/honeybadger/util/request_hash.rb
|
77
77
|
- lib/honeybadger/util/request_payload.rb
|
78
|
+
- lib/honeybadger/util/revision.rb
|
78
79
|
- lib/honeybadger/util/sanitizer.rb
|
79
80
|
- lib/honeybadger/util/stats.rb
|
80
81
|
- lib/honeybadger/version.rb
|