openstax_rescue_from 3.0.0 → 4.2.0
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 +5 -5
- data/.github/workflows/tests.yml +25 -0
- data/.gitignore +12 -9
- data/README.md +1 -1
- data/bin/rake +29 -0
- data/bin/rspec +29 -0
- data/lib/generators/openstax/rescue_from/install/templates/rescue_from.rb +0 -4
- data/lib/openstax/rescue_from.rb +6 -4
- data/lib/openstax/rescue_from/default_exceptions.rb +1 -1
- data/lib/openstax/rescue_from/exception_proxy.rb +2 -2
- data/lib/openstax/rescue_from/version.rb +1 -1
- data/openstax_rescue_from.gemspec +3 -2
- metadata +23 -9
- data/.ruby-version +0 -1
- data/.travis.yml +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 49e68482033617f84c412cfa7eaf6862802ad0640fc85748c31098e8ac77d218
|
4
|
+
data.tar.gz: 85ca040056862e85aabde3a828012ad25288afa8833ecfe825b5ae9621ebb021
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 70ce04255694b38696755f834fa3a5d01d04e5a28751ba76c8d72423a08b12cd01ee4c3f4594bde736ddbf0d225ab022dbf6700d0f12b8882c516d0d65115725
|
7
|
+
data.tar.gz: 9f7b974e65aad7b2733814c4e4bd269251d0c3d966c701d884be8d2eda6f8f195204268d914272f95704e8d53e84461d5a82bbd5474ef226a26e37ef5b57463e
|
@@ -0,0 +1,25 @@
|
|
1
|
+
name: Tests
|
2
|
+
on:
|
3
|
+
pull_request:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- main
|
7
|
+
jobs:
|
8
|
+
tests:
|
9
|
+
timeout-minutes: 30
|
10
|
+
runs-on: ubuntu-18.04
|
11
|
+
steps:
|
12
|
+
- uses: actions/checkout@v2
|
13
|
+
- uses: actions/setup-ruby@v1
|
14
|
+
with:
|
15
|
+
ruby-version: 2.6
|
16
|
+
- uses: actions/cache@v2
|
17
|
+
with:
|
18
|
+
path: vendor/bundle
|
19
|
+
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
|
20
|
+
restore-keys: |
|
21
|
+
${{ runner.os }}-gems-
|
22
|
+
- name: Setup
|
23
|
+
run: bundle install
|
24
|
+
- name: Test
|
25
|
+
run: bundle exec rake spec
|
data/.gitignore
CHANGED
@@ -1,13 +1,16 @@
|
|
1
|
-
.bundle
|
2
|
-
|
1
|
+
.bundle/
|
2
|
+
log/*.log
|
3
|
+
pkg/
|
4
|
+
spec/dummy/db/*.sqlite3
|
5
|
+
spec/dummy/log/*.log
|
6
|
+
spec/dummy/tmp/
|
7
|
+
spec/dummy/.sass-cache
|
8
|
+
*.gem
|
3
9
|
Gemfile.lock
|
4
|
-
_yardoc
|
5
|
-
coverage
|
6
|
-
doc
|
7
|
-
pkg
|
8
|
-
spec/reports
|
9
|
-
tmp
|
10
|
-
*.log
|
11
10
|
.byebug_history
|
11
|
+
|
12
|
+
# Finder
|
12
13
|
.DS_Store
|
14
|
+
|
15
|
+
# Unix temp files
|
13
16
|
*~
|
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# RescueFrom
|
2
2
|
|
3
3
|
[](http://badge.fury.io/rb/openstax_rescue_from)
|
4
|
-
[](https://github.com/openstax/rescue_from/actions?query=workflow:Tests)
|
5
5
|
[](https://codeclimate.com/github/openstax/rescue_from)
|
6
6
|
|
7
7
|
This is the gem that brings together disparate systems within OpenStax and abstracts consistent exception rescuing with html and json responses, and email notifying
|
data/bin/rake
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
#
|
5
|
+
# This file was generated by Bundler.
|
6
|
+
#
|
7
|
+
# The application 'rake' is installed as part of a gem, and
|
8
|
+
# this file is here to facilitate running it.
|
9
|
+
#
|
10
|
+
|
11
|
+
require "pathname"
|
12
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
13
|
+
Pathname.new(__FILE__).realpath)
|
14
|
+
|
15
|
+
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
16
|
+
|
17
|
+
if File.file?(bundle_binstub)
|
18
|
+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
19
|
+
load(bundle_binstub)
|
20
|
+
else
|
21
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
22
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
require "rubygems"
|
27
|
+
require "bundler/setup"
|
28
|
+
|
29
|
+
load Gem.bin_path("rake", "rake")
|
data/bin/rspec
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
#
|
5
|
+
# This file was generated by Bundler.
|
6
|
+
#
|
7
|
+
# The application 'rspec' is installed as part of a gem, and
|
8
|
+
# this file is here to facilitate running it.
|
9
|
+
#
|
10
|
+
|
11
|
+
require "pathname"
|
12
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
13
|
+
Pathname.new(__FILE__).realpath)
|
14
|
+
|
15
|
+
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
16
|
+
|
17
|
+
if File.file?(bundle_binstub)
|
18
|
+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
19
|
+
load(bundle_binstub)
|
20
|
+
else
|
21
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
22
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
require "rubygems"
|
27
|
+
require "bundler/setup"
|
28
|
+
|
29
|
+
load Gem.bin_path("rspec-core", "rspec")
|
@@ -115,10 +115,6 @@ ActiveJob::Base.use_openstax_exception_rescue
|
|
115
115
|
# notify: false,
|
116
116
|
# status: :not_found)
|
117
117
|
#
|
118
|
-
# RescueFrom.register_exception(ActionController::UnknownController,
|
119
|
-
# notify: false,
|
120
|
-
# status: :not_found)
|
121
|
-
#
|
122
118
|
# RescueFrom.register_exception(ActionController::InvalidAuthenticityToken,
|
123
119
|
# notify: false,
|
124
120
|
# status: :unprocessable_entity)
|
data/lib/openstax/rescue_from.rb
CHANGED
@@ -139,13 +139,15 @@ module OpenStax
|
|
139
139
|
end
|
140
140
|
|
141
141
|
def log_system_error(proxy)
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
142
|
+
return unless notifies_for?(proxy.name)
|
143
|
+
|
144
|
+
logger = Logger.new(proxy)
|
145
|
+
logger.record_system_error!
|
146
146
|
end
|
147
147
|
|
148
148
|
def log_background_system_error(proxy)
|
149
|
+
return unless notifies_for?(proxy.name)
|
150
|
+
|
149
151
|
logger = Logger.new(proxy)
|
150
152
|
logger.record_system_error!('A background job exception occurred')
|
151
153
|
end
|
@@ -32,11 +32,11 @@ module OpenStax
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def logger_backtrace
|
35
|
-
@backtrace ||= exception.backtrace
|
35
|
+
@backtrace ||= exception.backtrace&.join("\n")
|
36
36
|
end
|
37
37
|
|
38
38
|
def first_backtrace_line
|
39
|
-
@first_backtrace_line ||= exception.backtrace
|
39
|
+
@first_backtrace_line ||= exception.backtrace&.first
|
40
40
|
end
|
41
41
|
|
42
42
|
def status
|
@@ -20,10 +20,11 @@ Gem::Specification.new do |spec|
|
|
20
20
|
|
21
21
|
spec.required_ruby_version = '>= 2.0'
|
22
22
|
|
23
|
-
spec.add_dependency "rails", '>= 3.1', '<
|
23
|
+
spec.add_dependency "rails", '>= 3.1', '< 7.0'
|
24
24
|
|
25
25
|
spec.add_development_dependency "bundler"
|
26
|
-
spec.add_development_dependency "
|
26
|
+
spec.add_development_dependency "sqlite3"
|
27
|
+
spec.add_development_dependency "listen"
|
27
28
|
spec.add_development_dependency "rspec-rails"
|
28
29
|
spec.add_development_dependency "rails-controller-testing"
|
29
30
|
spec.add_development_dependency "database_cleaner"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: openstax_rescue_from
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- JP Slavinsky
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2021-03-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -20,7 +20,7 @@ dependencies:
|
|
20
20
|
version: '3.1'
|
21
21
|
- - "<"
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: '
|
23
|
+
version: '7.0'
|
24
24
|
type: :runtime
|
25
25
|
prerelease: false
|
26
26
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -30,7 +30,7 @@ dependencies:
|
|
30
30
|
version: '3.1'
|
31
31
|
- - "<"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '7.0'
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
35
|
name: bundler
|
36
36
|
requirement: !ruby/object:Gem::Requirement
|
@@ -46,7 +46,21 @@ dependencies:
|
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
|
-
name:
|
49
|
+
name: sqlite3
|
50
|
+
requirement: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
type: :development
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: listen
|
50
64
|
requirement: !ruby/object:Gem::Requirement
|
51
65
|
requirements:
|
52
66
|
- - ">="
|
@@ -125,16 +139,17 @@ executables:
|
|
125
139
|
extensions: []
|
126
140
|
extra_rdoc_files: []
|
127
141
|
files:
|
142
|
+
- ".github/workflows/tests.yml"
|
128
143
|
- ".gitignore"
|
129
144
|
- ".rspec"
|
130
|
-
- ".ruby-version"
|
131
|
-
- ".travis.yml"
|
132
145
|
- Gemfile
|
133
146
|
- LICENSE.txt
|
134
147
|
- README.md
|
135
148
|
- Rakefile
|
136
149
|
- app/views/errors/any.html.erb
|
137
150
|
- bin/console
|
151
|
+
- bin/rake
|
152
|
+
- bin/rspec
|
138
153
|
- bin/setup
|
139
154
|
- lib/generators/openstax/rescue_from/install/install_generator.rb
|
140
155
|
- lib/generators/openstax/rescue_from/install/templates/rescue_from.rb
|
@@ -173,8 +188,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
173
188
|
- !ruby/object:Gem::Version
|
174
189
|
version: '0'
|
175
190
|
requirements: []
|
176
|
-
|
177
|
-
rubygems_version: 2.4.5.1
|
191
|
+
rubygems_version: 3.2.7
|
178
192
|
signing_key:
|
179
193
|
specification_version: 4
|
180
194
|
summary: Common exception `rescue_from` handling for OpenStax sites.
|
data/.ruby-version
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
2.2.3
|
data/.travis.yml
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
branches:
|
2
|
-
only:
|
3
|
-
- master
|
4
|
-
sudo: false
|
5
|
-
dist: trusty
|
6
|
-
language: ruby
|
7
|
-
rvm: "2.2.3"
|
8
|
-
addons:
|
9
|
-
postgresql: "9.5"
|
10
|
-
cache: bundler
|
11
|
-
bundler_args: --retry=6
|
12
|
-
before_script:
|
13
|
-
- bundle exec rake --trace db:setup
|
14
|
-
script:
|
15
|
-
- bundle exec rspec --format progress --tag ~type:acceptance
|
16
|
-
notifications:
|
17
|
-
email: false
|