toadhopper-sinatra 1.0.5 → 2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +2 -2
- data/example.rb +2 -2
- data/lib/sinatra/toadhopper.rb +12 -12
- data/lib/sinatra/toadhopper/version.rb +1 -1
- data/toadhopper-sinatra.gemspec +1 -1
- metadata +4 -4
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
[
|
1
|
+
[Airbrake](http://www.airbrakeapp.com/) meets [Sinatra](http://www.sinatrarb.com/).
|
2
2
|
|
3
3
|
_____ ,
|
4
4
|
/ \______ |\ __
|
@@ -22,7 +22,7 @@ For usage see example.rb. To install:
|
|
22
22
|
|
23
23
|
## Development
|
24
24
|
|
25
|
-
Install Bundler
|
25
|
+
Install Bundler, then:
|
26
26
|
|
27
27
|
% git clone git://github.com/toolmantim/toadhopper-sinatra.git
|
28
28
|
% cd toadhopper-sinatra
|
data/example.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'sinatra'
|
2
2
|
require 'sinatra/toadhopper'
|
3
3
|
|
4
|
-
set :
|
4
|
+
set :airbrake, :api_key => "apikey", :filters => /password/
|
5
5
|
|
6
6
|
post "/register" do
|
7
7
|
session[:user_id] = 42
|
@@ -9,6 +9,6 @@ post "/register" do
|
|
9
9
|
end
|
10
10
|
|
11
11
|
error do
|
12
|
-
|
12
|
+
post_error_to_airbrake!
|
13
13
|
"Ouch, that hurt."
|
14
14
|
end
|
data/lib/sinatra/toadhopper.rb
CHANGED
@@ -7,13 +7,13 @@ module Sinatra
|
|
7
7
|
|
8
8
|
module Helpers
|
9
9
|
# Reports the current sinatra error to Hoptoad
|
10
|
-
def
|
11
|
-
unless
|
12
|
-
STDERR.puts "
|
10
|
+
def post_error_to_airbrake!
|
11
|
+
unless airbrake_api_key
|
12
|
+
STDERR.puts "Airbrake api key not set, e.g. set :airbrake, :api_key => 'my api key'"
|
13
13
|
return
|
14
14
|
end
|
15
|
-
toadhopper = ::Toadhopper.new(
|
16
|
-
toadhopper.filters =
|
15
|
+
toadhopper = ::Toadhopper.new(airbrake_api_key, airbrake_options)
|
16
|
+
toadhopper.filters = airbrake_filters if airbrake_filters
|
17
17
|
toadhopper.post!(
|
18
18
|
env['sinatra.error'],
|
19
19
|
{
|
@@ -31,20 +31,20 @@ module Sinatra
|
|
31
31
|
)
|
32
32
|
end
|
33
33
|
private
|
34
|
-
def
|
35
|
-
settings.
|
34
|
+
def airbrake_filters
|
35
|
+
settings.airbrake[:filters]
|
36
36
|
end
|
37
|
-
def
|
38
|
-
settings.
|
37
|
+
def airbrake_api_key
|
38
|
+
settings.airbrake[:api_key]
|
39
39
|
end
|
40
|
-
def
|
41
|
-
settings.
|
40
|
+
def airbrake_options
|
41
|
+
settings.airbrake.reject {|k,_| [:api_key, :filters].include?(k)}
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
45
|
def self.registered(app)
|
46
46
|
app.helpers Toadhopper::Helpers
|
47
|
-
app.set :
|
47
|
+
app.set :airbrake, {}
|
48
48
|
end
|
49
49
|
|
50
50
|
end
|
data/toadhopper-sinatra.gemspec
CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |s|
|
|
20
20
|
s.extra_rdoc_files = ['README.md', 'LICENSE', 'example.rb']
|
21
21
|
|
22
22
|
s.add_dependency 'sinatra'
|
23
|
-
s.add_dependency 'toadhopper', '~>
|
23
|
+
s.add_dependency 'toadhopper', '~> 2.0'
|
24
24
|
|
25
25
|
s.add_development_dependency 'rake'
|
26
26
|
s.add_development_dependency 'exemplor'
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: toadhopper-sinatra
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version:
|
5
|
+
version: "2.0"
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Tim Lucas
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
requirements:
|
33
33
|
- - ~>
|
34
34
|
- !ruby/object:Gem::Version
|
35
|
-
version: "
|
35
|
+
version: "2.0"
|
36
36
|
type: :runtime
|
37
37
|
prerelease: false
|
38
38
|
version_requirements: *id002
|
@@ -116,7 +116,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
116
116
|
requirements:
|
117
117
|
- - ">="
|
118
118
|
- !ruby/object:Gem::Version
|
119
|
-
hash:
|
119
|
+
hash: -2506588135648544577
|
120
120
|
segments:
|
121
121
|
- 0
|
122
122
|
version: "0"
|
@@ -125,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
125
125
|
requirements:
|
126
126
|
- - ">="
|
127
127
|
- !ruby/object:Gem::Version
|
128
|
-
hash:
|
128
|
+
hash: -2506588135648544577
|
129
129
|
segments:
|
130
130
|
- 0
|
131
131
|
version: "0"
|