raygun4ruby 1.1.5 → 1.1.6
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.
- checksums.yaml +4 -4
- data/README.md +8 -8
- data/examples/sinatras_raygun.rb +18 -0
- data/lib/raygun/client.rb +8 -4
- data/lib/raygun/configuration.rb +1 -0
- data/lib/raygun/middleware/rails_insert_affected_user.rb +1 -1
- data/lib/raygun/railtie.rb +1 -1
- data/lib/raygun/version.rb +1 -1
- data/lib/raygun.rb +0 -6
- data/raygun4ruby.gemspec +1 -1
- data/test/unit/client_test.rb +3 -4
- data/test/unit/rails_insert_affected_user_test.rb +20 -1
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c58d71eb4bdeab659d2f45cf26a950329300de06
|
4
|
+
data.tar.gz: 8a45df3769e8718f25833068771206bd83293391
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5921a260da5a54631c0edbd07741817c0262e994de2e4c96956c32eab9c03d3168a88d7e4ab4349e6557b7179656d765e2aab40e7ff425051cd10efb09835c07
|
7
|
+
data.tar.gz: c15e7d386feccdaf30bcfe841ebf84b6525ff962d0ea7952ce70635c3950dec7e276d13e56fb23f08a13c918e1baa3a87e907568d7dff81469e6682a3343b9c0
|
data/README.md
CHANGED
@@ -19,7 +19,7 @@ Or install it yourself as:
|
|
19
19
|
|
20
20
|
## Usage
|
21
21
|
|
22
|
-
###Rails 3/4
|
22
|
+
### Rails 3/4
|
23
23
|
|
24
24
|
Run:
|
25
25
|
|
@@ -55,7 +55,7 @@ end
|
|
55
55
|
use Raygun::Middleware::RackExceptionInterceptor
|
56
56
|
```
|
57
57
|
|
58
|
-
###Standalone / Manual Exception Tracking
|
58
|
+
### Standalone / Manual Exception Tracking
|
59
59
|
|
60
60
|
```ruby
|
61
61
|
|
@@ -78,7 +78,7 @@ end
|
|
78
78
|
|
79
79
|
You can also pass a Hash as the second parameter to `track_exception`. It should look like a [Rack Env Hash](http://rack.rubyforge.org/doc/SPEC.html)
|
80
80
|
|
81
|
-
###
|
81
|
+
### Customizing The Parameter Filtering
|
82
82
|
|
83
83
|
If you'd like to customize how parameters are filtered, you can pass a `Proc` to `filter_parameters`. Raygun4Ruby will yield the params hash to the block, and the return value will be sent along with your error.
|
84
84
|
|
@@ -91,7 +91,7 @@ Raygun.setup do |config|
|
|
91
91
|
end
|
92
92
|
```
|
93
93
|
|
94
|
-
###Custom User Data
|
94
|
+
### Custom User Data
|
95
95
|
Custom data can be added to `track_exception` by passing a custom_data key in the second parameter hash.
|
96
96
|
|
97
97
|
```ruby
|
@@ -104,7 +104,7 @@ end
|
|
104
104
|
|
105
105
|
```
|
106
106
|
|
107
|
-
###Ignoring Some Errors
|
107
|
+
### Ignoring Some Errors
|
108
108
|
|
109
109
|
You can ignore certain types of Exception using the `ignore` option in the setup block, like so:
|
110
110
|
|
@@ -124,7 +124,7 @@ Raygun.setup do |config|
|
|
124
124
|
end
|
125
125
|
```
|
126
126
|
|
127
|
-
###Using a Proxy
|
127
|
+
### Using a Proxy
|
128
128
|
|
129
129
|
You can pass proxy settings using the `proxy_settings` config option.
|
130
130
|
|
@@ -135,7 +135,7 @@ Raygun.setup do |config|
|
|
135
135
|
end
|
136
136
|
```
|
137
137
|
|
138
|
-
###Affected User Tracking
|
138
|
+
### Affected User Tracking
|
139
139
|
|
140
140
|
Raygun can now track how many users have been affected by an error.
|
141
141
|
|
@@ -169,7 +169,7 @@ end
|
|
169
169
|
|
170
170
|
(Remember to set `affected_user_method` to `:raygun_user` in your config block...)
|
171
171
|
|
172
|
-
###Resque Error Tracking
|
172
|
+
### Resque Error Tracking
|
173
173
|
|
174
174
|
Raygun4Ruby also includes a Resque failure backend. You should include it inside your Resque initializer (usually something like `config/initializers/load_resque.rb`)
|
175
175
|
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# NB: You'll need to install the 'sinatra' gem for this to work :)
|
2
|
+
# $ gem install sinatra
|
3
|
+
# $ ruby sinatras_raygun.rb
|
4
|
+
|
5
|
+
require 'sinatra'
|
6
|
+
require_relative '../lib/raygun4ruby'
|
7
|
+
|
8
|
+
Raygun.setup do |config|
|
9
|
+
config.api_key = YOUR_RAYGUN_API_KEY_HERE
|
10
|
+
end
|
11
|
+
|
12
|
+
use Raygun::RackExceptionInterceptor
|
13
|
+
|
14
|
+
set :raise_errors, true
|
15
|
+
|
16
|
+
get '/' do
|
17
|
+
raise "This is an exception that will be sent to Raygun!"
|
18
|
+
end
|
data/lib/raygun/client.rb
CHANGED
@@ -4,14 +4,14 @@ module Raygun
|
|
4
4
|
class Client
|
5
5
|
|
6
6
|
ENV_IP_ADDRESS_KEYS = %w(action_dispatch.remote_ip raygun.remote_ip REMOTE_ADDR)
|
7
|
+
NO_API_KEY_MESSAGE = "[RAYGUN] Just a note, you've got no API Key configured, which means we can't report exceptions. Specify your Raygun API key using Raygun#setup (find yours at https://app.raygun.io)"
|
7
8
|
|
8
9
|
include HTTParty
|
9
10
|
|
10
11
|
base_uri "https://api.raygun.io/"
|
11
12
|
|
12
13
|
def initialize
|
13
|
-
@api_key = require_api_key
|
14
|
-
|
14
|
+
@api_key = require_api_key
|
15
15
|
@headers = {
|
16
16
|
"X-ApiKey" => @api_key
|
17
17
|
}
|
@@ -19,8 +19,8 @@ module Raygun
|
|
19
19
|
enable_http_proxy if Raygun.configuration.proxy_settings[:address]
|
20
20
|
end
|
21
21
|
|
22
|
-
def require_api_key
|
23
|
-
Raygun.configuration.api_key ||
|
22
|
+
def require_api_key
|
23
|
+
Raygun.configuration.api_key || print_api_key_warning
|
24
24
|
end
|
25
25
|
|
26
26
|
def track_exception(exception_instance, env = {})
|
@@ -194,5 +194,9 @@ module Raygun
|
|
194
194
|
"(Not Available)"
|
195
195
|
end
|
196
196
|
|
197
|
+
def print_api_key_warning
|
198
|
+
$stderr.puts(NO_API_KEY_MESSAGE)
|
199
|
+
end
|
200
|
+
|
197
201
|
end
|
198
202
|
end
|
data/lib/raygun/configuration.rb
CHANGED
@@ -48,6 +48,7 @@ module Raygun
|
|
48
48
|
IGNORE_DEFAULT = ['ActiveRecord::RecordNotFound',
|
49
49
|
'ActionController::RoutingError',
|
50
50
|
'ActionController::InvalidAuthenticityToken',
|
51
|
+
'ActionDispatch::ParamsParser::ParseError',
|
51
52
|
'CGI::Session::CookieStore::TamperedWithCookie',
|
52
53
|
'ActionController::UnknownAction',
|
53
54
|
'AbstractController::ActionNotFound',
|
@@ -10,7 +10,7 @@ module Raygun
|
|
10
10
|
def call(env)
|
11
11
|
response = @app.call(env)
|
12
12
|
rescue Exception => exception
|
13
|
-
if (controller = env["action_controller.instance"]) && controller.respond_to?(Raygun.configuration.affected_user_method)
|
13
|
+
if (controller = env["action_controller.instance"]) && controller.respond_to?(Raygun.configuration.affected_user_method, true)
|
14
14
|
user = controller.send(Raygun.configuration.affected_user_method)
|
15
15
|
|
16
16
|
if user
|
data/lib/raygun/railtie.rb
CHANGED
@@ -15,7 +15,7 @@ class Raygun::Railtie < Rails::Railtie
|
|
15
15
|
|
16
16
|
# Affected User tracking
|
17
17
|
require "raygun/middleware/rails_insert_affected_user"
|
18
|
-
app.config.middleware.
|
18
|
+
app.config.middleware.insert_after Raygun::Middleware::RackExceptionInterceptor, "Raygun::Middleware::RailsInsertAffectedUser"
|
19
19
|
end
|
20
20
|
|
21
21
|
config.to_prepare do
|
data/lib/raygun/version.rb
CHANGED
data/lib/raygun.rb
CHANGED
@@ -1,6 +1,3 @@
|
|
1
|
-
require "bundler"
|
2
|
-
Bundler.setup(:default)
|
3
|
-
|
4
1
|
require "httparty"
|
5
2
|
require "logger"
|
6
3
|
require "json"
|
@@ -21,9 +18,6 @@ module Raygun
|
|
21
18
|
CLIENT_URL = "https://github.com/MindscapeHQ/raygun4ruby"
|
22
19
|
CLIENT_NAME = "Raygun4Ruby Gem"
|
23
20
|
|
24
|
-
# Exceptions
|
25
|
-
class ApiKeyRequired < StandardError; end
|
26
|
-
|
27
21
|
class << self
|
28
22
|
|
29
23
|
include Testable
|
data/raygun4ruby.gemspec
CHANGED
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.add_runtime_dependency "rack"
|
25
25
|
|
26
26
|
spec.add_development_dependency "bundler", ">= 1.1"
|
27
|
-
spec.add_development_dependency "rake"
|
27
|
+
spec.add_development_dependency "rake", "0.9.6"
|
28
28
|
spec.add_development_dependency "fakeweb", ["~> 1.3"]
|
29
29
|
spec.add_development_dependency "timecop"
|
30
30
|
spec.add_development_dependency "minitest", "~> 4.2"
|
data/test/unit/client_test.rb
CHANGED
@@ -27,12 +27,11 @@ class ClientTest < Raygun::UnitTest
|
|
27
27
|
fake_successful_entry
|
28
28
|
end
|
29
29
|
|
30
|
-
def
|
30
|
+
def test_api_key_required_message
|
31
31
|
Raygun.configuration.api_key = nil
|
32
32
|
|
33
|
-
|
34
|
-
|
35
|
-
end
|
33
|
+
$stderr.expects(:puts).with(Raygun::Client::NO_API_KEY_MESSAGE).once
|
34
|
+
second_client = Raygun::Client.new
|
36
35
|
end
|
37
36
|
|
38
37
|
def test_track_exception
|
@@ -22,6 +22,13 @@ class ClientTest < Raygun::UnitTest
|
|
22
22
|
|
23
23
|
def no_logged_in_user
|
24
24
|
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def private_current_user
|
29
|
+
user_with_email
|
30
|
+
end
|
31
|
+
|
25
32
|
end
|
26
33
|
|
27
34
|
class MockApp
|
@@ -92,4 +99,16 @@ class ClientTest < Raygun::UnitTest
|
|
92
99
|
end
|
93
100
|
end
|
94
101
|
|
95
|
-
|
102
|
+
def test_with_private_method
|
103
|
+
Raygun.configuration.affected_user_method = :private_current_user
|
104
|
+
assert @controller.respond_to?(Raygun.configuration.affected_user_method, true)
|
105
|
+
|
106
|
+
begin
|
107
|
+
@middleware.call("action_controller.instance" => @controller)
|
108
|
+
rescue TestException
|
109
|
+
user_hash = { :identifier => "testemail@something.com" }
|
110
|
+
assert_equal user_hash, @app.env["raygun.affected_user"]
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: raygun4ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mindscape
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-05-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: httparty
|
@@ -71,16 +71,16 @@ dependencies:
|
|
71
71
|
name: rake
|
72
72
|
requirement: !ruby/object:Gem::Requirement
|
73
73
|
requirements:
|
74
|
-
- -
|
74
|
+
- - '='
|
75
75
|
- !ruby/object:Gem::Version
|
76
|
-
version:
|
76
|
+
version: 0.9.6
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
79
|
version_requirements: !ruby/object:Gem::Requirement
|
80
80
|
requirements:
|
81
|
-
- -
|
81
|
+
- - '='
|
82
82
|
- !ruby/object:Gem::Version
|
83
|
-
version:
|
83
|
+
version: 0.9.6
|
84
84
|
- !ruby/object:Gem::Dependency
|
85
85
|
name: fakeweb
|
86
86
|
requirement: !ruby/object:Gem::Requirement
|
@@ -198,6 +198,7 @@ files:
|
|
198
198
|
- LICENSE.txt
|
199
199
|
- README.md
|
200
200
|
- Rakefile
|
201
|
+
- examples/sinatras_raygun.rb
|
201
202
|
- lib/generators/raygun/install_generator.rb
|
202
203
|
- lib/raygun.rb
|
203
204
|
- lib/raygun/client.rb
|