canary_notifier 0.0.14 → 0.0.15
Sign up to get free protection for your applications and to get access to all the features.
- data/canary_notifier.gemspec +1 -1
- data/lib/canary_notifier.rb +15 -41
- metadata +3 -3
data/canary_notifier.gemspec
CHANGED
data/lib/canary_notifier.rb
CHANGED
@@ -9,51 +9,25 @@ class CanaryNotifier
|
|
9
9
|
@app.call(env)
|
10
10
|
rescue Exception => e
|
11
11
|
url = 'http://stark:abc123@bugdrop.bugdrop.io/notify'
|
12
|
-
(file_name, line_number, method) = parse_backtrace_line(find_our_backtrace_line(e.backtrace))
|
13
12
|
|
14
13
|
data = {}
|
15
|
-
data["
|
16
|
-
data["
|
17
|
-
|
18
|
-
data[
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
data["code_sample"] = lines[start_line..end_line].join
|
31
|
-
|
32
|
-
data["code_sample_line_start"] = line_number.to_i - 3
|
33
|
-
data["code_sample_line_start"] = 1 if data["code_sample_line_start"] < 1
|
14
|
+
data["app"] = @options[:app_name] || "No Name"
|
15
|
+
data["title"] = "#{e.class.name}: #{e.to_s}"
|
16
|
+
|
17
|
+
data[:sections] = []
|
18
|
+
|
19
|
+
backtrace = {}
|
20
|
+
backtrace[:title] = 'Backtrace'
|
21
|
+
backtrace[:body] = e.backtrace.join("\n")
|
22
|
+
|
23
|
+
data[:sections] << backtrace
|
24
|
+
|
25
|
+
env = {}
|
26
|
+
env[:title] = 'Environment'
|
27
|
+
env[:body] = ENV.to_a
|
28
|
+
|
34
29
|
RestClient.post url, data.to_json
|
35
30
|
|
36
31
|
raise e
|
37
32
|
end
|
38
|
-
|
39
|
-
def parse_backtrace_line(line)
|
40
|
-
parts = line.split(':')
|
41
|
-
|
42
|
-
# the backtrace will always parse funny on Windows due to paths containing things like
|
43
|
-
# 'c:\ruby\etc...'
|
44
|
-
if parts.size == 4
|
45
|
-
file = parts[0..1].join(':')
|
46
|
-
line_num = parts[2]
|
47
|
-
method = parts[3]
|
48
|
-
[file, line_num, method]
|
49
|
-
else
|
50
|
-
parts
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
def find_our_backtrace_line(backtrace)
|
55
|
-
backtrace.each do |l|
|
56
|
-
return l if !l.match(/gems/)
|
57
|
-
end
|
58
|
-
end
|
59
33
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: canary_notifier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.15
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2011-10-27 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rest-client
|
16
|
-
requirement: &
|
16
|
+
requirement: &70256085269680 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70256085269680
|
25
25
|
description:
|
26
26
|
email: support@canaryhq.com
|
27
27
|
executables: []
|