debugged-ruby 0.1.3 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/debugged-ruby.rb +6 -26
- data/lib/debugged-ruby/version.rb +1 -1
- metadata +1 -1
data/lib/debugged-ruby.rb
CHANGED
@@ -57,16 +57,19 @@ module Debugged
|
|
57
57
|
"platform" => RUBY_PLATFORM.to_s}
|
58
58
|
}
|
59
59
|
|
60
|
-
url = "http://
|
60
|
+
url = "http://debugrged.herokuapp.com/report"
|
61
|
+
uri = URI(url)
|
62
|
+
|
63
|
+
req = Net::HTTP::Post.new(uri.request_uri)
|
64
|
+
req.basic_auth @@api_key, 'pass'
|
65
|
+
req.body = report.to_json
|
61
66
|
|
62
67
|
pending = 1
|
63
|
-
@@log.debug(hash + " - sending report to Debugged")
|
64
68
|
|
65
69
|
EM.run do
|
66
70
|
begin
|
67
71
|
http = EM::HttpRequest.new(url).post :body => report.to_json, :head => {'authorization' => [@@api_key, 'pass']}
|
68
72
|
http.callback {
|
69
|
-
@@log.debug(hash + " - report sent to Debugged")
|
70
73
|
pending -= 1
|
71
74
|
EM.stop if pending < 1
|
72
75
|
}
|
@@ -85,26 +88,3 @@ module Debugged
|
|
85
88
|
"http://www.debugged.herokuapp.com/report/"+hash
|
86
89
|
end
|
87
90
|
end
|
88
|
-
|
89
|
-
module Rack
|
90
|
-
class Debugged
|
91
|
-
def initialize(app)
|
92
|
-
@app = app
|
93
|
-
end
|
94
|
-
|
95
|
-
def call(env)
|
96
|
-
begin
|
97
|
-
@app.call(env)
|
98
|
-
rescue Exception => e
|
99
|
-
::Debugged.report(e, {})
|
100
|
-
raise
|
101
|
-
end
|
102
|
-
|
103
|
-
e = env['sinatra.error']
|
104
|
-
if e
|
105
|
-
::Debugged.report(e, {})
|
106
|
-
raise
|
107
|
-
end
|
108
|
-
end
|
109
|
-
end
|
110
|
-
end
|