airbrake 9.5.0 → 9.5.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 29bdd7916d90d84ac4933c2ce14d9069bd719a371bf822a3b886175841b2005c
4
- data.tar.gz: 94f382b83ce554984a9c4e8162241be85baa78739d928e3c74081cfb17217f1a
3
+ metadata.gz: 4b5f9ef24127cd1a044a2959d8c90efd26e39db56e85ade6708340fc66009e36
4
+ data.tar.gz: 4e79c36be0244afaf4e9716b1d6d7b195cecf3b35bcd0ecfd95afaa426c02c69
5
5
  SHA512:
6
- metadata.gz: e7e27d67804da299808bd87f6d2f201ab778ef344ff377283536d5be2082c579df9e54102eb83d48a5cadc78cf434bfcb7bf3c999a816b449f8930e539c96743
7
- data.tar.gz: '028d1865c3e42686c54455164087d401f3dabbd1380b915aec7ca8191e0f777dc26c32930c9118bd160ef1bd6ba63f1fac289a4786f9fc720c98f7a3eadfe2ae'
6
+ metadata.gz: 9f8a4e8a07779cee46cb1b7d308db3d97bd9f1008aa4082966dbe0fffc8a043cf78439a7ad8b762887369ce37f1d245b70f9df73a899a1ccfd1b0880854e60bf
7
+ data.tar.gz: cf80d00213697bf952a3fa6c20a0cdd936381ced3005dccdefed28d4de912f243390e8916f571a3fbc234766bdfd7b8656cdf143010c14b0d7ef5b06372e51a2
@@ -14,7 +14,7 @@ module Airbrake
14
14
 
15
15
  notice[:context][:route] =
16
16
  if action_dispatch_request?(request)
17
- rails_route(request)
17
+ Airbrake::Rails::App.recognize_route(request)
18
18
  elsif sinatra_request?(request)
19
19
  sinatra_route(request)
20
20
  end
@@ -22,19 +22,6 @@ module Airbrake
22
22
 
23
23
  private
24
24
 
25
- def rails_route(request)
26
- ::Rails.application.routes.router.recognize(request) do |route, _parameters|
27
- # Rails can recognize multiple routes for the given request. For
28
- # example, if we visit /users/2/edit, then Rails sees these routes:
29
- # * "/users/:id/edit(.:format)"
30
- # * "/"
31
- #
32
- # We return the first route as, what it seems, the most optimal
33
- # approach.
34
- return route.path.spec.to_s
35
- end
36
- end
37
-
38
25
  def sinatra_route(request)
39
26
  return unless (route = request.env['sinatra.route'])
40
27
  route.split(' ').drop(1).join(' ')
@@ -23,24 +23,17 @@ module Airbrake
23
23
  return unless (routes = Airbrake::Rack::RequestStore[:routes])
24
24
 
25
25
  event = Airbrake::Rails::Event.new(*args)
26
- route = find_route(event.params)
26
+ route = Airbrake::Rails::App.recognize_route(
27
+ Airbrake::Rack::RequestStore[:request]
28
+ )
27
29
  return unless route
28
30
 
29
- routes[route.path] = {
31
+ routes[route] = {
30
32
  method: event.method,
31
33
  response_type: event.response_type,
32
34
  groups: {}
33
35
  }
34
36
  end
35
-
36
- private
37
-
38
- def find_route(params)
39
- @app.routes.find do |route|
40
- route.controller == params[CONTROLLER_KEY] &&
41
- route.action == params[ACTION_KEY]
42
- end
43
- end
44
37
  end
45
38
  end
46
39
  end
@@ -7,6 +7,19 @@ module Airbrake
7
7
  class App
8
8
  Route = Struct.new(:path, :controller, :action)
9
9
 
10
+ def self.recognize_route(request)
11
+ ::Rails.application.routes.router.recognize(request) do |route, _parameters|
12
+ # Rails can recognize multiple routes for the given request. For
13
+ # example, if we visit /users/2/edit, then Rails sees these routes:
14
+ # * "/users/:id/edit(.:format)"
15
+ # * "/"
16
+ #
17
+ # We return the first route as, what it seems, the most optimal
18
+ # approach.
19
+ return route.path.spec.to_s
20
+ end
21
+ end
22
+
10
23
  def routes
11
24
  @routes ||= app_routes.merge(engine_routes).flat_map do |(engine_name, routes)|
12
25
  routes.map { |rails_route| build_route(engine_name, rails_route) }
@@ -96,8 +96,11 @@ module Airbrake
96
96
  ActiveSupport.on_load(:active_record, run_once: true) do
97
97
  # Reports exceptions occurring in some bugged ActiveRecord callbacks.
98
98
  # Applicable only to the versions of Rails lower than 4.2.
99
- require 'airbrake/rails/active_record'
100
- include Airbrake::Rails::ActiveRecord
99
+ if defined?(::Rails) &&
100
+ Gem::Version.new(::Rails.version) <= Gem::Version.new('4.2')
101
+ require 'airbrake/rails/active_record'
102
+ include Airbrake::Rails::ActiveRecord
103
+ end
101
104
 
102
105
  if defined?(ActiveRecord) && Airbrake::Config.instance.query_stats
103
106
  # Send SQL queries.
@@ -1,5 +1,5 @@
1
1
  # We use Semantic Versioning v2.0.0
2
2
  # More information: http://semver.org/
3
3
  module Airbrake
4
- AIRBRAKE_VERSION = '9.5.0'.freeze
4
+ AIRBRAKE_VERSION = '9.5.1'.freeze
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: airbrake
3
3
  version: !ruby/object:Gem::Version
4
- version: 9.5.0
4
+ version: 9.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Airbrake Technologies, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-10-24 00:00:00.000000000 Z
11
+ date: 2019-11-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: airbrake-ruby
@@ -240,6 +240,20 @@ dependencies:
240
240
  - - '='
241
241
  - !ruby/object:Gem::Version
242
242
  version: 5.11.3
243
+ - !ruby/object:Gem::Dependency
244
+ name: rack-cache
245
+ requirement: !ruby/object:Gem::Requirement
246
+ requirements:
247
+ - - '='
248
+ - !ruby/object:Gem::Version
249
+ version: 1.9.0
250
+ type: :development
251
+ prerelease: false
252
+ version_requirements: !ruby/object:Gem::Requirement
253
+ requirements:
254
+ - - '='
255
+ - !ruby/object:Gem::Version
256
+ version: 1.9.0
243
257
  - !ruby/object:Gem::Dependency
244
258
  name: sidekiq
245
259
  requirement: !ruby/object:Gem::Requirement