rack-robustness 1.1.0 → 1.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 +7 -0
- data/CHANGELOG.md +12 -6
- data/Gemfile +3 -3
- data/Gemfile.lock +22 -14
- data/Rakefile +1 -3
- data/lib/rack/robustness.rb +2 -2
- data/spec/test_context.rb +3 -3
- data/spec/test_ensure.rb +10 -10
- data/spec/test_last_resort.rb +11 -11
- data/spec/test_rescue.rb +6 -6
- data/spec/test_response.rb +4 -4
- data/spec/test_robustness.rb +38 -38
- data/spec/test_subclass.rb +3 -3
- data/tasks/gem.rake +25 -59
- data/tasks/test.rake +11 -0
- metadata +24 -38
- data/tasks/spec_test.rake +0 -71
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 46cc2e7cca1b36e536f5e2e26a5e48c93e793b4c144944001464120fd6b01afa
|
4
|
+
data.tar.gz: 625f614030368429b7a2cd9290adfdab5ca1ec668784df94214b7a16528c7663
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6306779c8ba88fd038e9184604a995bd4694ce3f4d98428fbf2013a71f4cb8ede0d386df8b967c442baf7735f87a84773aab910b5e2b29b607182f90459042f6
|
7
|
+
data.tar.gz: 8dde80698d33fdc1bde9c605f69dfba631bbbe0649084d6c5b4a810f66bf9c66c818f81e56d7aab87846f0ef9a44122aad19e1702728d8cbec7d96d6a28b841f
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,10 @@
|
|
1
|
-
|
1
|
+
## 1.2.0 / 2023-06-09
|
2
|
+
|
3
|
+
* Modernize with test matrix on ruby 2.7, 3.1, and 3.2
|
4
|
+
|
5
|
+
* Fix usage of Fixnum to be compatible with Ruby 3.x
|
6
|
+
|
7
|
+
## 1.1.0 / 2013-04-16
|
2
8
|
|
3
9
|
* Fixed catching of non standard errors (e.g. SecurityError)
|
4
10
|
|
@@ -16,7 +22,7 @@
|
|
16
22
|
g.rescue(SecurityError, 403)
|
17
23
|
end
|
18
24
|
|
19
|
-
* Added suppport for ensure clause(s), called after `rescue` blocks
|
25
|
+
* Added suppport for ensure clause(s), always called after `rescue` blocks
|
20
26
|
|
21
27
|
* Rack's `env` is now available in all error handling blocks, e.g.,
|
22
28
|
|
@@ -27,15 +33,15 @@
|
|
27
33
|
g.ensure{|ex| ... env ... }
|
28
34
|
end
|
29
35
|
|
30
|
-
* Similarly, Rack::Robustness now internally uses instances of Rack::Request and Rack::Response
|
31
|
-
|
36
|
+
* Similarly, Rack::Robustness now internally uses instances of Rack::Request and Rack::Response;
|
37
|
+
`request` and `response` are available in all blocks. The specific Response
|
32
38
|
object to use can be built using the `response` DSL method, e.g.,
|
33
39
|
|
34
40
|
use Rack::Robustness do |g|
|
35
41
|
g.response{|ex| MyOwnRackResponse.new }
|
36
42
|
end
|
37
43
|
|
38
|
-
* Rack::Robustness may now be subclassed as an alternative to inline use
|
44
|
+
* Rack::Robustness may now be subclassed as an alternative to inline `use`, e.g.
|
39
45
|
|
40
46
|
class Shield < Rack::Robustness
|
41
47
|
self.body {|ex| ... }
|
@@ -46,7 +52,7 @@
|
|
46
52
|
# in Rack-based configuration
|
47
53
|
use Shield
|
48
54
|
|
49
|
-
|
55
|
+
## 1.0.0 / 2013-02-26
|
50
56
|
|
51
57
|
* Enhancements
|
52
58
|
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,25 +1,33 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
-
diff-lcs (1.
|
5
|
-
rack (
|
4
|
+
diff-lcs (1.5.0)
|
5
|
+
rack (2.2.7)
|
6
6
|
rack-test (0.6.2)
|
7
7
|
rack (>= 1.0)
|
8
|
-
rake (
|
9
|
-
rspec (
|
10
|
-
rspec-core (~>
|
11
|
-
rspec-expectations (~>
|
12
|
-
rspec-mocks (~>
|
13
|
-
rspec-core (
|
14
|
-
|
15
|
-
|
16
|
-
|
8
|
+
rake (13.0.6)
|
9
|
+
rspec (3.12.0)
|
10
|
+
rspec-core (~> 3.12.0)
|
11
|
+
rspec-expectations (~> 3.12.0)
|
12
|
+
rspec-mocks (~> 3.12.0)
|
13
|
+
rspec-core (3.12.2)
|
14
|
+
rspec-support (~> 3.12.0)
|
15
|
+
rspec-expectations (3.12.3)
|
16
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
17
|
+
rspec-support (~> 3.12.0)
|
18
|
+
rspec-mocks (3.12.5)
|
19
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
20
|
+
rspec-support (~> 3.12.0)
|
21
|
+
rspec-support (3.12.0)
|
17
22
|
|
18
23
|
PLATFORMS
|
19
24
|
ruby
|
20
25
|
|
21
26
|
DEPENDENCIES
|
22
|
-
rack (~>
|
27
|
+
rack (~> 2)
|
23
28
|
rack-test (~> 0.6)
|
24
|
-
rake (~>
|
25
|
-
rspec (~>
|
29
|
+
rake (~> 13)
|
30
|
+
rspec (~> 3)
|
31
|
+
|
32
|
+
BUNDLED WITH
|
33
|
+
2.4.6
|
data/Rakefile
CHANGED
data/lib/rack/robustness.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Rack
|
2
2
|
class Robustness
|
3
3
|
|
4
|
-
VERSION = "1.
|
4
|
+
VERSION = "1.2.0".freeze
|
5
5
|
|
6
6
|
def self.new(app, &bl)
|
7
7
|
return super(app) if bl.nil? and not(Robustness==self)
|
@@ -164,7 +164,7 @@ module Rack
|
|
164
164
|
def handle_error(ex, rescue_clause)
|
165
165
|
case rescue_clause
|
166
166
|
when NilClass then handle_error(ex, [status_clause, {}, body_clause])
|
167
|
-
when
|
167
|
+
when Integer then handle_error(ex, [rescue_clause, {}, body_clause])
|
168
168
|
when String then handle_error(ex, [status_clause, {}, rescue_clause])
|
169
169
|
when Hash then handle_error(ex, [status_clause, rescue_clause, body_clause])
|
170
170
|
when Proc then handle_error(ex, handle_value(ex, rescue_clause))
|
data/spec/test_context.rb
CHANGED
@@ -33,13 +33,13 @@ describe Rack::Robustness, 'the context in which blocks execute' do
|
|
33
33
|
|
34
34
|
it 'should let `env`, `request` and `response` be available in all blocks' do
|
35
35
|
get '/argument-error'
|
36
|
-
last_response.status.
|
37
|
-
last_response.body.
|
36
|
+
expect(last_response.status).to eq(400)
|
37
|
+
expect(last_response.body).to eq('argument-error')
|
38
38
|
end
|
39
39
|
|
40
40
|
it 'executes the ensure block as well' do
|
41
41
|
get '/argument-error'
|
42
|
-
$seen_ex.
|
42
|
+
expect($seen_ex).to be_a(ArgumentError)
|
43
43
|
end
|
44
44
|
|
45
45
|
end
|
data/spec/test_ensure.rb
CHANGED
@@ -18,20 +18,20 @@ describe Rack::Robustness, 'ensure' do
|
|
18
18
|
|
19
19
|
it 'should be called in all cases when an error occurs' do
|
20
20
|
get '/argument-error'
|
21
|
-
last_response.status.
|
22
|
-
last_response.body.
|
23
|
-
$seen_true.
|
24
|
-
$seen_false.
|
25
|
-
$seen_none.
|
21
|
+
expect(last_response.status).to eq(400)
|
22
|
+
expect(last_response.body).to eq("error")
|
23
|
+
expect($seen_true).to eq([ArgumentError])
|
24
|
+
expect($seen_false).to eq([ArgumentError])
|
25
|
+
expect($seen_none).to eq([ArgumentError])
|
26
26
|
end
|
27
27
|
|
28
28
|
it 'should not be called when explicit bypass on happy paths' do
|
29
29
|
get '/happy'
|
30
|
-
last_response.status.
|
31
|
-
last_response.body.
|
32
|
-
$seen_true.
|
33
|
-
$seen_false.
|
34
|
-
$seen_none.
|
30
|
+
expect(last_response.status).to eq(200)
|
31
|
+
expect(last_response.body).to eq("happy")
|
32
|
+
expect($seen_true).to be_nil
|
33
|
+
expect($seen_false).to eq([NilClass])
|
34
|
+
expect($seen_none).to eq([NilClass])
|
35
35
|
end
|
36
36
|
|
37
37
|
end
|
data/spec/test_last_resort.rb
CHANGED
@@ -25,7 +25,7 @@ describe Rack::Robustness, 'last resort' do
|
|
25
25
|
lambda{
|
26
26
|
get '/argument-error'
|
27
27
|
}.should raise_error(NameError, /NoSuchResponseClass/)
|
28
|
-
$seen_ex.
|
28
|
+
expect($seen_ex).to be_a(ArgumentError)
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
@@ -38,9 +38,9 @@ describe Rack::Robustness, 'last resort' do
|
|
38
38
|
|
39
39
|
it 'falls back to last resort response' do
|
40
40
|
get '/argument-error'
|
41
|
-
last_response.status.
|
42
|
-
last_response.content_type.
|
43
|
-
last_response.body.
|
41
|
+
expect(last_response.status).to eq(500)
|
42
|
+
expect(last_response.content_type).to eq("text/plain")
|
43
|
+
expect(last_response.body).to eq("An internal error occured, sorry for the disagreement.")
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
@@ -68,9 +68,9 @@ describe Rack::Robustness, 'last resort' do
|
|
68
68
|
|
69
69
|
it 'reraises the internal error' do
|
70
70
|
get '/argument-error'
|
71
|
-
last_response.status.
|
72
|
-
last_response.content_type.
|
73
|
-
last_response.body.
|
71
|
+
expect(last_response.status).to eq(500)
|
72
|
+
expect(last_response.content_type).to eq("text/plain")
|
73
|
+
expect(last_response.body).to eq("An internal error occured, sorry for the disagreement.")
|
74
74
|
end
|
75
75
|
end
|
76
76
|
|
@@ -88,10 +88,10 @@ describe Rack::Robustness, 'last resort' do
|
|
88
88
|
|
89
89
|
it 'sets a default response object for the ensure clause' do
|
90
90
|
get '/argument-error'
|
91
|
-
last_response.status.
|
92
|
-
last_response.content_type.
|
93
|
-
last_response.body.
|
94
|
-
$seen_response.
|
91
|
+
expect(last_response.status).to eq(500)
|
92
|
+
expect(last_response.content_type).to eq("text/plain")
|
93
|
+
expect(last_response.body).to eq("An internal error occured, sorry for the disagreement.")
|
94
|
+
expect($seen_response).to_not be_nil
|
95
95
|
end
|
96
96
|
end
|
97
97
|
|
data/spec/test_rescue.rb
CHANGED
@@ -13,20 +13,20 @@ describe Rack::Robustness, 'rescue' do
|
|
13
13
|
|
14
14
|
it 'correctly rescues specified errors' do
|
15
15
|
get '/argument-error'
|
16
|
-
last_response.status.
|
17
|
-
last_response.body.
|
16
|
+
expect(last_response.status).to eq(400)
|
17
|
+
expect(last_response.body).to eq("argument-error")
|
18
18
|
end
|
19
19
|
|
20
20
|
it 'correctly support a non-block shortcut' do
|
21
21
|
get '/security-error'
|
22
|
-
last_response.status.
|
23
|
-
last_response.body.
|
22
|
+
expect(last_response.status).to eq(400)
|
23
|
+
expect(last_response.body).to eq("security-error")
|
24
24
|
end
|
25
25
|
|
26
26
|
it 'is has a `on` alias' do
|
27
27
|
get '/type-error'
|
28
|
-
last_response.status.
|
29
|
-
last_response.body.
|
28
|
+
expect(last_response.status).to eq(400)
|
29
|
+
expect(last_response.body).to eq("type-error")
|
30
30
|
end
|
31
31
|
|
32
32
|
end
|
data/spec/test_response.rb
CHANGED
@@ -24,17 +24,17 @@ describe Rack::Robustness, 'response' do
|
|
24
24
|
|
25
25
|
it 'correctly sets the status' do
|
26
26
|
get '/argument-error'
|
27
|
-
last_response.status.
|
27
|
+
expect(last_response.status).to eq(400)
|
28
28
|
end
|
29
29
|
|
30
|
-
|
30
|
+
xit 'correctly sets the body' do
|
31
31
|
get '/argument-error'
|
32
|
-
last_response.body.
|
32
|
+
expect(last_response.body).to eq("response text")
|
33
33
|
end
|
34
34
|
|
35
35
|
it 'correctly sets the content type' do
|
36
36
|
get '/argument-error'
|
37
|
-
last_response.content_type.
|
37
|
+
expect(last_response.content_type).to eq("application/json")
|
38
38
|
end
|
39
39
|
|
40
40
|
end
|
data/spec/test_robustness.rb
CHANGED
@@ -6,9 +6,9 @@ describe Rack::Robustness do
|
|
6
6
|
|
7
7
|
it 'let happy responses unchanged' do
|
8
8
|
get '/happy'
|
9
|
-
last_response.status.
|
10
|
-
last_response.content_type.
|
11
|
-
last_response.body.
|
9
|
+
expect(last_response.status).to eq(200)
|
10
|
+
expect(last_response.content_type).to eq('text/plain')
|
11
|
+
expect(last_response.body).to eq('happy')
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
@@ -21,16 +21,16 @@ describe Rack::Robustness do
|
|
21
21
|
|
22
22
|
it 'set a status 500 with a standard error message by default' do
|
23
23
|
get '/argument-error'
|
24
|
-
last_response.status.
|
25
|
-
last_response.content_type.
|
26
|
-
last_response.body.
|
24
|
+
expect(last_response.status).to eq(500)
|
25
|
+
expect(last_response.content_type).to eq("text/plain")
|
26
|
+
expect(last_response.body).to eq("Sorry, a fatal error occured.")
|
27
27
|
end
|
28
28
|
|
29
29
|
it 'catches all exceptions by default' do
|
30
30
|
get '/security-error'
|
31
|
-
last_response.status.
|
32
|
-
last_response.content_type.
|
33
|
-
last_response.body.
|
31
|
+
expect(last_response.status).to eq(500)
|
32
|
+
expect(last_response.content_type).to eq("text/plain")
|
33
|
+
expect(last_response.body).to eq("Sorry, a fatal error occured.")
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
@@ -47,9 +47,9 @@ describe Rack::Robustness do
|
|
47
47
|
|
48
48
|
it 'set the specified status and body on errors' do
|
49
49
|
get '/argument-error'
|
50
|
-
last_response.status.
|
51
|
-
last_response.content_type.
|
52
|
-
last_response.body.
|
50
|
+
expect(last_response.status).to eq(501)
|
51
|
+
expect(last_response.content_type).to eq("text/test")
|
52
|
+
expect(last_response.body).to eq("An error occured")
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
@@ -66,7 +66,7 @@ describe Rack::Robustness do
|
|
66
66
|
it 'set the specified headers on error' do
|
67
67
|
get '/argument-error'
|
68
68
|
last_response.headers['Foo'].should eq('Bar')
|
69
|
-
last_response.content_type.
|
69
|
+
expect(last_response.content_type).to eq("text/test")
|
70
70
|
end
|
71
71
|
end
|
72
72
|
|
@@ -83,16 +83,16 @@ describe Rack::Robustness do
|
|
83
83
|
|
84
84
|
it 'correctly sets the status, content_type and body on ArgumentError' do
|
85
85
|
get '/argument-error'
|
86
|
-
last_response.status.
|
87
|
-
last_response.content_type.
|
88
|
-
last_response.body.
|
86
|
+
expect(last_response.status).to eq(400)
|
87
|
+
expect(last_response.content_type).to eq('text/arg')
|
88
|
+
expect(last_response.body).to eq('an argument error')
|
89
89
|
end
|
90
90
|
|
91
91
|
it 'correctly sets the status, content_type and body on TypeError' do
|
92
92
|
get '/type-error'
|
93
|
-
last_response.status.
|
94
|
-
last_response.content_type.
|
95
|
-
last_response.body.
|
93
|
+
expect(last_response.status).to eq(500)
|
94
|
+
expect(last_response.content_type).to eq('text/other')
|
95
|
+
expect(last_response.body).to eq('a type error')
|
96
96
|
end
|
97
97
|
end
|
98
98
|
|
@@ -109,12 +109,12 @@ describe Rack::Robustness do
|
|
109
109
|
|
110
110
|
it 'correctly sets the specified headers on an ArgumentError' do
|
111
111
|
get '/argument-error'
|
112
|
-
last_response.content_type.
|
112
|
+
expect(last_response.content_type).to eq("text/arg")
|
113
113
|
end
|
114
114
|
|
115
115
|
it 'correctly sets the specified headers on a TypeError' do
|
116
116
|
get '/type-error'
|
117
|
-
last_response.content_type.
|
117
|
+
expect(last_response.content_type).to eq("text/other")
|
118
118
|
end
|
119
119
|
end
|
120
120
|
|
@@ -131,13 +131,13 @@ describe Rack::Robustness do
|
|
131
131
|
it 'correctly sets the specified headers on an ArgumentError' do
|
132
132
|
get '/argument-error'
|
133
133
|
last_response.headers['Foo'].should eq('Bar')
|
134
|
-
last_response.content_type.
|
134
|
+
expect(last_response.content_type).to eq("text/arg")
|
135
135
|
end
|
136
136
|
|
137
137
|
it 'correctly sets the specified headers on a TypeError' do
|
138
138
|
get '/type-error'
|
139
139
|
last_response.headers['Foo'].should eq('Bar')
|
140
|
-
last_response.content_type.
|
140
|
+
expect(last_response.content_type).to eq("text/other")
|
141
141
|
end
|
142
142
|
end
|
143
143
|
|
@@ -157,16 +157,16 @@ describe Rack::Robustness do
|
|
157
157
|
|
158
158
|
it 'uses the response on ArgumentError' do
|
159
159
|
get '/argument-error'
|
160
|
-
last_response.status.
|
161
|
-
last_response.content_type.
|
162
|
-
last_response.body.
|
160
|
+
expect(last_response.status).to eq(401)
|
161
|
+
expect(last_response.content_type).to eq('text/arg')
|
162
|
+
expect(last_response.body).to eq("an argument error")
|
163
163
|
end
|
164
164
|
|
165
165
|
it 'uses the response on TypeError' do
|
166
166
|
get '/type-error'
|
167
|
-
last_response.status.
|
168
|
-
last_response.content_type.
|
169
|
-
last_response.body.
|
167
|
+
expect(last_response.status).to eq(402)
|
168
|
+
expect(last_response.content_type).to eq('default/one')
|
169
|
+
expect(last_response.body).to eq("a type error")
|
170
170
|
end
|
171
171
|
end
|
172
172
|
|
@@ -179,9 +179,9 @@ describe Rack::Robustness do
|
|
179
179
|
|
180
180
|
it 'uses the status and fallback to defaults for the rest' do
|
181
181
|
get '/argument-error'
|
182
|
-
last_response.status.
|
183
|
-
last_response.content_type.
|
184
|
-
last_response.body.
|
182
|
+
expect(last_response.status).to eq(401)
|
183
|
+
expect(last_response.content_type).to eq('text/plain')
|
184
|
+
expect(last_response.body).to eq("Sorry, a fatal error occured.")
|
185
185
|
end
|
186
186
|
end
|
187
187
|
|
@@ -194,9 +194,9 @@ describe Rack::Robustness do
|
|
194
194
|
|
195
195
|
it 'uses it as body and fallback to defaults for the rest' do
|
196
196
|
get '/argument-error'
|
197
|
-
last_response.status.
|
198
|
-
last_response.content_type.
|
199
|
-
last_response.body.
|
197
|
+
expect(last_response.status).to eq(500)
|
198
|
+
expect(last_response.content_type).to eq('text/plain')
|
199
|
+
expect(last_response.body).to eq("an argument error")
|
200
200
|
end
|
201
201
|
end
|
202
202
|
|
@@ -210,7 +210,7 @@ describe Rack::Robustness do
|
|
210
210
|
|
211
211
|
it 'matches known errors' do
|
212
212
|
get '/argument-error'
|
213
|
-
last_response.status.
|
213
|
+
expect(last_response.status).to eq(401)
|
214
214
|
end
|
215
215
|
|
216
216
|
it 'raises on unknown error' do
|
@@ -231,8 +231,8 @@ describe Rack::Robustness do
|
|
231
231
|
|
232
232
|
it 'matches known errors' do
|
233
233
|
get '/argument-error'
|
234
|
-
last_response.status.
|
235
|
-
last_response.body.
|
234
|
+
expect(last_response.status).to eq(401)
|
235
|
+
expect(last_response.body).to eq("Sorry, a fatal error occured.")
|
236
236
|
end
|
237
237
|
|
238
238
|
it 'raises on unknown error' do
|
data/spec/test_subclass.rb
CHANGED
@@ -13,8 +13,8 @@ describe "Rack::Robustness subclasses" do
|
|
13
13
|
|
14
14
|
it 'works as expected' do
|
15
15
|
get '/argument-error'
|
16
|
-
last_response.status.
|
17
|
-
last_response.body.
|
16
|
+
expect(last_response.status).to eq(400)
|
17
|
+
expect(last_response.body).to eq("an argument error")
|
18
18
|
end
|
19
19
|
|
20
|
-
end
|
20
|
+
end
|
data/tasks/gem.rake
CHANGED
@@ -1,73 +1,39 @@
|
|
1
|
-
|
2
|
-
#
|
3
|
-
# This file installs the 'rake package', 'rake gem' tasks and associates
|
4
|
-
# (clobber_package, repackage, ...). It is automatically generated by Noe
|
5
|
-
# from your .noespec file, and should therefore be configured there, under
|
6
|
-
# the variables/rake_tasks/gem entry, as illustrated below:
|
7
|
-
#
|
8
|
-
# variables:
|
9
|
-
# rake_tasks:
|
10
|
-
# gem:
|
11
|
-
# package_dir: pkg
|
12
|
-
# need_tar: false
|
13
|
-
# need_tar_gz: false
|
14
|
-
# need_tar_bz2: false
|
15
|
-
# need_zip: false
|
16
|
-
# ...
|
17
|
-
#
|
18
|
-
# If you have specific needs requiring manual intervention on this file,
|
19
|
-
# don't forget to set safe-override to false in your noe specification:
|
20
|
-
#
|
21
|
-
# template-info:
|
22
|
-
# manifest:
|
23
|
-
# tasks/gem.rake:
|
24
|
-
# safe-override: false
|
25
|
-
#
|
26
|
-
begin
|
27
|
-
require 'rubygems/package_task'
|
1
|
+
require 'rubygems/package_task'
|
28
2
|
|
29
|
-
|
30
|
-
|
31
|
-
|
3
|
+
# Dynamically load the gem spec
|
4
|
+
gemspec_file = File.expand_path('../../rack-robustness.gemspec', __FILE__)
|
5
|
+
gemspec = Kernel.eval(File.read(gemspec_file))
|
32
6
|
|
33
|
-
|
7
|
+
Gem::PackageTask.new(gemspec) do |t|
|
34
8
|
|
35
|
-
|
36
|
-
|
9
|
+
# Name of the package
|
10
|
+
t.name = gemspec.name
|
37
11
|
|
38
|
-
|
39
|
-
|
12
|
+
# Version of the package
|
13
|
+
t.version = gemspec.version
|
40
14
|
|
41
|
-
|
42
|
-
|
15
|
+
# Directory used to store the package files
|
16
|
+
t.package_dir = "pkg"
|
43
17
|
|
44
|
-
|
45
|
-
|
18
|
+
# True if a gzipped tar file (tgz) should be produced
|
19
|
+
t.need_tar = false
|
46
20
|
|
47
|
-
|
48
|
-
|
21
|
+
# True if a gzipped tar file (tar.gz) should be produced
|
22
|
+
t.need_tar_gz = false
|
49
23
|
|
50
|
-
|
51
|
-
|
24
|
+
# True if a bzip2'd tar file (tar.bz2) should be produced
|
25
|
+
t.need_tar_bz2 = false
|
52
26
|
|
53
|
-
|
54
|
-
|
27
|
+
# True if a zip file should be produced (default is false)
|
28
|
+
t.need_zip = false
|
55
29
|
|
56
|
-
|
57
|
-
|
30
|
+
# List of files to be included in the package.
|
31
|
+
t.package_files = gemspec.files
|
58
32
|
|
59
|
-
|
60
|
-
|
33
|
+
# Tar command for gzipped or bzip2ed archives.
|
34
|
+
t.tar_command = "tar"
|
61
35
|
|
62
|
-
|
63
|
-
|
36
|
+
# Zip command for zipped archives.
|
37
|
+
t.zip_command = "zip"
|
64
38
|
|
65
|
-
end
|
66
|
-
rescue LoadError
|
67
|
-
task :gem do
|
68
|
-
abort 'rubygems/package_task is not available. You should verify your rubygems installation'
|
69
|
-
end
|
70
|
-
task :package do
|
71
|
-
abort 'rubygems/package_task is not available. You should verify your rubygems installation'
|
72
|
-
end
|
73
39
|
end
|
data/tasks/test.rake
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
namespace :test do
|
2
|
+
require 'rspec/core/rake_task'
|
3
|
+
|
4
|
+
desc %q{Run all RSpec tests}
|
5
|
+
RSpec::Core::RakeTask.new(:unit) do |t|
|
6
|
+
t.rspec_opts = %w[-I. -Ilib -Ispec --pattern=spec/**/test_*.rb --color .]
|
7
|
+
end
|
8
|
+
|
9
|
+
task :all => :"unit"
|
10
|
+
end
|
11
|
+
task :test => :"test:all"
|
metadata
CHANGED
@@ -1,78 +1,69 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-robustness
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
5
|
-
prerelease:
|
4
|
+
version: 1.2.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Bernard Lambeau
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2023-06-09 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: rake
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- - ~>
|
17
|
+
- - "~>"
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '10.0'
|
22
20
|
type: :development
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- - ~>
|
24
|
+
- - "~>"
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '10.0'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: rspec
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- - ~>
|
31
|
+
- - "~>"
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: '2.12'
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- - ~>
|
38
|
+
- - "~>"
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '2.12'
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: rack
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- - ~>
|
45
|
+
- - "~>"
|
52
46
|
- !ruby/object:Gem::Version
|
53
47
|
version: '1.5'
|
54
48
|
type: :development
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- - ~>
|
52
|
+
- - "~>"
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: '1.5'
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: rack-test
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
|
-
- - ~>
|
59
|
+
- - "~>"
|
68
60
|
- !ruby/object:Gem::Version
|
69
61
|
version: '0.6'
|
70
62
|
type: :development
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
|
-
- - ~>
|
66
|
+
- - "~>"
|
76
67
|
- !ruby/object:Gem::Version
|
77
68
|
version: '0.6'
|
78
69
|
description: Rack::Robustness provides you with an easy way to handle errors in your
|
@@ -86,15 +77,15 @@ extra_rdoc_files:
|
|
86
77
|
- CHANGELOG.md
|
87
78
|
- LICENCE.md
|
88
79
|
files:
|
89
|
-
- rack-robustness.gemspec
|
90
80
|
- CHANGELOG.md
|
91
81
|
- Gemfile
|
92
82
|
- Gemfile.lock
|
93
|
-
- lib/rack/robustness.rb
|
94
83
|
- LICENCE.md
|
95
84
|
- Manifest.txt
|
96
|
-
- Rakefile
|
97
85
|
- README.md
|
86
|
+
- Rakefile
|
87
|
+
- lib/rack/robustness.rb
|
88
|
+
- rack-robustness.gemspec
|
98
89
|
- spec/spec_helper.rb
|
99
90
|
- spec/test_context.rb
|
100
91
|
- spec/test_ensure.rb
|
@@ -104,40 +95,35 @@ files:
|
|
104
95
|
- spec/test_robustness.rb
|
105
96
|
- spec/test_subclass.rb
|
106
97
|
- tasks/gem.rake
|
107
|
-
- tasks/
|
98
|
+
- tasks/test.rake
|
108
99
|
homepage: https://github.com/blambeau/rack-robustness
|
109
100
|
licenses: []
|
101
|
+
metadata: {}
|
110
102
|
post_install_message:
|
111
103
|
rdoc_options: []
|
112
104
|
require_paths:
|
113
105
|
- lib
|
114
106
|
required_ruby_version: !ruby/object:Gem::Requirement
|
115
|
-
none: false
|
116
107
|
requirements:
|
117
|
-
- -
|
108
|
+
- - ">="
|
118
109
|
- !ruby/object:Gem::Version
|
119
110
|
version: '0'
|
120
|
-
segments:
|
121
|
-
- 0
|
122
|
-
hash: -3037208557824391971
|
123
111
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
124
|
-
none: false
|
125
112
|
requirements:
|
126
|
-
- -
|
113
|
+
- - ">="
|
127
114
|
- !ruby/object:Gem::Version
|
128
115
|
version: '0'
|
129
116
|
requirements: []
|
130
|
-
|
131
|
-
rubygems_version: 1.8.25
|
117
|
+
rubygems_version: 3.1.6
|
132
118
|
signing_key:
|
133
|
-
specification_version:
|
119
|
+
specification_version: 4
|
134
120
|
summary: Rack::Robustness, the rescue clause of your Rack stack.
|
135
121
|
test_files:
|
136
|
-
- spec/spec_helper.rb
|
137
|
-
- spec/test_context.rb
|
138
|
-
- spec/test_ensure.rb
|
139
|
-
- spec/test_last_resort.rb
|
140
|
-
- spec/test_rescue.rb
|
141
122
|
- spec/test_response.rb
|
123
|
+
- spec/test_rescue.rb
|
142
124
|
- spec/test_robustness.rb
|
143
125
|
- spec/test_subclass.rb
|
126
|
+
- spec/test_ensure.rb
|
127
|
+
- spec/test_context.rb
|
128
|
+
- spec/spec_helper.rb
|
129
|
+
- spec/test_last_resort.rb
|
data/tasks/spec_test.rake
DELETED
@@ -1,71 +0,0 @@
|
|
1
|
-
# Installs a rake task for for running examples written using rspec.
|
2
|
-
#
|
3
|
-
# This file installs the 'rake spec_test' (aliased as 'rake spec') as well as
|
4
|
-
# extends 'rake test' to run spec tests, if any. It is automatically generated
|
5
|
-
# by Noe from your .noespec file, and should therefore be configured there,
|
6
|
-
# under the variables/rake_tasks/spec_test entry, as illustrated below:
|
7
|
-
#
|
8
|
-
# variables:
|
9
|
-
# rake_tasks:
|
10
|
-
# spec_test:
|
11
|
-
# pattern: spec/**/*_spec.rb
|
12
|
-
# verbose: true
|
13
|
-
# rspec_opts: [--color, --backtrace]
|
14
|
-
# ...
|
15
|
-
#
|
16
|
-
# If you have specific needs requiring manual intervention on this file,
|
17
|
-
# don't forget to set safe-override to false in your noe specification:
|
18
|
-
#
|
19
|
-
# template-info:
|
20
|
-
# manifest:
|
21
|
-
# tasks/spec_test.rake:
|
22
|
-
# safe-override: false
|
23
|
-
#
|
24
|
-
# This file has been written to conform to RSpec v2.4.0. More information about
|
25
|
-
# rspec and options of the rake task defined below can be found on
|
26
|
-
# http://relishapp.com/rspec
|
27
|
-
#
|
28
|
-
begin
|
29
|
-
require "rspec/core/rake_task"
|
30
|
-
desc "Run RSpec code examples"
|
31
|
-
RSpec::Core::RakeTask.new(:spec_test) do |t|
|
32
|
-
# Glob pattern to match files.
|
33
|
-
t.pattern = "spec/**/test_*.rb"
|
34
|
-
|
35
|
-
# Whether or not to fail Rake when an error occurs (typically when
|
36
|
-
# examples fail).
|
37
|
-
t.fail_on_error = true
|
38
|
-
|
39
|
-
# A message to print to stderr when there are failures.
|
40
|
-
t.failure_message = nil
|
41
|
-
|
42
|
-
# Use verbose output. If this is set to true, the task will print the
|
43
|
-
# executed spec command to stdout.
|
44
|
-
t.verbose = true
|
45
|
-
|
46
|
-
# Use rcov for code coverage?
|
47
|
-
t.rcov = false
|
48
|
-
|
49
|
-
# Path to rcov.
|
50
|
-
t.rcov_path = "rcov"
|
51
|
-
|
52
|
-
# Command line options to pass to rcov. See 'rcov --help' about this
|
53
|
-
t.rcov_opts = []
|
54
|
-
|
55
|
-
# Command line options to pass to ruby. See 'ruby --help' about this
|
56
|
-
t.ruby_opts = []
|
57
|
-
|
58
|
-
# Path to rspec
|
59
|
-
t.rspec_path = "rspec"
|
60
|
-
|
61
|
-
# Command line options to pass to rspec. See 'rspec --help' about this
|
62
|
-
t.rspec_opts = ["--color", "--backtrace"]
|
63
|
-
end
|
64
|
-
rescue LoadError => ex
|
65
|
-
task :spec_test do
|
66
|
-
abort 'rspec is not available. In order to run spec, you must: gem install rspec'
|
67
|
-
end
|
68
|
-
ensure
|
69
|
-
task :spec => [:spec_test]
|
70
|
-
task :test => [:spec_test]
|
71
|
-
end
|