execute_with_rescue_with_airbrake 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,13 +1,39 @@
1
+ # Send builds to container-based infrastructure
2
+ # http://docs.travis-ci.com/user/workers/container-based-infrastructure/
3
+ sudo: false
1
4
  language: ruby
2
5
  cache:
3
6
  - bundler
4
7
  rvm:
5
- - 1.9.3
6
- - 2.0.0
7
- - 2.1.0
8
- - 2.1.1
9
- - 2.1.2
8
+ - 2.0
9
+ - 2.1
10
+ - 2.2.4
11
+ # Since the Travis Build Env does not recognize `2.3` alias yet
12
+ # We need to specify the version precisely
13
+ - 2.3.0
14
+ - ruby-head
10
15
  gemfile:
11
- - gemfiles/rails_3_2.gemfile
12
- - gemfiles/rails_4_0.gemfile
13
- - gemfiles/rails_4_1.gemfile
16
+ - gemfiles/rails_3_2_and_airbrake_3.gemfile
17
+ - gemfiles/rails_4_0_and_airbrake_3.gemfile
18
+ - gemfiles/rails_4_1_and_airbrake_3.gemfile
19
+ - gemfiles/rails_4_2_and_airbrake_3.gemfile
20
+ - gemfiles/rails_5_0_and_airbrake_3.gemfile
21
+ - gemfiles/rails_3_2_and_airbrake_4.gemfile
22
+ - gemfiles/rails_4_0_and_airbrake_4.gemfile
23
+ - gemfiles/rails_4_1_and_airbrake_4.gemfile
24
+ - gemfiles/rails_4_2_and_airbrake_4.gemfile
25
+ - gemfiles/rails_5_0_and_airbrake_4.gemfile
26
+ matrix:
27
+ fast_finish: true
28
+ allow_failures:
29
+ - rvm: ruby-head
30
+ exclude:
31
+ - rvm: 2.0
32
+ gemfile: gemfiles/rails_5_0_and_airbrake_3.gemfile
33
+ - rvm: 2.0
34
+ gemfile: gemfiles/rails_5_0_and_airbrake_4.gemfile
35
+ - rvm: 2.1
36
+ gemfile: gemfiles/rails_5_0_and_airbrake_3.gemfile
37
+ - rvm: 2.1
38
+ gemfile: gemfiles/rails_5_0_and_airbrake_4.gemfile
39
+
data/Appraisals CHANGED
@@ -1,11 +1,49 @@
1
- appraise "rails-3-2" do
2
- gem "activesupport", "3.2.18"
1
+ appraise "rails_3_2_and_airbrake_3" do
2
+ gem 'activesupport', "~> 3.2.20"
3
+ gem 'airbrake', "~> 3.1"
3
4
  end
4
5
 
5
- appraise "rails-4-0" do
6
- gem "activesupport", "4.0.5"
6
+ appraise "rails_4_0_and_airbrake_3" do
7
+ gem 'activesupport', "~> 4.0.12"
8
+ gem 'airbrake', "~> 3.1"
7
9
  end
8
10
 
9
- appraise "rails-4-1" do
10
- gem "activesupport", "4.1.1"
11
+ appraise "rails_4_1_and_airbrake_3" do
12
+ gem 'activesupport', "~> 4.1.8"
13
+ gem 'airbrake', "~> 3.1"
14
+ end
15
+
16
+ appraise "rails_4_2_and_airbrake_3" do
17
+ gem 'activesupport', "~> 4.2.0"
18
+ gem 'airbrake', "~> 3.1"
19
+ end
20
+
21
+ appraise "rails_5_0_and_airbrake_3" do
22
+ gem 'activesupport', ">= 5.0.0.beta1", "<= 5.1"
23
+ gem 'airbrake', "~> 3.1"
24
+ end
25
+
26
+ appraise "rails_3_2_and_airbrake_4" do
27
+ gem 'activesupport', "~> 3.2.20"
28
+ gem 'airbrake', "~> 4.0"
29
+ end
30
+
31
+ appraise "rails_4_0_and_airbrake_4" do
32
+ gem 'activesupport', "~> 4.0.12"
33
+ gem 'airbrake', "~> 4.0"
34
+ end
35
+
36
+ appraise "rails_4_1_and_airbrake_4" do
37
+ gem 'activesupport', "~> 4.1.8"
38
+ gem 'airbrake', "~> 4.0"
39
+ end
40
+
41
+ appraise "rails_4_2_and_airbrake_4" do
42
+ gem 'activesupport', "~> 4.2.0"
43
+ gem 'airbrake', "~> 4.0"
44
+ end
45
+
46
+ appraise "rails_5_0_and_airbrake_4" do
47
+ gem 'activesupport', ">= 5.0.0.beta1", "<= 5.1"
48
+ gem 'airbrake', "~> 4.0"
11
49
  end
@@ -1,8 +1,46 @@
1
- ### Changelog
1
+ # Change Log
2
+ All notable changes to this project will be documented in this file.
3
+ This project adheres to [Semantic Versioning](http://semver.org/).
2
4
 
3
5
 
4
- - **0.0.2**
5
- - Allow `airbrake` `4.*` to be used (It only removes JS notifier)
6
+ ## [Unreleased]
6
7
 
7
- - **0.0.1**
8
- - Initial Release
8
+ ### Added
9
+
10
+ - Nothing
11
+
12
+ ### Changed
13
+
14
+ - Nothing
15
+
16
+ ### Fixed
17
+
18
+ - Nothing
19
+
20
+
21
+ ## [0.0.3]
22
+
23
+ ### Fixed
24
+
25
+ - Fix one of version constraints for gem `airbrake` fixed from `<= 5` to `< 5`
26
+ Also test against all supported major versions of `airbrake`
27
+
28
+
29
+ ## [0.0.2] - 2014-06-03
30
+
31
+ ### Changed
32
+
33
+ - Allow `airbrake` `4.*` to be used (It only removes JS notifier)
34
+
35
+
36
+ ## [0.0.1] - 2014-03-27
37
+
38
+ ### Added
39
+
40
+ - Initial Release
41
+
42
+
43
+ [Unreleased]: https://github.com/PikachuEXE/execute_with_rescue_with_airbrake/compare/v0.0.3...HEAD
44
+ [0.0.3]: https://github.com/PikachuEXE/execute_with_rescue_with_airbrake/compare/v0.0.2...v0.0.3
45
+ [0.0.2]: https://github.com/PikachuEXE/execute_with_rescue_with_airbrake/compare/v0.0.1...v0.0.2
46
+ [0.0.1]: https://github.com/PikachuEXE/execute_with_rescue_with_airbrake/releases/tag/v0.0.1
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source 'https://rubygems.org'
1
+ source "https://rubygems.org"
2
2
 
3
- # Specify your gem's dependencies in execute_with_rescue_with_airbrake.gemspec
3
+ # Specify your gem"s dependencies in execute_with_rescue_with_airbrake.gemspec
4
4
  gemspec
data/README.md CHANGED
@@ -2,16 +2,13 @@
2
2
 
3
3
  The Airbrake adapter plus mixin to be used with `execute_with_rescue`.
4
4
 
5
- ## Support
6
- Tested against:
7
- - Active Support of version `3.2`, `4.0` and `4.1` (pre-3.2 got wrong dependency & I don't want to support)
8
- - MRI `1.9.3`, `2.0.0`, `2.1.0`, `2.1.1`
9
-
10
- [![Build Status](http://img.shields.io/travis/PikachuEXE/execute_with_rescue_with_airbrake.svg)](https://travis-ci.org/PikachuEXE/execute_with_rescue_with_airbrake)
11
- [![Gem Version](http://img.shields.io/gem/v/execute_with_rescue_with_airbrake.svg)](http://badge.fury.io/rb/execute_with_rescue_with_airbrake)
12
- [![Dependency Status](http://img.shields.io/gemnasium/PikachuEXE/execute_with_rescue_with_airbrake.svg)](https://gemnasium.com/PikachuEXE/execute_with_rescue_with_airbrake)
13
- [![Coverage Status](http://img.shields.io/coveralls/PikachuEXE/execute_with_rescue_with_airbrake.svg)](https://coveralls.io/r/PikachuEXE/execute_with_rescue_with_airbrake)
14
- [![Code Climate](http://img.shields.io/codeclimate/github/PikachuEXE/execute_with_rescue_with_airbrake.svg)](https://codeclimate.com/github/PikachuEXE/execute_with_rescue_with_airbrake)
5
+ ## Status
6
+
7
+ [![Build Status](http://img.shields.io/travis/PikachuEXE/execute_with_rescue_with_airbrake.svg?style=flat-square)](https://travis-ci.org/PikachuEXE/execute_with_rescue_with_airbrake)
8
+ [![Gem Version](http://img.shields.io/gem/v/execute_with_rescue_with_airbrake.svg?style=flat-square)](http://badge.fury.io/rb/execute_with_rescue_with_airbrake)
9
+ [![Dependency Status](http://img.shields.io/gemnasium/PikachuEXE/execute_with_rescue_with_airbrake.svg?style=flat-square)](https://gemnasium.com/PikachuEXE/execute_with_rescue_with_airbrake)
10
+ [![Coverage Status](http://img.shields.io/coveralls/PikachuEXE/execute_with_rescue_with_airbrake.svg?style=flat-square)](https://coveralls.io/r/PikachuEXE/execute_with_rescue_with_airbrake)
11
+ [![Code Climate](http://img.shields.io/codeclimate/github/PikachuEXE/execute_with_rescue_with_airbrake.svg?style=flat-square)](https://codeclimate.com/github/PikachuEXE/execute_with_rescue_with_airbrake)
15
12
 
16
13
  ## Installation
17
14
 
data/Rakefile CHANGED
@@ -1,16 +1,18 @@
1
- require "bundler/gem_tasks"
2
- require "rubygems"
3
- require "bundler/setup"
4
-
5
- require "rspec/core/rake_task"
6
1
  require "appraisal"
2
+ require "bundler"
3
+ require "rspec/core/rake_task"
4
+ require "rubocop/rake_task"
5
+
6
+ Bundler::GemHelper.install_tasks
7
7
 
8
8
  RSpec::Core::RakeTask.new(:spec)
9
9
 
10
+ RuboCop::RakeTask.new(:rubocop)
11
+
10
12
  if !ENV["APPRAISAL_INITIALIZED"] && !ENV["TRAVIS"]
11
13
  task :default do
12
- sh "appraisal install && rake appraisal spec"
14
+ sh "appraisal install && rake appraisal spec rubocop"
13
15
  end
14
16
  else
15
- task :default => :spec
17
+ task default: [:spec, :rubocop]
16
18
  end
@@ -1,14 +1,16 @@
1
1
  # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
2
+ lib = File.expand_path("../lib", __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'execute_with_rescue_with_airbrake/version'
4
+ require "execute_with_rescue_with_airbrake/version"
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "execute_with_rescue_with_airbrake"
8
8
  spec.version = ExecuteWithRescueWithAirbrake::VERSION
9
9
  spec.authors = ["PikachuEXE"]
10
10
  spec.email = ["pikachuexe@gmail.com"]
11
- spec.summary = %q{The Airbrake adapter plus mixin to be used with `execute_with_rescue`}
11
+ spec.summary = <<-SUMMARY
12
+ The Airbrake adapter plus mixin to be used with `execute_with_rescue`
13
+ SUMMARY
12
14
  spec.homepage = "http://github.com/PikachuEXE/execute_with_rescue_with_airbrake"
13
15
  spec.license = "MIT"
14
16
 
@@ -18,15 +20,16 @@ Gem::Specification.new do |spec|
18
20
  spec.require_paths = ["lib"]
19
21
 
20
22
  spec.add_dependency "execute_with_rescue", "~> 0.0", ">= 0.0.1"
21
- spec.add_dependency "airbrake", ">= 3.1", "<= 5"
23
+ spec.add_dependency "airbrake", ">= 3.1", "< 5"
22
24
 
23
25
  spec.add_development_dependency "bundler", "~> 1.5"
24
26
  spec.add_development_dependency "rake"
25
- spec.add_development_dependency "appraisal", "~> 1.0"
27
+ spec.add_development_dependency "appraisal", "~> 2.0"
26
28
  spec.add_development_dependency "rspec", "~> 3.0"
27
29
  spec.add_development_dependency "rspec-its", "~> 1.0"
28
30
  spec.add_development_dependency "coveralls", ">= 0.7"
29
31
  spec.add_development_dependency "gem-release", ">= 0.7"
32
+ spec.add_development_dependency "rubocop", "~> 0.30"
30
33
 
31
34
  spec.required_ruby_version = ">= 1.9.3"
32
35
 
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "activesupport", "~> 3.2.20"
6
+ gem "airbrake", "~> 3.1"
7
+
8
+ gemspec :path => "../"
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "activesupport", "~> 3.2.20"
6
+ gem "airbrake", "~> 4.0"
7
+
8
+ gemspec :path => "../"
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "activesupport", "~> 4.0.12"
6
+ gem "airbrake", "~> 3.1"
7
+
8
+ gemspec :path => "../"
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "activesupport", "~> 4.0.12"
6
+ gem "airbrake", "~> 4.0"
7
+
8
+ gemspec :path => "../"
@@ -2,6 +2,7 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "activesupport", "3.2.18"
5
+ gem "activesupport", "~> 4.1.8"
6
+ gem "airbrake", "~> 3.1"
6
7
 
7
8
  gemspec :path => "../"
@@ -2,6 +2,7 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "activesupport", "4.0.5"
5
+ gem "activesupport", "~> 4.1.8"
6
+ gem "airbrake", "~> 4.0"
6
7
 
7
8
  gemspec :path => "../"
@@ -2,6 +2,7 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "activesupport", "4.1.1"
5
+ gem "activesupport", "~> 4.2.0"
6
+ gem "airbrake", "~> 3.1"
6
7
 
7
8
  gemspec :path => "../"
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "activesupport", "~> 4.2.0"
6
+ gem "airbrake", "~> 4.0"
7
+
8
+ gemspec :path => "../"
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "activesupport", ">= 5.0.0.beta1", "<= 5.1"
6
+ gem "airbrake", "~> 3.1"
7
+
8
+ gemspec :path => "../"
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "activesupport", ">= 5.0.0.beta1", "<= 5.1"
6
+ gem "airbrake", "~> 4.0"
7
+
8
+ gemspec :path => "../"
@@ -1,10 +1,10 @@
1
- require 'airbrake'
2
- require 'active_support/concern'
3
- require 'active_support/core_ext/module/delegation'
1
+ require "airbrake"
2
+ require "active_support/concern"
3
+ require "active_support/core_ext/module/delegation"
4
4
 
5
- require 'execute_with_rescue'
6
- require 'execute_with_rescue/errors/no_airbrake_adapter'
7
- require 'execute_with_rescue_with_airbrake/adapters/airbrake_adapter'
5
+ require "execute_with_rescue"
6
+ require "execute_with_rescue/errors/no_airbrake_adapter"
7
+ require "execute_with_rescue_with_airbrake/adapters/airbrake_adapter"
8
8
 
9
9
  module ExecuteWithRescue
10
10
  module Mixins
@@ -15,20 +15,24 @@ module ExecuteWithRescue
15
15
  include ExecuteWithRescue::Mixins::Core
16
16
 
17
17
  add_execute_with_rescue_before_hook do
18
- _execute_with_rescue_airbrake_adapters
19
- .push(ExecuteWithRescueWithAirbrake::Adapters::AirbrakeAdapter.new)
18
+ _execute_with_rescue_airbrake_adapters.
19
+ push(ExecuteWithRescueWithAirbrake::Adapters::AirbrakeAdapter.new)
20
20
  end
21
21
  add_execute_with_rescue_after_hook do
22
22
  _execute_with_rescue_airbrake_adapters.pop
23
23
  end
24
24
 
25
- rescue_from StandardError,
26
- with: :notify_by_airbrake_or_raise
25
+ rescue_from(
26
+ StandardError,
27
+ with: :notify_by_airbrake_or_raise,
28
+ )
27
29
 
28
- delegate :set_default_airbrake_notice_error_class,
29
- :set_default_airbrake_notice_error_message,
30
- :add_default_airbrake_notice_parameters,
31
- to: :_execute_with_rescue_current_airbrake_adapter
30
+ delegate(
31
+ :set_default_airbrake_notice_error_class,
32
+ :set_default_airbrake_notice_error_message,
33
+ :add_default_airbrake_notice_parameters,
34
+ to: :_execute_with_rescue_current_airbrake_adapter,
35
+ )
32
36
  end
33
37
 
34
38
  # Call this if you have some custom handling for some classes
@@ -49,17 +53,18 @@ module ExecuteWithRescue
49
53
  # end
50
54
  # end
51
55
  def notify_by_airbrake_or_raise(ex)
52
- _execute_with_rescue_current_airbrake_adapter
53
- .notify_or_raise(ex)
56
+ _execute_with_rescue_current_airbrake_adapter.
57
+ notify_or_raise(ex)
54
58
  end
55
59
 
56
60
  # For pushing and popping the adapters
57
61
  def _execute_with_rescue_airbrake_adapters
58
62
  @_execute_with_rescue_airbrake_adapters ||= []
59
63
  end
64
+
60
65
  def _execute_with_rescue_current_airbrake_adapter
61
66
  _execute_with_rescue_airbrake_adapters.last ||
62
- (raise ExecuteWithRescue::Errors::NoAirbrakeAdapter)
67
+ fail(ExecuteWithRescue::Errors::NoAirbrakeAdapter)
63
68
  end
64
69
  end
65
70
  end
@@ -1,7 +1,6 @@
1
- require 'execute_with_rescue_with_airbrake/version'
2
- require 'execute_with_rescue'
3
- require 'execute_with_rescue/mixins/with_airbrake'
4
-
1
+ require "execute_with_rescue_with_airbrake/version"
2
+ require "execute_with_rescue"
3
+ require "execute_with_rescue/mixins/with_airbrake"
5
4
 
6
5
  module ExecuteWithRescueWithAirbrake
7
6
  end
@@ -1,4 +1,4 @@
1
- require 'active_support/core_ext/hash/indifferent_access'
1
+ require "active_support/core_ext/hash/indifferent_access"
2
2
 
3
3
  module ExecuteWithRescueWithAirbrake
4
4
  module Adapters
@@ -19,15 +19,14 @@ module ExecuteWithRescueWithAirbrake
19
19
  # @see should_raise?
20
20
  def notify_or_raise(ex)
21
21
  if should_raise?
22
- raise ex
22
+ fail ex
23
23
  else
24
24
  notify_or_ignore_with_options(ex)
25
25
  end
26
26
  end
27
27
 
28
-
29
28
  # set the default `error_class` option when notify by Airbrake
30
- # It must can be init without argument, this method won't check it
29
+ # It must can be init without argument, this method won"t check it
31
30
  # Pass nil to clear it
32
31
  #
33
32
  # @param message [NilClass, Class]
@@ -35,7 +34,7 @@ module ExecuteWithRescueWithAirbrake
35
34
  #
36
35
  # @raise [ArgumentError] when class is not nil or symbol
37
36
  def set_default_airbrake_notice_error_class(klass)
38
- (klass.nil? || klass.is_a?(Class)) or raise ArgumentError
37
+ (klass.nil? || klass.is_a?(Class)) || fail(ArgumentError)
39
38
 
40
39
  @default_airbrake_notice_error_class = klass
41
40
  end
@@ -48,7 +47,7 @@ module ExecuteWithRescueWithAirbrake
48
47
  #
49
48
  # @raise [ArgumentError] when message is not nil or string
50
49
  def set_default_airbrake_notice_error_message(message)
51
- (message.nil? || message.is_a?(String)) or raise ArgumentError
50
+ (message.nil? || message.is_a?(String)) || fail(ArgumentError)
52
51
 
53
52
  @default_airbrake_notice_error_message = message
54
53
  end
@@ -64,18 +63,16 @@ module ExecuteWithRescueWithAirbrake
64
63
  # @raise [ParameterKeyConflict]
65
64
  # when new_params contains keys conflicting with existing keys
66
65
  def add_default_airbrake_notice_parameters(new_params)
67
- new_params.is_a?(Hash) or
68
- (raise Errors::InvalidParameters)
69
- new_params =
70
- new_params.with_indifferent_access
66
+ new_params.is_a?(Hash) || fail(Errors::InvalidParameters)
67
+ new_params = new_params.with_indifferent_access
71
68
 
72
69
  # find out common element size (which should be 0)
73
- common_keys =
74
- default_airbrake_notice_parameters.keys &
75
- new_params.keys
70
+ common_keys = default_airbrake_notice_parameters.keys & new_params.keys
76
71
  if common_keys.size > 0
77
- raise Errors::ParameterKeyConflict,
78
- "Conflicting keys: #{common_keys.inspect}"
72
+ fail(
73
+ Errors::ParameterKeyConflict,
74
+ "Conflicting keys: #{common_keys.inspect}",
75
+ )
79
76
  end
80
77
 
81
78
  default_airbrake_notice_parameters.merge!(new_params)
@@ -88,22 +85,16 @@ module ExecuteWithRescueWithAirbrake
88
85
  end
89
86
 
90
87
  def build_notice_options
91
- result_options_hash = Hash.new
88
+ h = {}
92
89
 
93
- if @default_airbrake_notice_error_class
94
- result_options_hash[:error_class] =
95
- @default_airbrake_notice_error_class
96
- end
97
- if @default_airbrake_notice_error_message
98
- result_options_hash[:error_message] =
99
- @default_airbrake_notice_error_message
100
- end
101
- unless default_airbrake_notice_parameters.empty?
102
- result_options_hash[:parameters] =
103
- default_airbrake_notice_parameters.symbolize_keys
104
- end
90
+ @default_airbrake_notice_error_class &&
91
+ h[:error_class] = @default_airbrake_notice_error_class
92
+ @default_airbrake_notice_error_message &&
93
+ h[:error_message] = @default_airbrake_notice_error_message
94
+ !default_airbrake_notice_parameters.empty? &&
95
+ h[:parameters] = default_airbrake_notice_parameters.symbolize_keys
105
96
 
106
- result_options_hash
97
+ h
107
98
  end
108
99
 
109
100
  def default_airbrake_notice_parameters