opbeat 3.0.7 → 3.0.8

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
  SHA1:
3
- metadata.gz: bf5b5eeb0ede28475a3290ad8fc105b5fbf62db3
4
- data.tar.gz: c06e9dabae76fe0a072ebdb5c042339d451eab6f
3
+ metadata.gz: fe5eca3de7470c1ef43e2c2b30f87550aa9f4248
4
+ data.tar.gz: 3bcd257e092fe001230a0b424b4069ae092bf340
5
5
  SHA512:
6
- metadata.gz: 9d77abf28473b178c296f39ba161514b0d90106801546dafe75a3edef8e3b4dbd7c94ccdbf2797248fea18139b4f4e42d26f733cf2353bf5a22f0e40fef28052
7
- data.tar.gz: 3735cf0fc7fb86d5bcab6b590daf82b91a36a9f5f5214b4c913b6f4cb7ff5b5aaab4e8f5338a3f45da85d812fa2355bf3408f562908ecb18a03d8439071d719a
6
+ metadata.gz: 01d4b4e1ac7fb68dcdf8b9fdd56c994f75ddd42f8fe906157de6daf1ace792bfa0238d81f1ce46aaf9ebf6d8cfc8a8b4052adc0e7689788e0fc0d88fcb0402e4
7
+ data.tar.gz: 99050c7c14d10f27692ef5e1a0e8ffa32526fb804fff70451a44a396d03202077a258ee68b8c320c24f4dd94803e9ca2ec33025e0f32cf2da45545c98377fa05
@@ -6,20 +6,33 @@ rvm:
6
6
  - 2.0.0
7
7
  - 2.1.6
8
8
  - 2.2.3
9
+ - 2.3.1
9
10
  gemfile:
10
11
  - gemfiles/Gemfile.rails-3.2.x
11
12
  - gemfiles/Gemfile.rails-4.0.x
12
13
  - gemfiles/Gemfile.rails-4.1.x
13
14
  - gemfiles/Gemfile.rails-4.2.x
15
+ - gemfiles/Gemfile.rails-5.0.x
14
16
  matrix:
17
+ include:
18
+ - rvm: 2.3.1
19
+ gemfile: gemfiles/Gemfile.rails-HEAD
20
+
15
21
  exclude:
16
22
  # Rails 4.0+ requires ruby 2.0+
17
23
  - rvm: 1.9.3
18
- Gemfile: gemfiles/Gemfile.rails-4.0.x
24
+ gemfile: gemfiles/Gemfile.rails-4.0.x
25
+ - rvm: 1.9.3
26
+ gemfile: gemfiles/Gemfile.rails-4.1.x
19
27
  - rvm: 1.9.3
20
- Gemfile: gemfiles/Gemfile.rails-4.1.x
28
+ gemfile: gemfiles/Gemfile.rails-4.2.x
29
+ # Rails 5.0+ requires ruby 2.2+
21
30
  - rvm: 1.9.3
22
- Gemfile: gemfiles/Gemfile.rails-4.2.x
31
+ gemfile: gemfiles/Gemfile.rails-5.0.x
32
+ - rvm: 2.0.0
33
+ gemfile: gemfiles/Gemfile.rails-5.0.x
34
+ - rvm: 2.1.6
35
+ gemfile: gemfiles/Gemfile.rails-5.0.x
23
36
 
24
37
  notifications:
25
38
  email: false
data/Gemfile CHANGED
@@ -1,4 +1,3 @@
1
- eval_gemfile 'gemfiles/Gemfile.base'
1
+ eval_gemfile 'gemfiles/Gemfile.rails-5.0.x'
2
2
 
3
- gem "rails", ">= 3.0"
4
3
  gem 'pry'
data/HISTORY.md CHANGED
@@ -1,3 +1,8 @@
1
+ # 3.0.8
2
+
3
+ - Add support for Rails 5
4
+ - Fix support for newer versions of Sequel
5
+
1
6
  # 3.0.7
2
7
 
3
8
  **Features**
@@ -13,7 +13,6 @@ gem 'simplecov'
13
13
 
14
14
  # external libs
15
15
 
16
- gem 'sinatra'
17
16
  gem 'redis'
18
17
  gem 'fakeredis'
19
18
  gem 'sqlite3'
@@ -25,4 +24,3 @@ gem 'resque', require: false
25
24
  unless RUBY_VERSION.to_i <= 1
26
25
  gem 'sidekiq', require: false
27
26
  end
28
-
@@ -1,3 +1,4 @@
1
1
  eval_gemfile File.expand_path('../Gemfile.base', __FILE__)
2
2
 
3
3
  gem 'rails', '~> 3.2.0'
4
+ gem 'sinatra'
@@ -1,3 +1,4 @@
1
1
  eval_gemfile File.expand_path('../Gemfile.base', __FILE__)
2
2
 
3
3
  gem 'rails', '~> 4.0.0'
4
+ gem 'sinatra'
@@ -1,3 +1,4 @@
1
1
  eval_gemfile File.expand_path('../Gemfile.base', __FILE__)
2
2
 
3
3
  gem 'rails', '~> 4.1.0'
4
+ gem 'sinatra'
@@ -1,3 +1,4 @@
1
1
  eval_gemfile File.expand_path('../Gemfile.base', __FILE__)
2
2
 
3
3
  gem 'rails', '~> 4.2.0'
4
+ gem 'sinatra'
@@ -0,0 +1,4 @@
1
+ eval_gemfile File.expand_path('../Gemfile.base', __FILE__)
2
+
3
+ gem 'rails', '~> 5.0.0'
4
+ gem 'sinatra', github: 'sinatra'
@@ -0,0 +1,7 @@
1
+ eval_gemfile File.expand_path('../Gemfile.base', __FILE__)
2
+
3
+ gem 'rack', github: 'rack/rack', branch: 'master'
4
+ gem 'arel', github: 'rails/arel', branch: 'master'
5
+ gem 'rails', github: 'rails/rails', branch: 'master'
6
+ gem 'sinatra', github: 'sinatra'
7
+
@@ -193,15 +193,18 @@ module Opbeat
193
193
  exception.set_backtrace caller
194
194
  end
195
195
 
196
- error_message = ErrorMessage.from_exception(config, exception, opts)
197
- error_message.add_extra(@context) if @context
198
- data = @data_builders.error_message.build error_message
199
- enqueue Worker::PostRequest.new('/errors/', data)
196
+ if error_message = ErrorMessage.from_exception(config, exception, opts)
197
+ error_message.add_extra(@context) if @context
198
+ data = @data_builders.error_message.build error_message
199
+ enqueue Worker::PostRequest.new('/errors/', data)
200
+ end
200
201
  end
201
202
 
202
203
  def report_message message, opts = {}
203
204
  return if config.disable_errors
204
205
 
206
+ ensure_worker_running
207
+
205
208
  error_message = ErrorMessage.new(config, message, opts)
206
209
  error_message.add_extra(@context) if @context
207
210
  data = @data_builders.error_message.build error_message
@@ -23,6 +23,8 @@ module Opbeat
23
23
 
24
24
  debug_traces: false,
25
25
 
26
+ view_paths: [],
27
+
26
28
  # for tests
27
29
  disable_worker: false
28
30
  }.freeze
@@ -26,7 +26,10 @@ module Opbeat
26
26
  {} # env
27
27
  )
28
28
 
29
- env.each do |k, v|
29
+ # In Rails < 5 ActionDispatch::Request inherits from Hash
30
+ headers = env.respond_to?(:headers) ? env.headers : env
31
+
32
+ headers.each do |k, v|
30
33
  next unless k.upcase == k # lower case stuff isn't relevant
31
34
 
32
35
  if k.match(HTTP_ENV_KEY)
@@ -62,7 +62,7 @@ module Opbeat
62
62
  end
63
63
 
64
64
  def rails_filters
65
- if defined?(::Rails) && Rails.application
65
+ if defined?(::Rails) && Rails.respond_to?(:application) && Rails.application
66
66
  if filters = ::Rails.application.config.filter_parameters
67
67
  filters.any? ? filters : nil
68
68
  end
@@ -37,8 +37,8 @@ module Opbeat
37
37
  end
38
38
 
39
39
  def self.register_require_hook registration
40
- registration.require_paths.each do |p|
41
- require_hooks[p] = registration
40
+ registration.require_paths.each do |path|
41
+ require_hooks[path] = registration
42
42
  end
43
43
  end
44
44
 
@@ -49,8 +49,8 @@ module Opbeat
49
49
  installed[registration.const_name] = registration
50
50
  registration.install
51
51
 
52
- registration.require_paths.each do |p|
53
- require_hooks.delete p
52
+ registration.require_paths.each do |path|
53
+ require_hooks.delete path
54
54
  end
55
55
  end
56
56
  end
@@ -11,18 +11,21 @@ module Opbeat
11
11
  def install
12
12
  require 'sequel/database/logging'
13
13
 
14
- ::Sequel::Database.class_eval do
15
- alias log_yield_without_opb log_yield
14
+ log_method = ::Sequel::Database.method_defined?(:log_connection_yield) ?
15
+ 'log_connection_yield' : 'log_yield'
16
16
 
17
- def log_yield sql, args = nil, &block
18
- log_yield_without_opb(sql, *args) do
17
+ ::Sequel::Database.class_eval <<-end_eval
18
+ alias #{log_method}_without_opb #{log_method}
19
+
20
+ def #{log_method} sql, *args, &block
21
+ #{log_method}_without_opb(sql, *args) do
19
22
  sig = Opbeat::Injections::Sequel::Injector.sql_parser.signature_for(sql)
20
23
  Opbeat.trace(sig, KIND, sql: sql) do
21
24
  block.call
22
25
  end
23
26
  end
24
27
  end
25
- end
28
+ end_eval
26
29
  end
27
30
  end
28
31
  end
@@ -1,4 +1,5 @@
1
1
  begin
2
+ require 'active_support'
2
3
  require 'delayed_job'
3
4
  rescue LoadError
4
5
  end
@@ -3,7 +3,8 @@ module Opbeat
3
3
  module Rails
4
4
  module InjectExceptionsCatcher
5
5
  def self.included(cls)
6
- cls.send(:alias_method_chain, :render_exception, :opbeat)
6
+ cls.send(:alias_method, :render_exception_without_opbeat, :render_exception)
7
+ cls.send(:alias_method, :render_exception, :render_exception_with_opbeat)
7
8
  end
8
9
 
9
10
  def render_exception_with_opbeat(env, exception)
@@ -19,11 +19,11 @@ module Opbeat
19
19
  end
20
20
 
21
21
  def relative_path path
22
- root = config.view_paths.find { |p| path.start_with? p }
22
+ root = config.view_paths.find { |vp| path.start_with? vp }
23
23
  type = :app
24
24
 
25
25
  unless root
26
- root = Gem.path.find { |p| path.start_with? p }
26
+ root = Gem.path.find { |gp| path.start_with? gp }
27
27
  type = :gem
28
28
  end
29
29
 
@@ -1,3 +1,3 @@
1
1
  module Opbeat
2
- VERSION = "3.0.7"
2
+ VERSION = "3.0.8"
3
3
  end
@@ -20,7 +20,7 @@ describe 'Rails integration' do
20
20
  class TinderButForHotDogs < ::Rails::Application
21
21
  config.secret_key_base = '__secret_key_base'
22
22
 
23
- config.logger = Logger.new(nil)
23
+ config.logger = Logger.new(STDOUT)
24
24
  config.logger.level = Logger::DEBUG
25
25
 
26
26
  config.eager_load = false
@@ -12,13 +12,15 @@ require 'opbeat'
12
12
  module Opbeat
13
13
  class Configuration
14
14
  # Override defaults to enable http (caught by WebMock) in test env
15
- defaults = DEFAULTS.dup.merge enabled_environments: %{test}
15
+ defaults = DEFAULTS.dup.merge enabled_environments: %w{test}
16
16
  remove_const(:DEFAULTS)
17
17
  const_set(:DEFAULTS, defaults.freeze)
18
18
  end
19
19
  end
20
20
 
21
21
  RSpec.configure do |config|
22
+ config.backtrace_exclusion_patterns += [%r{/gems/}]
23
+
22
24
  config.before :each do
23
25
  @request_stub = stub_request(:post, /intake\.opbeat\.com/)
24
26
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opbeat
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.7
4
+ version: 3.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mikkel Malmberg
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-26 00:00:00.000000000 Z
11
+ date: 2016-08-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -46,6 +46,8 @@ files:
46
46
  - gemfiles/Gemfile.rails-4.0.x
47
47
  - gemfiles/Gemfile.rails-4.1.x
48
48
  - gemfiles/Gemfile.rails-4.2.x
49
+ - gemfiles/Gemfile.rails-5.0.x
50
+ - gemfiles/Gemfile.rails-HEAD
49
51
  - lib/opbeat.rb
50
52
  - lib/opbeat/capistrano.rb
51
53
  - lib/opbeat/client.rb