toadhopper 1.0.3 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +3 -2
- data/lib/toadhopper.rb +19 -5
- metadata +17 -5
data/README.md
CHANGED
@@ -38,5 +38,6 @@ To build the gem:
|
|
38
38
|
|
39
39
|
* [Tim Lucas](http://github.com/toolmantim)
|
40
40
|
* [Samuel Tesla](http://github.com/stesla)
|
41
|
-
* [
|
42
|
-
* [
|
41
|
+
* [Corey Donohoe](http://github.com/atmos)
|
42
|
+
* [Andre Arko](http://github.com/indirect)
|
43
|
+
* [Loren Segal](http://github.com/lsegal)
|
data/lib/toadhopper.rb
CHANGED
@@ -4,7 +4,7 @@ require 'ostruct'
|
|
4
4
|
|
5
5
|
# Posts errors to the Hoptoad API
|
6
6
|
class Toadhopper
|
7
|
-
VERSION = "1.0.
|
7
|
+
VERSION = "1.0.4"
|
8
8
|
FILTER_REPLACEMENT = "[FILTERED]"
|
9
9
|
|
10
10
|
# Hoptoad API response
|
@@ -52,12 +52,14 @@ class Toadhopper
|
|
52
52
|
post_document(document_for(error, options), {'X-Hoptoad-Client-Name' => options[:notifier_name]})
|
53
53
|
end
|
54
54
|
|
55
|
+
private
|
56
|
+
|
55
57
|
def document_defaults(error)
|
56
58
|
{
|
57
59
|
:error => error,
|
58
60
|
:api_key => api_key,
|
59
61
|
:environment => ENV.to_hash,
|
60
|
-
:backtrace => error
|
62
|
+
:backtrace => backtrace_for(error),
|
61
63
|
:url => 'http://localhost/',
|
62
64
|
:component => 'http://localhost/',
|
63
65
|
:action => nil,
|
@@ -77,8 +79,6 @@ class Toadhopper
|
|
77
79
|
data
|
78
80
|
end
|
79
81
|
|
80
|
-
private
|
81
|
-
|
82
82
|
def filters
|
83
83
|
[@filters].flatten.compact
|
84
84
|
end
|
@@ -107,8 +107,22 @@ class Toadhopper
|
|
107
107
|
scope.instance_eval ERB.new(notice_template, nil, '-').src
|
108
108
|
end
|
109
109
|
|
110
|
+
BacktraceLine = Struct.new(:file, :number, :method)
|
111
|
+
|
112
|
+
def backtrace_for(error)
|
113
|
+
lines = Array(error.backtrace).map {|l| backtrace_line(l)}
|
114
|
+
if lines.empty?
|
115
|
+
lines << BacktraceLine.new("no-backtrace", "1", nil)
|
116
|
+
end
|
117
|
+
lines
|
118
|
+
end
|
119
|
+
|
110
120
|
def backtrace_line(line)
|
111
|
-
|
121
|
+
if match = line.match(%r{^(.+):(\d+)(?::in `([^']+)')?$})
|
122
|
+
BacktraceLine.new(*match.captures)
|
123
|
+
else
|
124
|
+
BacktraceLine.new(line, "1", nil)
|
125
|
+
end
|
112
126
|
end
|
113
127
|
|
114
128
|
def notice_template
|
metadata
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: toadhopper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 31
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 0
|
9
|
+
- 4
|
10
|
+
version: 1.0.4
|
5
11
|
platform: ruby
|
6
12
|
authors:
|
7
13
|
- Tim Lucas
|
@@ -12,7 +18,7 @@ autorequire:
|
|
12
18
|
bindir: bin
|
13
19
|
cert_chain: []
|
14
20
|
|
15
|
-
date: 2010-
|
21
|
+
date: 2010-06-14 00:00:00 -07:00
|
16
22
|
default_executable:
|
17
23
|
dependencies: []
|
18
24
|
|
@@ -48,21 +54,27 @@ rdoc_options:
|
|
48
54
|
require_paths:
|
49
55
|
- lib
|
50
56
|
required_ruby_version: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
51
58
|
requirements:
|
52
59
|
- - ">="
|
53
60
|
- !ruby/object:Gem::Version
|
61
|
+
hash: 3
|
62
|
+
segments:
|
63
|
+
- 0
|
54
64
|
version: "0"
|
55
|
-
version:
|
56
65
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
66
|
+
none: false
|
57
67
|
requirements:
|
58
68
|
- - ">="
|
59
69
|
- !ruby/object:Gem::Version
|
70
|
+
hash: 3
|
71
|
+
segments:
|
72
|
+
- 0
|
60
73
|
version: "0"
|
61
|
-
version:
|
62
74
|
requirements: []
|
63
75
|
|
64
76
|
rubyforge_project:
|
65
|
-
rubygems_version: 1.3.
|
77
|
+
rubygems_version: 1.3.7
|
66
78
|
signing_key:
|
67
79
|
specification_version: 3
|
68
80
|
summary: Post error notifications to Hoptoad
|