exception_handling 2.4.1 → 2.4.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 59c756149958cc585d26d470b83d28eae00adf19c3d7e6a5ac0e19ea28e301bb
4
- data.tar.gz: 374842c72bdb92b8e4e311aca9c9021016c907fc1b9bc1679c89fb0a4932bce8
3
+ metadata.gz: 55e89ccca99bfdef126c57f9674d62d90d2048405099e83467ddc2997ffb3526
4
+ data.tar.gz: f7fae0d722026d38af12400a95812a14e2a7f32e7d79cbae90b3bd332a30fc04
5
5
  SHA512:
6
- metadata.gz: 378b6795aa9d7c3819bc9890467f2318e17414d34ddfd28ab7a1c6e91ee6ac74c8fd22a429c7ea29cec928a4ba9ac5489451bd24533ef1b0da6b1b533b3dc5d9
7
- data.tar.gz: 051a52b1b5a43a6e38ebfb6f6a1f293d0e35846dea8741f0c392a7fe22adc16b4f5692eabad4ec4b685e70047f2e82eb28cca3bb417fc8bf7357fbd8b723ffdf
6
+ metadata.gz: 509366eaf0081abe570f51d1ff09707a1ff880e94870616b850b5af000bc489d304bf222452799ff5f9848190247a3c526feb2ac4e3a62057dd04a3558e585eb
7
+ data.tar.gz: 7b26674dbf9862b43ba7b63650b1a9bc637d3b360d28b469e8d5ec231d3db7af7c4d12030e5e93653c1b1d2c2b84c47189a269472ce8c9dc6b370a5ee43cd3cb
data/.gitignore CHANGED
@@ -2,3 +2,4 @@
2
2
  .DS_Store
3
3
  .rubocop-http*
4
4
  test/reports/*
5
+ gemfiles/*.lock
@@ -19,6 +19,7 @@ pipeline {
19
19
  stage('Setup') {
20
20
  steps {
21
21
  script {
22
+ updateGitHubStatus('clean-build', 'pending', 'Unit tests.')
22
23
  sh '''
23
24
  # get SSH setup inside the container
24
25
  eval `ssh-agent -s`
@@ -27,18 +28,55 @@ pipeline {
27
28
  ssh-keyscan -t rsa github.com > /root/.ssh/known_hosts
28
29
 
29
30
  bundle install
31
+ bundle exec appraisal install
30
32
  '''
31
33
  }
32
34
  }
33
35
  }
34
- stage('Unit Test') {
35
- steps {
36
- script {
37
- sh 'bundle exec rake'
36
+ stage('Appraisals') {
37
+ parallel {
38
+ stage('Current') {
39
+ steps {
40
+ sh 'JUNIT_OUTPUT_DIR=test/reports/current bundle exec rake'
41
+ }
42
+
43
+ post {
44
+ always { junit '*/reports/current/*.xml' }
45
+ }
46
+ }
47
+
48
+ stage('Rails 4') {
49
+ steps {
50
+ sh 'JUNIT_OUTPUT_DIR=test/reports/rails-4 bundle exec appraisal rails-4 rake'
51
+ }
52
+
53
+ post {
54
+ always { junit '*/reports/rails-4/*.xml' }
55
+ }
56
+ }
57
+
58
+ stage('Rails 5') {
59
+ steps {
60
+ sh 'JUNIT_OUTPUT_DIR=test/reports/rails-5 bundle exec appraisal rails-5 rake'
61
+ }
62
+
63
+ post {
64
+ always { junit '*/reports/rails-5/*.xml' }
65
+ }
66
+ }
67
+
68
+ stage('Rails 6') {
69
+ steps {
70
+ sh 'JUNIT_OUTPUT_DIR=test/reports/rails-6 bundle exec appraisal rails-6 rake'
71
+ }
72
+
73
+ post {
74
+ always { junit '*/reports/rails-6/*.xml' }
75
+ }
38
76
  }
39
77
  }
78
+
40
79
  post {
41
- always { junit '*/reports/*.xml' }
42
80
  success { updateGitHubStatus('clean-build', 'success', 'Unit tests.') }
43
81
  failure { updateGitHubStatus('clean-build', 'failure', 'Unit tests.') }
44
82
  }
@@ -52,7 +90,7 @@ void updateGitHubStatus(String context, String status, String description) {
52
90
  sha: env.GIT_COMMIT,
53
91
  description: description,
54
92
  context: context,
55
- targetURL: env.BUILD_URL,
93
+ targetURL: env.RUN_DISPLAY_URL,
56
94
  token: env.GITHUB_TOKEN,
57
95
  status: status
58
96
  ])
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ appraise "rails-4" do
4
+ gem 'actionmailer', '~> 4.2'
5
+ gem 'actionpack', '~> 4.2'
6
+ gem 'activesupport', '~> 4.2'
7
+ end
8
+
9
+ appraise "rails-5" do
10
+ gem 'actionmailer', '~> 5.0'
11
+ gem 'actionpack', '~> 5.0'
12
+ gem 'activesupport', '~> 5.0'
13
+ end
14
+
15
+ appraise "rails-6" do
16
+ gem 'actionmailer', '~> 6.0'
17
+ gem 'actionpack', '~> 6.0'
18
+ gem 'activesupport', '~> 6.0'
19
+ end
@@ -4,8 +4,18 @@ Inspired by [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
4
4
 
5
5
  Note: this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [2.4.2] - 2020-05-11
8
+ ### Added
9
+ - Added support for rails 5 and 6.
10
+ - Added appraisal tests for all supported rails version: 4/5/6
11
+
12
+ ### Changed
13
+ - Updated various test to be compatible with rails version 4/5/6
14
+ - Updated the CI pipeline to test against all three supported versions of rails
15
+
7
16
  ## [2.4.1] - 2020-04-29
8
17
  ### Changed
9
18
  - No longer depends on hobo_support. Uses invoca-utils 0.3 instead.
10
19
 
20
+ [2.4.2]: https://github.com/Invoca/exception_handling/compare/v2.4.1...v2.4.2
11
21
  [2.4.1]: https://github.com/Invoca/exception_handling/compare/v2.4.0...v2.4.1
data/Gemfile CHANGED
@@ -4,6 +4,7 @@ source 'https://rubygems.org'
4
4
 
5
5
  gemspec
6
6
 
7
+ gem 'appraisal', '~> 2.2'
7
8
  gem 'honeybadger', '3.3.1-1', git: 'git@github.com:Invoca/honeybadger-ruby', ref: 'bb5f2b8a86e4147c38a6270d39ad610fab4dd5e6'
8
9
  gem "minitest"
9
10
  gem "minitest-reporters"
@@ -8,10 +8,10 @@ GIT
8
8
  PATH
9
9
  remote: .
10
10
  specs:
11
- exception_handling (2.4.1)
12
- actionmailer (~> 4.2)
13
- actionpack (~> 4.2)
14
- activesupport (~> 4.2)
11
+ exception_handling (2.4.2)
12
+ actionmailer (>= 4.2, < 7.0)
13
+ actionpack (>= 4.2, < 7.0)
14
+ activesupport (>= 4.2, < 7.0)
15
15
  contextual_logger
16
16
  eventmachine (~> 1.0)
17
17
  invoca-utils (~> 0.3)
@@ -47,6 +47,10 @@ GEM
47
47
  thread_safe (~> 0.3, >= 0.3.4)
48
48
  tzinfo (~> 1.1)
49
49
  ansi (1.5.0)
50
+ appraisal (2.2.0)
51
+ bundler
52
+ rake
53
+ thor (>= 0.14.0)
50
54
  ast (2.4.0)
51
55
  builder (3.2.3)
52
56
  coderay (1.1.2)
@@ -64,13 +68,13 @@ GEM
64
68
  invoca-utils (0.3.0)
65
69
  jaro_winkler (1.5.3)
66
70
  json (2.3.0)
67
- loofah (2.4.0)
71
+ loofah (2.5.0)
68
72
  crass (~> 1.0.2)
69
73
  nokogiri (>= 1.5.9)
70
74
  mail (2.7.1)
71
75
  mini_mime (>= 0.1.1)
72
76
  method_source (0.9.2)
73
- mini_mime (1.0.1)
77
+ mini_mime (1.0.2)
74
78
  mini_portile2 (2.4.0)
75
79
  minitest (5.11.3)
76
80
  minitest-reporters (1.0.20)
@@ -86,7 +90,7 @@ GEM
86
90
  pry (0.12.2)
87
91
  coderay (~> 1.1.0)
88
92
  method_source (~> 0.9.0)
89
- rack (1.6.12)
93
+ rack (1.6.13)
90
94
  rack-test (0.6.3)
91
95
  rack (>= 1.0)
92
96
  rails-deprecated_sanitizer (1.0.3)
@@ -95,8 +99,8 @@ GEM
95
99
  activesupport (>= 4.2.0, < 5.0)
96
100
  nokogiri (~> 1.6)
97
101
  rails-deprecated_sanitizer (>= 1.0.1)
98
- rails-html-sanitizer (1.0.4)
99
- loofah (~> 2.2, >= 2.2.2)
102
+ rails-html-sanitizer (1.3.0)
103
+ loofah (~> 2.3)
100
104
  rainbow (3.0.0)
101
105
  rake (13.0.1)
102
106
  rr (1.2.1)
@@ -114,6 +118,7 @@ GEM
114
118
  shoulda-context (1.2.2)
115
119
  shoulda-matchers (3.1.3)
116
120
  activesupport (>= 4.0.0)
121
+ thor (1.0.1)
117
122
  thread_safe (0.3.6)
118
123
  tzinfo (1.2.5)
119
124
  thread_safe (~> 0.1)
@@ -123,6 +128,7 @@ PLATFORMS
123
128
  ruby
124
129
 
125
130
  DEPENDENCIES
131
+ appraisal (~> 2.2)
126
132
  exception_handling!
127
133
  honeybadger (= 3.3.1.pre.1)!
128
134
  minitest
data/README.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  Enable emails for your exceptions that occur in your application!
4
4
 
5
+ ## Dependencies
6
+ - Ruby 2.6
7
+ - Rails >= 4, < 7
8
+
5
9
  ## Installation
6
10
 
7
11
  Add this line to your application's Gemfile:
@@ -89,15 +93,15 @@ There is another hook available intended for custom actions after an error email
89
93
  else
90
94
  Invoca::Metrics::Client.metrics.counter("exception_handling/exception")
91
95
  end
92
-
96
+
93
97
  case honeybadger_status
94
98
  when :success
95
99
  Invoca::Metrics::Client.metrics.counter("exception_handling.honeybadger.success")
96
- when :failure
100
+ when :failure
97
101
  Invoca::Metrics::Client.metrics.counter("exception_handling.honeybadger.failure")
98
102
  when :skipped
99
103
  Invoca::Metrics::Client.metrics.counter("exception_handling.honeybadger.skipped")
100
- end
104
+ end
101
105
  end
102
106
  ExceptionHandling.post_log_error_hook = method(:log_error_metrics)
103
107
 
@@ -20,9 +20,9 @@ Gem::Specification.new do |spec|
20
20
  "allowed_push_host" => "https://rubygems.org"
21
21
  }
22
22
 
23
- spec.add_dependency 'actionmailer', '~> 4.2'
24
- spec.add_dependency 'actionpack', '~> 4.2'
25
- spec.add_dependency 'activesupport', '~> 4.2'
23
+ spec.add_dependency 'actionmailer', '>= 4.2', '< 7.0'
24
+ spec.add_dependency 'actionpack', '>= 4.2', '< 7.0'
25
+ spec.add_dependency 'activesupport', '>= 4.2', '< 7.0'
26
26
  spec.add_dependency 'contextual_logger'
27
27
  spec.add_dependency 'eventmachine', '~> 1.0'
28
28
  spec.add_dependency 'invoca-utils', '~> 0.3'
@@ -0,0 +1,2 @@
1
+ ---
2
+ BUNDLE_RETRY: "1"
@@ -0,0 +1,18 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "appraisal", "~> 2.2"
6
+ gem "honeybadger", "3.3.1-1", git: "git@github.com:Invoca/honeybadger-ruby", ref: "bb5f2b8a86e4147c38a6270d39ad610fab4dd5e6"
7
+ gem "minitest"
8
+ gem "minitest-reporters"
9
+ gem "pry"
10
+ gem "rake"
11
+ gem "rr"
12
+ gem "rubocop"
13
+ gem "shoulda"
14
+ gem "actionmailer", "~> 4.2"
15
+ gem "actionpack", "~> 4.2"
16
+ gem "activesupport", "~> 4.2"
17
+
18
+ gemspec path: "../"
@@ -0,0 +1,18 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "appraisal", "~> 2.2"
6
+ gem "honeybadger", "3.3.1-1", git: "git@github.com:Invoca/honeybadger-ruby", ref: "bb5f2b8a86e4147c38a6270d39ad610fab4dd5e6"
7
+ gem "minitest"
8
+ gem "minitest-reporters"
9
+ gem "pry"
10
+ gem "rake"
11
+ gem "rr"
12
+ gem "rubocop"
13
+ gem "shoulda"
14
+ gem "actionmailer", "~> 5.0"
15
+ gem "actionpack", "~> 5.0"
16
+ gem "activesupport", "~> 5.0"
17
+
18
+ gemspec path: "../"
@@ -0,0 +1,18 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "appraisal", "~> 2.2"
6
+ gem "honeybadger", "3.3.1-1", git: "git@github.com:Invoca/honeybadger-ruby", ref: "bb5f2b8a86e4147c38a6270d39ad610fab4dd5e6"
7
+ gem "minitest"
8
+ gem "minitest-reporters"
9
+ gem "pry"
10
+ gem "rake"
11
+ gem "rr"
12
+ gem "rubocop"
13
+ gem "shoulda"
14
+ gem "actionmailer", "~> 6.0"
15
+ gem "actionpack", "~> 6.0"
16
+ gem "activesupport", "~> 6.0"
17
+
18
+ gemspec path: "../"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ExceptionHandling
4
- VERSION = '2.4.1'
4
+ VERSION = '2.4.2'
5
5
  end
@@ -9,7 +9,9 @@ require 'shoulda'
9
9
  require 'rr'
10
10
  require 'minitest/autorun'
11
11
  require "minitest/reporters"
12
- Minitest::Reporters.use! [Minitest::Reporters::DefaultReporter.new, Minitest::Reporters::JUnitReporter.new]
12
+
13
+ junit_ouptut_dir = ENV["JUNIT_OUTPUT_DIR"].presence || "test/reports"
14
+ Minitest::Reporters.use!([Minitest::Reporters::DefaultReporter.new, Minitest::Reporters::JUnitReporter.new(junit_ouptut_dir)])
13
15
 
14
16
  require 'pry'
15
17
  require 'honeybadger'
@@ -52,7 +52,7 @@ module ExceptionHandling
52
52
  setup do
53
53
  @filename = File.expand_path('../../../config/exception_filters.yml', __dir__)
54
54
  @exception_catalog = ExceptionCatalog.new(@filename)
55
- assert_nothing_raised "Loading the exception filter should not raise" do
55
+ assert_nothing_raised do
56
56
  @exception_catalog.send :load_file
57
57
  end
58
58
  end
@@ -306,9 +306,24 @@ class ExceptionHandlingTest < ActiveSupport::TestCase
306
306
  ExceptionHandling.ensure_safe { raise ArgumentError, "blah" }
307
307
  end
308
308
 
309
- should "log an exception with call stack if an ActionView template exception is raised." do
310
- mock(ExceptionHandling.logger).fatal(/\(Error:\d+\) ActionView::Template::Error \(blah\):\n /, anything)
311
- ExceptionHandling.ensure_safe { raise ActionView::TemplateError.new({}, ArgumentError.new("blah")) }
309
+ if ActionView::VERSION::MAJOR >= 5
310
+ should "log an exception with call stack if an ActionView template exception is raised." do
311
+ mock(ExceptionHandling.logger).fatal(/\(Error:\d+\) ActionView::Template::Error \(blah\):\n /, anything)
312
+ ExceptionHandling.ensure_safe do
313
+ begin
314
+ # Rails 5 made the switch from ActionView::TemplateError taking in the original exception
315
+ # as an argument to using the $! global to extract the original exception
316
+ raise ArgumentError, "blah"
317
+ rescue
318
+ raise ActionView::TemplateError.new({})
319
+ end
320
+ end
321
+ end
322
+ else
323
+ should "log an exception with call stack if an ActionView template exception is raised." do
324
+ mock(ExceptionHandling.logger).fatal(/\(Error:\d+\) ActionView::Template::Error \(blah\):\n /, anything)
325
+ ExceptionHandling.ensure_safe { raise ActionView::TemplateError.new({}, ArgumentError.new("blah")) }
326
+ end
312
327
  end
313
328
 
314
329
  should "should not log an exception if an exception is not raised." do
metadata CHANGED
@@ -1,57 +1,75 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: exception_handling
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.1
4
+ version: 2.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Invoca
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-29 00:00:00.000000000 Z
11
+ date: 2020-05-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionmailer
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '4.2'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '7.0'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - "~>"
27
+ - - ">="
25
28
  - !ruby/object:Gem::Version
26
29
  version: '4.2'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '7.0'
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: actionpack
29
35
  requirement: !ruby/object:Gem::Requirement
30
36
  requirements:
31
- - - "~>"
37
+ - - ">="
32
38
  - !ruby/object:Gem::Version
33
39
  version: '4.2'
40
+ - - "<"
41
+ - !ruby/object:Gem::Version
42
+ version: '7.0'
34
43
  type: :runtime
35
44
  prerelease: false
36
45
  version_requirements: !ruby/object:Gem::Requirement
37
46
  requirements:
38
- - - "~>"
47
+ - - ">="
39
48
  - !ruby/object:Gem::Version
40
49
  version: '4.2'
50
+ - - "<"
51
+ - !ruby/object:Gem::Version
52
+ version: '7.0'
41
53
  - !ruby/object:Gem::Dependency
42
54
  name: activesupport
43
55
  requirement: !ruby/object:Gem::Requirement
44
56
  requirements:
45
- - - "~>"
57
+ - - ">="
46
58
  - !ruby/object:Gem::Version
47
59
  version: '4.2'
60
+ - - "<"
61
+ - !ruby/object:Gem::Version
62
+ version: '7.0'
48
63
  type: :runtime
49
64
  prerelease: false
50
65
  version_requirements: !ruby/object:Gem::Requirement
51
66
  requirements:
52
- - - "~>"
67
+ - - ">="
53
68
  - !ruby/object:Gem::Version
54
69
  version: '4.2'
70
+ - - "<"
71
+ - !ruby/object:Gem::Version
72
+ version: '7.0'
55
73
  - !ruby/object:Gem::Dependency
56
74
  name: contextual_logger
57
75
  requirement: !ruby/object:Gem::Requirement
@@ -106,6 +124,7 @@ files:
106
124
  - ".jenkins/ruby_build_pod.yml"
107
125
  - ".rubocop.yml"
108
126
  - ".ruby-version"
127
+ - Appraisals
109
128
  - CHANGELOG.md
110
129
  - Gemfile
111
130
  - Gemfile.lock
@@ -114,6 +133,10 @@ files:
114
133
  - Rakefile
115
134
  - config/exception_filters.yml
116
135
  - exception_handling.gemspec
136
+ - gemfiles/.bundle/config
137
+ - gemfiles/rails_4.gemfile
138
+ - gemfiles/rails_5.gemfile
139
+ - gemfiles/rails_6.gemfile
117
140
  - lib/exception_handling.rb
118
141
  - lib/exception_handling/exception_catalog.rb
119
142
  - lib/exception_handling/exception_description.rb