rambulance 1.1.1 → 2.0.0

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: 82265aa18e23300634878ce073d6b72effb62a3a8326832f603d9b17b7640634
4
- data.tar.gz: 67abe21526c25ab05b2faada53dbadafd62bf414638752cdec3450256e326e3a
3
+ metadata.gz: 1592ef1d6b4e68634579d8f663c1bfac1b90b5274e3b4c855b7b2701a02dce75
4
+ data.tar.gz: e99889eca33ec4df242bb234d8824ce8badad039bce96acf61997bb697df82c0
5
5
  SHA512:
6
- metadata.gz: 97932a0989390b458d8b697cb3be797f0441b623898a34d03e1920ff50f1d298b6ec5c03650b63adf6191a18ed22e66efda0c71686022691e48dab3cd5bcc836
7
- data.tar.gz: 2af8602230f377774c17cb1f2ce0e1861a28880f7e5682807d135772fb51d9f69c8613f772866b082efccdfc8e5158971acfeedce16bbfb95c24afc812d77053
6
+ metadata.gz: 60999da77e4ea5792dee0edc0725ed212156e0cf0299c0362cd1790c8740817b8aa3186dea64478272ffb5a6e3ec815c6e61ea6e4f5078c6342be9269bcdcafd
7
+ data.tar.gz: 76ab3afe64eda416e60946160e3bbb2f373c7c83ba2466de94b71b79c049e16c6af35d837c8269227abac757b5ddb5dfec1078e964ce18247282f008869087bc
@@ -0,0 +1,109 @@
1
+ name: build
2
+
3
+ on:
4
+ - push
5
+
6
+ jobs:
7
+ stable:
8
+ strategy:
9
+ matrix:
10
+ ruby_version:
11
+ - '3.0'
12
+ - '2.7'
13
+ - '2.6'
14
+ - '2.5'
15
+ - '2.4'
16
+ - '2.3'
17
+ - 'jruby-9.2.19.0'
18
+ gemfile:
19
+ - gemfiles/rails_61.gemfile
20
+ - gemfiles/rails_60.gemfile
21
+ - gemfiles/rails_52.gemfile
22
+ - gemfiles/rails_51.gemfile
23
+ - gemfiles/rails_50.gemfile
24
+ - gemfiles/rails_42.gemfile
25
+ exclude:
26
+ - ruby_version: '3.0'
27
+ gemfile: gemfiles/rails_52.gemfile
28
+ - ruby_version: '3.0'
29
+ gemfile: gemfiles/rails_51.gemfile
30
+ - ruby_version: '3.0'
31
+ gemfile: gemfiles/rails_50.gemfile
32
+ - ruby_version: '3.0'
33
+ gemfile: gemfiles/rails_42.gemfile
34
+ - ruby_version: '2.7'
35
+ gemfile: gemfiles/rails_52.gemfile
36
+ - ruby_version: '2.7'
37
+ gemfile: gemfiles/rails_51.gemfile
38
+ - ruby_version: '2.7'
39
+ gemfile: gemfiles/rails_50.gemfile
40
+ - ruby_version: '2.7'
41
+ gemfile: gemfiles/rails_42.gemfile
42
+ - ruby_version: '2.6'
43
+ gemfile: gemfiles/rails_42.gemfile
44
+ - ruby_version: '2.4'
45
+ gemfile: gemfiles/rails_61.gemfile
46
+ - ruby_version: '2.4'
47
+ gemfile: gemfiles/rails_60.gemfile
48
+ - ruby_version: '2.3'
49
+ gemfile: gemfiles/rails_61.gemfile
50
+ - ruby_version: '2.3'
51
+ gemfile: gemfiles/rails_60.gemfile
52
+ - ruby_version: 'jruby-9.2.19.0'
53
+ gemfile: gemfiles/rails_51.gemfile
54
+ - ruby_version: 'jruby-9.2.19.0'
55
+ gemfile: gemfiles/rails_50.gemfile
56
+ - ruby_version: 'jruby-9.2.19.0'
57
+ gemfile: gemfiles/rails_42.gemfile
58
+ runs-on: ubuntu-18.04
59
+ env:
60
+ BUNDLE_GEMFILE: ${{ matrix.gemfile }}
61
+ steps:
62
+ - uses: actions/checkout@v2
63
+ - name: Set up Ruby
64
+ uses: ruby/setup-ruby@v1
65
+ with:
66
+ ruby-version: ${{ matrix.ruby_version }}
67
+ bundler-cache: true
68
+ - run: bundle exec rake
69
+
70
+ rails_edge:
71
+ strategy:
72
+ matrix:
73
+ ruby_version:
74
+ - '3.0'
75
+ - '2.7'
76
+ gemfile:
77
+ - gemfiles/rails_edge.gemfile
78
+ runs-on: ubuntu-18.04
79
+ env:
80
+ BUNDLE_GEMFILE: ${{ matrix.gemfile }}
81
+ steps:
82
+ - uses: actions/checkout@v2
83
+ - name: Set up Ruby
84
+ uses: ruby/setup-ruby@v1
85
+ with:
86
+ ruby-version: ${{ matrix.ruby_version }}
87
+ bundler-cache: true
88
+ - run: bundle exec rake
89
+
90
+ ruby_edge:
91
+ strategy:
92
+ matrix:
93
+ ruby_version:
94
+ - 'ruby-head'
95
+ gemfile:
96
+ - gemfiles/rails_edge.gemfile
97
+ - gemfiles/rails_61.gemfile
98
+ - gemfiles/rails_60.gemfile
99
+ runs-on: ubuntu-18.04
100
+ env:
101
+ BUNDLE_GEMFILE: ${{ matrix.gemfile }}
102
+ steps:
103
+ - uses: actions/checkout@v2
104
+ - name: Set up Ruby
105
+ uses: ruby/setup-ruby@v1
106
+ with:
107
+ ruby-version: ${{ matrix.ruby_version }}
108
+ bundler-cache: true
109
+ - run: bundle exec rake || echo "Ruby edge test is done."
data/Appraisals CHANGED
@@ -1,26 +1,3 @@
1
- appraise "rails_32" do
2
- gem "activesupport", "~> 3.2.0"
3
- gem "actionpack", "~> 3.2.0"
4
- gem "railties", "~> 3.2.0"
5
- gem "test-unit" if RUBY_VERSION >= "2.2.0"
6
- gem 'nokogiri', '1.6.8.1' if RUBY_VERSION == "2.0.0"
7
- end
8
-
9
- appraise "rails_40" do
10
- gem "activesupport", "~> 4.0.0"
11
- gem "actionpack", "~> 4.0.0"
12
- gem "railties", "~> 4.0.0"
13
- gem "test-unit" if RUBY_VERSION >= "2.2.0"
14
- gem 'nokogiri', '1.6.8.1' if RUBY_VERSION == "2.0.0"
15
- end
16
-
17
- appraise "rails_41" do
18
- gem "activesupport", "~> 4.1.0"
19
- gem "actionpack", "~> 4.1.0"
20
- gem "railties", "~> 4.1.0"
21
- gem 'nokogiri', '1.6.8.1' if RUBY_VERSION == "2.0.0"
22
- end
23
-
24
1
  appraise "rails_42" do
25
2
  gem "activesupport", "~> 4.2.0"
26
3
  gem "actionpack", "~> 4.2.0"
@@ -49,9 +26,15 @@ appraise "rails_52" do
49
26
  end
50
27
 
51
28
  appraise "rails_60" do
52
- gem "activesupport", "~> 6.0.0.rc1"
53
- gem "actionpack", "~> 6.0.0.rc1"
54
- gem "railties", "~> 6.0.0.rc1"
29
+ gem "activesupport", "~> 6.0.0"
30
+ gem "actionpack", "~> 6.0.0"
31
+ gem "railties", "~> 6.0.0"
32
+ end
33
+
34
+ appraise "rails_61" do
35
+ gem "activesupport", "~> 6.1.0"
36
+ gem "actionpack", "~> 6.1.0"
37
+ gem "railties", "~> 6.1.0"
55
38
  end
56
39
 
57
40
  appraise "rails_edge" do
data/CHANGELOG.md CHANGED
@@ -1,6 +1,25 @@
1
- ## v1.1.1 (unreleased)
1
+ ## v2.0.0
2
2
 
3
- - Fixes a bug where a malformed `Content-Type` header could break the exceptions app (#55, @gingerlime)
3
+ #### Breaking Changes
4
+
5
+ - Drop support for Rails 4.1 and older (https://github.com/yuki24/rambulance/pull/62, @yuki24)
6
+
7
+ #### Features
8
+
9
+ - Add support for Rails 6.1 and Ruby 3.0 (https://github.com/yuki24/rambulance/pull/61, https://github.com/yuki24/rambulance/pull/63, @gingerlime, @yuki24)
10
+
11
+ #### Bug fixes
12
+
13
+ - POST with invalid JSON triggers a 500 (https://github.com/yuki24/rambulance/pull/59, @gingerlime)
14
+ - Fix 'directry' typo (https://github.com/yuki24/rambulance/pull/57, @andyw8)
15
+
16
+ ## [v1.1.1](https://github.com/yuki24/rambulance/tree/v1.1.1)
17
+
18
+ _<sup>released at 2020-05-28 23:22:10 UTC</sup>_
19
+
20
+ #### Bug fixes
21
+
22
+ - Fixes a bug where a malformed `Content-Type` header could break the exceptions app ([#55](https://github.com/yuki24/rambulance/pull/55), [@gingerlime](https://github.com/gingerlime))
4
23
 
5
24
  ## [v1.1.0](https://github.com/yuki24/rambulance/tree/v1.1.0)
6
25
 
@@ -2,8 +2,8 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "activesupport", "~> 6.0.0.rc1"
6
- gem "actionpack", "~> 6.0.0.rc1"
7
- gem "railties", "~> 6.0.0.rc1"
5
+ gem "activesupport", "~> 6.0.0"
6
+ gem "actionpack", "~> 6.0.0"
7
+ gem "railties", "~> 6.0.0"
8
8
 
9
9
  gemspec path: "../"
@@ -0,0 +1,9 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "activesupport", "~> 6.1.0"
6
+ gem "actionpack", "~> 6.1.0"
7
+ gem "railties", "~> 6.1.0"
8
+
9
+ gemspec path: "../"
@@ -26,7 +26,7 @@ Rambulance.setup do |config|
26
26
  # 'app/views/layout/error_page.html.erb' as a layout for all the error pages.
27
27
  config.layout_name = "error"
28
28
 
29
- # The directry name to organize error page templates. The default value is
29
+ # The directory name to organize error page templates. The default value is
30
30
  # 'errors'. For example, if this value is set to "error_pages", Rambulance
31
31
  # uses e.g. 'app/views/error_pages/not_found.html.erb'.
32
32
  config.view_path = "errors"
@@ -9,6 +9,16 @@ module Rambulance
9
9
  http_status >= 400 && ![418, 427, 430, 509].include?(http_status)
10
10
  end.invert
11
11
 
12
+ BAD_REQUEST_ERRORS = [
13
+ ActionController::BadRequest,
14
+ begin
15
+ ActionDispatch::Http::Parameters::ParseError # Rails >= 5.2.0
16
+ rescue NameError; end,
17
+ begin
18
+ ActionDispatch::ParamsParser::ParseError # Rails < 5.2.0
19
+ rescue NameError; end,
20
+ ].compact.freeze
21
+
12
22
  class ExceptionsApp < ActionController::Base
13
23
  layout :layout_name
14
24
 
@@ -69,7 +79,7 @@ module Rambulance
69
79
 
70
80
  begin
71
81
  request.POST
72
- rescue ActionController::BadRequest
82
+ rescue *BAD_REQUEST_ERRORS
73
83
  request.env["MALFORMED_BODY"], request.env["rack.input"] = request.env["rack.input"], StringIO.new
74
84
  end
75
85
 
@@ -1,3 +1,3 @@
1
1
  module Rambulance
2
- VERSION = "1.1.1"
2
+ VERSION = "2.0.0"
3
3
  end
data/lib/rambulance.rb CHANGED
@@ -13,7 +13,7 @@ module Rambulance
13
13
  mattr_accessor :layout_name
14
14
  @@layout_name = "application"
15
15
 
16
- # The directry name to organize error page templates.
16
+ # The directory name to organize error page templates.
17
17
  mattr_accessor :view_path
18
18
  @@view_path = "errors"
19
19
 
@@ -74,6 +74,21 @@ class ErrorJsonTest < ActionDispatch::IntegrationTest
74
74
  end
75
75
  end
76
76
 
77
+ test 'returns an appropriate status when JSON data is malformed' do
78
+ if Rails::VERSION::STRING >= '5.1.0'
79
+ post '/unknown/path', params: 'x', headers: { "CONTENT_TYPE" => "application/json" }
80
+ else
81
+ post '/unknown/path', 'x', "CONTENT_TYPE" => "application/json"
82
+ end
83
+
84
+ if Rails::VERSION::STRING >= '5.0.0'
85
+ assert_equal 404, response.status
86
+ elsif Rails::VERSION::STRING >= '4.2.0'
87
+ assert_equal 400, response.status
88
+ end
89
+ end
90
+
91
+
77
92
  private
78
93
 
79
94
  def without_layouts
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rambulance
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuki Nishijima
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-28 00:00:00.000000000 Z
11
+ date: 2021-09-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -144,8 +144,8 @@ executables: []
144
144
  extensions: []
145
145
  extra_rdoc_files: []
146
146
  files:
147
+ - ".github/workflows/tests.yml"
147
148
  - ".gitignore"
148
- - ".travis.yml"
149
149
  - Appraisals
150
150
  - CHANGELOG.md
151
151
  - Dangerfile
@@ -155,14 +155,12 @@ files:
155
155
  - Rakefile
156
156
  - app/views/errors/internal_server_error.text.erb
157
157
  - app/views/errors/not_acceptable.text.erb
158
- - gemfiles/rails_32.gemfile
159
- - gemfiles/rails_40.gemfile
160
- - gemfiles/rails_41.gemfile
161
158
  - gemfiles/rails_42.gemfile
162
159
  - gemfiles/rails_50.gemfile
163
160
  - gemfiles/rails_51.gemfile
164
161
  - gemfiles/rails_52.gemfile
165
162
  - gemfiles/rails_60.gemfile
163
+ - gemfiles/rails_61.gemfile
166
164
  - gemfiles/rails_edge.gemfile
167
165
  - lib/generators/rambulance/exceptions_app_generator.rb
168
166
  - lib/generators/rambulance/install_generator.rb
@@ -207,7 +205,7 @@ homepage: http://github.com/yuki24/rambulance
207
205
  licenses:
208
206
  - MIT
209
207
  metadata: {}
210
- post_install_message:
208
+ post_install_message:
211
209
  rdoc_options: []
212
210
  require_paths:
213
211
  - lib
@@ -222,8 +220,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
222
220
  - !ruby/object:Gem::Version
223
221
  version: '0'
224
222
  requirements: []
225
- rubygems_version: 3.1.3
226
- signing_key:
223
+ rubygems_version: 3.2.26
224
+ signing_key:
227
225
  specification_version: 4
228
226
  summary: Simple and safe way to dynamically generate error pages
229
227
  test_files:
data/.travis.yml DELETED
@@ -1,62 +0,0 @@
1
- language: ruby
2
- cache: bundler
3
- sudo: false
4
-
5
- script:
6
- - bundle exec rake
7
-
8
- before_install:
9
- - gem update --system
10
- - gem install bundler
11
-
12
- rvm:
13
- - 2.3.8
14
- - 2.4.10
15
- - 2.5.8
16
- - 2.6.6
17
- - 2.7.1
18
- - ruby-head
19
- - jruby-9.2.11.1
20
- - jruby-head
21
-
22
- gemfile:
23
- - gemfiles/rails_42.gemfile
24
- - gemfiles/rails_50.gemfile
25
- - gemfiles/rails_51.gemfile
26
- - gemfiles/rails_52.gemfile
27
- - gemfiles/rails_60.gemfile
28
- - gemfiles/rails_edge.gemfile
29
-
30
- matrix:
31
- exclude:
32
- - rvm: 2.3.8
33
- gemfile: gemfiles/rails_60.gemfile
34
- - rvm: 2.3.8
35
- gemfile: gemfiles/rails_edge.gemfile
36
- - rvm: 2.4.10
37
- gemfile: gemfiles/rails_60.gemfile
38
- - rvm: 2.4.10
39
- gemfile: gemfiles/rails_edge.gemfile
40
- - rvm: 2.6.6
41
- gemfile: gemfiles/rails_42.gemfile
42
- - rvm: 2.7.1
43
- gemfile: gemfiles/rails_42.gemfile
44
- - rvm: 2.7.1
45
- gemfile: gemfiles/rails_50.gemfile
46
- - rvm: 2.7.1
47
- gemfile: gemfiles/rails_51.gemfile
48
- - rvm: 2.7.1
49
- gemfile: gemfiles/rails_52.gemfile
50
- - rvm: ruby-head
51
- gemfile: gemfiles/rails_42.gemfile
52
- - rvm: ruby-head
53
- gemfile: gemfiles/rails_50.gemfile
54
- - rvm: ruby-head
55
- gemfile: gemfiles/rails_51.gemfile
56
- - rvm: ruby-head
57
- gemfile: gemfiles/rails_52.gemfile
58
- allow_failures:
59
- - rvm: ruby-head
60
- - rvm: jruby-9.2.11.1
61
- - rvm: jruby-head
62
- - gemfile: gemfiles/rails_edge.gemfile
@@ -1,11 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "activesupport", "~> 3.2.0"
6
- gem "actionpack", "~> 3.2.0"
7
- gem "railties", "~> 3.2.0"
8
- gem "test-unit" if RUBY_VERSION >= "2.2.0"
9
- gem 'nokogiri', '1.6.8.1' if RUBY_VERSION == "2.0.0"
10
-
11
- gemspec path: "../"
@@ -1,11 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "activesupport", "~> 4.0.0"
6
- gem "actionpack", "~> 4.0.0"
7
- gem "railties", "~> 4.0.0"
8
- gem "test-unit" if RUBY_VERSION >= "2.2.0"
9
- gem 'nokogiri', '1.6.8.1' if RUBY_VERSION == "2.0.0"
10
-
11
- gemspec path: "../"
@@ -1,10 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "activesupport", "~> 4.1.0"
6
- gem "actionpack", "~> 4.1.0"
7
- gem "railties", "~> 4.1.0"
8
- gem 'nokogiri', '1.6.8.1' if RUBY_VERSION == "2.0.0"
9
-
10
- gemspec path: "../"