grape-app 0.10.0 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +1 -1
- data/Gemfile.lock +71 -68
- data/Gemfile.rails6.lock +45 -47
- data/grape-app.gemspec +3 -4
- data/lib/grape/app/tasks/core.rake +1 -1
- data/lib/grape/app/tasks/databases.rake +2 -3
- data/lib/grape/app.rb +1 -1
- metadata +8 -34
- data/spec/grape/app/helpers/caching_spec.rb +0 -105
- data/spec/grape/app/helpers/params_spec.rb +0 -34
- data/spec/grape/app/middleware/connection_management_spec.rb +0 -22
- data/spec/grape/app_spec.rb +0 -102
- data/spec/scenario/Gemfile +0 -4
- data/spec/scenario/app/api/posts.rb +0 -5
- data/spec/scenario/app/api/v1.rb +0 -18
- data/spec/scenario/app/api.rb +0 -7
- data/spec/scenario/config/database.yml +0 -3
- data/spec/scenario/config/environments/test.rb +0 -16
- data/spec/scenario/config/locales/en.yml +0 -2
- data/spec/scenario/lib/my_lib.rb +0 -16
- data/spec/spec_helper.rb +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 39ce25e8c0f9c276a8c2c22d1b6138b1160172e850236ffe8ea959880851d375
|
4
|
+
data.tar.gz: 6380778138b98ee32ae6a844cb82a37adaa48d3747e7395c8eec21d478400a92
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4479eb190adf06cd626071cd8be85146331c15f18a82fc20204c2c33dd466697aa85add791cc05dd24e0d690630538ed50573eb73a23d798a4d093eed8b2c1a0
|
7
|
+
data.tar.gz: 2a39eb90dcfff318003aef1c68246f25c674a543630f01adb2299bf71b8e12543e991a15df01056e9534b1b7607105bf01862a9e5e292198f9c5559af15ce505
|
data/.github/workflows/test.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,134 +1,137 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
grape-app (0.
|
4
|
+
grape-app (0.11.0)
|
5
5
|
activesupport
|
6
|
-
grape (>= 1.
|
6
|
+
grape (>= 1.7)
|
7
7
|
grape-entity
|
8
8
|
openssl
|
9
9
|
rack-cors (>= 1.1)
|
10
10
|
rack-ssl-enforcer
|
11
11
|
thor
|
12
|
-
zeitwerk (>= 2.
|
12
|
+
zeitwerk (>= 2.6)
|
13
13
|
|
14
14
|
GEM
|
15
15
|
remote: https://rubygems.org/
|
16
16
|
specs:
|
17
|
-
activejob (7.0.1)
|
18
|
-
activesupport (= 7.0.1)
|
17
|
+
activejob (7.0.4.1)
|
18
|
+
activesupport (= 7.0.4.1)
|
19
19
|
globalid (>= 0.3.6)
|
20
|
-
activemodel (7.0.1)
|
21
|
-
activesupport (= 7.0.1)
|
22
|
-
activerecord (7.0.1)
|
23
|
-
activemodel (= 7.0.1)
|
24
|
-
activesupport (= 7.0.1)
|
25
|
-
activesupport (7.0.1)
|
20
|
+
activemodel (7.0.4.1)
|
21
|
+
activesupport (= 7.0.4.1)
|
22
|
+
activerecord (7.0.4.1)
|
23
|
+
activemodel (= 7.0.4.1)
|
24
|
+
activesupport (= 7.0.4.1)
|
25
|
+
activesupport (7.0.4.1)
|
26
26
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
27
27
|
i18n (>= 1.6, < 2)
|
28
28
|
minitest (>= 5.1)
|
29
29
|
tzinfo (~> 2.0)
|
30
30
|
ast (2.4.2)
|
31
31
|
builder (3.2.4)
|
32
|
-
concurrent-ruby (1.1.
|
32
|
+
concurrent-ruby (1.1.10)
|
33
33
|
diff-lcs (1.5.0)
|
34
|
-
dry-
|
34
|
+
dry-core (1.0.0)
|
35
35
|
concurrent-ruby (~> 1.0)
|
36
|
-
|
37
|
-
dry-
|
36
|
+
zeitwerk (~> 2.6)
|
37
|
+
dry-inflector (1.0.0)
|
38
|
+
dry-logic (1.5.0)
|
38
39
|
concurrent-ruby (~> 1.0)
|
39
|
-
dry-
|
40
|
-
|
40
|
+
dry-core (~> 1.0, < 2)
|
41
|
+
zeitwerk (~> 2.6)
|
42
|
+
dry-types (1.7.0)
|
41
43
|
concurrent-ruby (~> 1.0)
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
concurrent-ruby (~> 1.0)
|
48
|
-
dry-container (~> 0.3)
|
49
|
-
dry-core (~> 0.5, >= 0.5)
|
50
|
-
dry-inflector (~> 0.1, >= 0.1.2)
|
51
|
-
dry-logic (~> 1.0, >= 1.0.2)
|
52
|
-
globalid (1.0.0)
|
44
|
+
dry-core (~> 1.0, < 2)
|
45
|
+
dry-inflector (~> 1.0, < 2)
|
46
|
+
dry-logic (>= 1.4, < 2)
|
47
|
+
zeitwerk (~> 2.6)
|
48
|
+
globalid (1.0.1)
|
53
49
|
activesupport (>= 5.0)
|
54
|
-
grape (1.
|
50
|
+
grape (1.7.0)
|
55
51
|
activesupport
|
56
52
|
builder
|
57
53
|
dry-types (>= 1.1)
|
58
54
|
mustermann-grape (~> 1.0.0)
|
59
55
|
rack (>= 1.3.0)
|
60
56
|
rack-accept
|
61
|
-
grape-entity (0.10.
|
57
|
+
grape-entity (0.10.2)
|
62
58
|
activesupport (>= 3.0.0)
|
63
59
|
multi_json (>= 1.3.2)
|
64
|
-
i18n (1.
|
60
|
+
i18n (1.12.0)
|
65
61
|
concurrent-ruby (~> 1.0)
|
66
|
-
|
62
|
+
json (2.6.3)
|
63
|
+
mini_portile2 (2.8.1)
|
64
|
+
minitest (5.17.0)
|
67
65
|
multi_json (1.15.0)
|
68
|
-
mustermann (
|
66
|
+
mustermann (3.0.0)
|
69
67
|
ruby2_keywords (~> 0.0.1)
|
70
|
-
mustermann-grape (1.0.
|
68
|
+
mustermann-grape (1.0.2)
|
71
69
|
mustermann (>= 1.0.0)
|
72
|
-
openssl (3.
|
73
|
-
parallel (1.
|
74
|
-
parser (3.
|
70
|
+
openssl (3.1.0)
|
71
|
+
parallel (1.22.1)
|
72
|
+
parser (3.2.0.0)
|
75
73
|
ast (~> 2.4.1)
|
76
|
-
rack (
|
74
|
+
rack (3.0.4.1)
|
77
75
|
rack-accept (0.4.5)
|
78
76
|
rack (>= 0.4)
|
79
77
|
rack-cors (1.1.1)
|
80
78
|
rack (>= 2.0.0)
|
81
79
|
rack-ssl-enforcer (0.2.9)
|
82
|
-
rack-test (
|
83
|
-
rack (>= 1.
|
80
|
+
rack-test (2.0.2)
|
81
|
+
rack (>= 1.3)
|
84
82
|
rainbow (3.1.1)
|
85
83
|
rake (13.0.6)
|
86
|
-
regexp_parser (2.2
|
84
|
+
regexp_parser (2.6.2)
|
87
85
|
rexml (3.2.5)
|
88
|
-
rspec (3.
|
89
|
-
rspec-core (~> 3.
|
90
|
-
rspec-expectations (~> 3.
|
91
|
-
rspec-mocks (~> 3.
|
92
|
-
rspec-core (3.
|
93
|
-
rspec-support (~> 3.
|
94
|
-
rspec-expectations (3.
|
86
|
+
rspec (3.12.0)
|
87
|
+
rspec-core (~> 3.12.0)
|
88
|
+
rspec-expectations (~> 3.12.0)
|
89
|
+
rspec-mocks (~> 3.12.0)
|
90
|
+
rspec-core (3.12.0)
|
91
|
+
rspec-support (~> 3.12.0)
|
92
|
+
rspec-expectations (3.12.2)
|
95
93
|
diff-lcs (>= 1.2.0, < 2.0)
|
96
|
-
rspec-support (~> 3.
|
97
|
-
rspec-mocks (3.
|
94
|
+
rspec-support (~> 3.12.0)
|
95
|
+
rspec-mocks (3.12.3)
|
98
96
|
diff-lcs (>= 1.2.0, < 2.0)
|
99
|
-
rspec-support (~> 3.
|
100
|
-
rspec-support (3.
|
101
|
-
rubocop (1.
|
97
|
+
rspec-support (~> 3.12.0)
|
98
|
+
rspec-support (3.12.0)
|
99
|
+
rubocop (1.43.0)
|
100
|
+
json (~> 2.3)
|
102
101
|
parallel (~> 1.10)
|
103
|
-
parser (>= 3.
|
102
|
+
parser (>= 3.2.0.0)
|
104
103
|
rainbow (>= 2.2.2, < 4.0)
|
105
104
|
regexp_parser (>= 1.8, < 3.0)
|
106
|
-
rexml
|
107
|
-
rubocop-ast (>= 1.
|
105
|
+
rexml (>= 3.2.5, < 4.0)
|
106
|
+
rubocop-ast (>= 1.24.1, < 2.0)
|
108
107
|
ruby-progressbar (~> 1.7)
|
109
|
-
unicode-display_width (>=
|
110
|
-
rubocop-ast (1.
|
111
|
-
parser (>= 3.
|
112
|
-
rubocop-bsm (0.6.
|
108
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
109
|
+
rubocop-ast (1.24.1)
|
110
|
+
parser (>= 3.1.1.0)
|
111
|
+
rubocop-bsm (0.6.1)
|
113
112
|
rubocop (~> 1.0)
|
114
113
|
rubocop-performance
|
115
114
|
rubocop-rake
|
116
115
|
rubocop-rspec
|
117
|
-
rubocop-
|
116
|
+
rubocop-capybara (2.17.0)
|
117
|
+
rubocop (~> 1.41)
|
118
|
+
rubocop-performance (1.15.2)
|
118
119
|
rubocop (>= 1.7.0, < 2.0)
|
119
120
|
rubocop-ast (>= 0.4.0)
|
120
121
|
rubocop-rake (0.6.0)
|
121
122
|
rubocop (~> 1.0)
|
122
|
-
rubocop-rspec (2.
|
123
|
-
rubocop (~> 1.
|
123
|
+
rubocop-rspec (2.18.1)
|
124
|
+
rubocop (~> 1.33)
|
125
|
+
rubocop-capybara (~> 2.17)
|
124
126
|
ruby-progressbar (1.11.0)
|
125
127
|
ruby2_keywords (0.0.5)
|
126
|
-
sqlite3 (1.
|
128
|
+
sqlite3 (1.6.0)
|
129
|
+
mini_portile2 (~> 2.8.0)
|
127
130
|
thor (1.2.1)
|
128
|
-
tzinfo (2.0.
|
131
|
+
tzinfo (2.0.5)
|
129
132
|
concurrent-ruby (~> 1.0)
|
130
|
-
unicode-display_width (2.
|
131
|
-
zeitwerk (2.
|
133
|
+
unicode-display_width (2.4.2)
|
134
|
+
zeitwerk (2.6.6)
|
132
135
|
|
133
136
|
PLATFORMS
|
134
137
|
ruby
|
@@ -145,4 +148,4 @@ DEPENDENCIES
|
|
145
148
|
sqlite3
|
146
149
|
|
147
150
|
BUNDLED WITH
|
148
|
-
2.3.
|
151
|
+
2.3.9
|
data/Gemfile.rails6.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
grape-app (0.10.
|
4
|
+
grape-app (0.10.1)
|
5
5
|
activesupport
|
6
6
|
grape (>= 1.2)
|
7
7
|
grape-entity
|
@@ -14,15 +14,15 @@ PATH
|
|
14
14
|
GEM
|
15
15
|
remote: https://rubygems.org/
|
16
16
|
specs:
|
17
|
-
activejob (6.1.
|
18
|
-
activesupport (= 6.1.
|
17
|
+
activejob (6.1.6.1)
|
18
|
+
activesupport (= 6.1.6.1)
|
19
19
|
globalid (>= 0.3.6)
|
20
|
-
activemodel (6.1.
|
21
|
-
activesupport (= 6.1.
|
22
|
-
activerecord (6.1.
|
23
|
-
activemodel (= 6.1.
|
24
|
-
activesupport (= 6.1.
|
25
|
-
activesupport (6.1.
|
20
|
+
activemodel (6.1.6.1)
|
21
|
+
activesupport (= 6.1.6.1)
|
22
|
+
activerecord (6.1.6.1)
|
23
|
+
activemodel (= 6.1.6.1)
|
24
|
+
activesupport (= 6.1.6.1)
|
25
|
+
activesupport (6.1.6.1)
|
26
26
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
27
27
|
i18n (>= 1.6, < 2)
|
28
28
|
minitest (>= 5.1)
|
@@ -30,17 +30,13 @@ GEM
|
|
30
30
|
zeitwerk (~> 2.3)
|
31
31
|
ast (2.4.2)
|
32
32
|
builder (3.2.4)
|
33
|
-
concurrent-ruby (1.1.
|
33
|
+
concurrent-ruby (1.1.10)
|
34
34
|
diff-lcs (1.5.0)
|
35
|
-
dry-
|
35
|
+
dry-container (0.10.0)
|
36
36
|
concurrent-ruby (~> 1.0)
|
37
|
-
dry-core (~> 0.6)
|
38
|
-
dry-container (0.9.0)
|
39
|
-
concurrent-ruby (~> 1.0)
|
40
|
-
dry-configurable (~> 0.13, >= 0.13.0)
|
41
37
|
dry-core (0.7.1)
|
42
38
|
concurrent-ruby (~> 1.0)
|
43
|
-
dry-inflector (0.
|
39
|
+
dry-inflector (0.3.0)
|
44
40
|
dry-logic (1.2.0)
|
45
41
|
concurrent-ruby (~> 1.0)
|
46
42
|
dry-core (~> 0.5, >= 0.5)
|
@@ -62,74 +58,76 @@ GEM
|
|
62
58
|
grape-entity (0.10.1)
|
63
59
|
activesupport (>= 3.0.0)
|
64
60
|
multi_json (>= 1.3.2)
|
65
|
-
i18n (1.
|
61
|
+
i18n (1.11.0)
|
66
62
|
concurrent-ruby (~> 1.0)
|
67
|
-
|
63
|
+
json (2.6.2)
|
64
|
+
minitest (5.16.2)
|
68
65
|
multi_json (1.15.0)
|
69
66
|
mustermann (1.1.1)
|
70
67
|
ruby2_keywords (~> 0.0.1)
|
71
|
-
mustermann-grape (1.0.
|
68
|
+
mustermann-grape (1.0.2)
|
72
69
|
mustermann (>= 1.0.0)
|
73
70
|
openssl (3.0.0)
|
74
|
-
parallel (1.
|
75
|
-
parser (3.1.
|
71
|
+
parallel (1.22.1)
|
72
|
+
parser (3.1.2.0)
|
76
73
|
ast (~> 2.4.1)
|
77
|
-
rack (2.2.
|
74
|
+
rack (2.2.4)
|
78
75
|
rack-accept (0.4.5)
|
79
76
|
rack (>= 0.4)
|
80
77
|
rack-cors (1.1.1)
|
81
78
|
rack (>= 2.0.0)
|
82
79
|
rack-ssl-enforcer (0.2.9)
|
83
|
-
rack-test (
|
84
|
-
rack (>= 1.
|
80
|
+
rack-test (2.0.2)
|
81
|
+
rack (>= 1.3)
|
85
82
|
rainbow (3.1.1)
|
86
83
|
rake (13.0.6)
|
87
|
-
regexp_parser (2.
|
84
|
+
regexp_parser (2.5.0)
|
88
85
|
rexml (3.2.5)
|
89
|
-
rspec (3.
|
90
|
-
rspec-core (~> 3.
|
91
|
-
rspec-expectations (~> 3.
|
92
|
-
rspec-mocks (~> 3.
|
93
|
-
rspec-core (3.
|
94
|
-
rspec-support (~> 3.
|
95
|
-
rspec-expectations (3.
|
86
|
+
rspec (3.11.0)
|
87
|
+
rspec-core (~> 3.11.0)
|
88
|
+
rspec-expectations (~> 3.11.0)
|
89
|
+
rspec-mocks (~> 3.11.0)
|
90
|
+
rspec-core (3.11.0)
|
91
|
+
rspec-support (~> 3.11.0)
|
92
|
+
rspec-expectations (3.11.0)
|
96
93
|
diff-lcs (>= 1.2.0, < 2.0)
|
97
|
-
rspec-support (~> 3.
|
98
|
-
rspec-mocks (3.
|
94
|
+
rspec-support (~> 3.11.0)
|
95
|
+
rspec-mocks (3.11.1)
|
99
96
|
diff-lcs (>= 1.2.0, < 2.0)
|
100
|
-
rspec-support (~> 3.
|
101
|
-
rspec-support (3.
|
102
|
-
rubocop (1.
|
97
|
+
rspec-support (~> 3.11.0)
|
98
|
+
rspec-support (3.11.0)
|
99
|
+
rubocop (1.31.2)
|
100
|
+
json (~> 2.3)
|
103
101
|
parallel (~> 1.10)
|
104
102
|
parser (>= 3.1.0.0)
|
105
103
|
rainbow (>= 2.2.2, < 4.0)
|
106
104
|
regexp_parser (>= 1.8, < 3.0)
|
107
|
-
rexml
|
108
|
-
rubocop-ast (>= 1.
|
105
|
+
rexml (>= 3.2.5, < 4.0)
|
106
|
+
rubocop-ast (>= 1.18.0, < 2.0)
|
109
107
|
ruby-progressbar (~> 1.7)
|
110
108
|
unicode-display_width (>= 1.4.0, < 3.0)
|
111
|
-
rubocop-ast (1.
|
112
|
-
parser (>= 3.
|
109
|
+
rubocop-ast (1.19.1)
|
110
|
+
parser (>= 3.1.1.0)
|
113
111
|
rubocop-bsm (0.6.0)
|
114
112
|
rubocop (~> 1.0)
|
115
113
|
rubocop-performance
|
116
114
|
rubocop-rake
|
117
115
|
rubocop-rspec
|
118
|
-
rubocop-performance (1.
|
116
|
+
rubocop-performance (1.14.2)
|
119
117
|
rubocop (>= 1.7.0, < 2.0)
|
120
118
|
rubocop-ast (>= 0.4.0)
|
121
119
|
rubocop-rake (0.6.0)
|
122
120
|
rubocop (~> 1.0)
|
123
|
-
rubocop-rspec (2.
|
124
|
-
rubocop (~> 1.
|
121
|
+
rubocop-rspec (2.12.1)
|
122
|
+
rubocop (~> 1.31)
|
125
123
|
ruby-progressbar (1.11.0)
|
126
124
|
ruby2_keywords (0.0.5)
|
127
|
-
sqlite3 (1.4.
|
125
|
+
sqlite3 (1.4.4)
|
128
126
|
thor (1.2.1)
|
129
127
|
tzinfo (2.0.4)
|
130
128
|
concurrent-ruby (~> 1.0)
|
131
|
-
unicode-display_width (2.
|
132
|
-
zeitwerk (2.
|
129
|
+
unicode-display_width (2.2.0)
|
130
|
+
zeitwerk (2.6.0)
|
133
131
|
|
134
132
|
PLATFORMS
|
135
133
|
x86_64-linux
|
data/grape-app.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'grape-app'
|
3
|
-
s.version = '0.
|
3
|
+
s.version = '0.11.0'
|
4
4
|
s.authors = ['Black Square Media Ltd']
|
5
5
|
s.email = ['info@blacksquaremedia.com']
|
6
6
|
s.summary = %(Standalone Grape API apps)
|
@@ -9,19 +9,18 @@ Gem::Specification.new do |s|
|
|
9
9
|
s.license = 'MIT'
|
10
10
|
|
11
11
|
s.files = `git ls-files -z`.split("\x0").reject {|f| f.match(%r{^spec/}) }
|
12
|
-
s.test_files = `git ls-files -z -- spec/*`.split("\x0")
|
13
12
|
s.executables = ['grape-app']
|
14
13
|
s.require_paths = ['lib']
|
15
14
|
s.required_ruby_version = '>= 2.7'
|
16
15
|
|
17
16
|
s.add_dependency 'activesupport'
|
18
|
-
s.add_dependency 'grape', '>= 1.
|
17
|
+
s.add_dependency 'grape', '>= 1.7'
|
19
18
|
s.add_dependency 'grape-entity'
|
20
19
|
s.add_dependency 'openssl'
|
21
20
|
s.add_dependency 'rack-cors', '>= 1.1'
|
22
21
|
s.add_dependency 'rack-ssl-enforcer'
|
23
22
|
s.add_dependency 'thor'
|
24
|
-
s.add_dependency 'zeitwerk', '>= 2.
|
23
|
+
s.add_dependency 'zeitwerk', '>= 2.6'
|
25
24
|
|
26
25
|
s.add_development_dependency 'activejob'
|
27
26
|
s.add_development_dependency 'activerecord'
|
@@ -23,11 +23,10 @@ namespace :db do
|
|
23
23
|
|
24
24
|
desc 'Create a new migration using NAME'
|
25
25
|
task migration: :environment do
|
26
|
-
|
26
|
+
name = ENV.fetch('NAME', nil)
|
27
|
+
abort 'No NAME specified. Example usage: `rake db:migration NAME=create_widgets`' unless name
|
27
28
|
|
28
29
|
migrations_path = ActiveRecord::Migrator.migrations_paths.first
|
29
|
-
|
30
|
-
name = ENV['NAME']
|
31
30
|
path = File.join(migrations_path, "#{Time.now.utc.strftime('%Y%m%d%H%M%S')}_#{name}.rb")
|
32
31
|
|
33
32
|
ar_version = [ActiveRecord::VERSION::MAJOR, ActiveRecord::VERSION::MINOR].join('.')
|
data/lib/grape/app.rb
CHANGED
@@ -62,7 +62,7 @@ class Grape::App < Grape::API
|
|
62
62
|
|
63
63
|
# @return [ActiveSupport::StringInquirer] env name
|
64
64
|
def env
|
65
|
-
@env ||= ActiveSupport::StringInquirer.new(ENV
|
65
|
+
@env ||= ActiveSupport::StringInquirer.new(ENV.fetch('GRAPE_ENV') { ENV.fetch('RACK_ENV', 'development') })
|
66
66
|
end
|
67
67
|
|
68
68
|
# @return [Zeitwerk::Loader] loader
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: grape-app
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Black Square Media Ltd
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-01-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '1.
|
33
|
+
version: '1.7'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '1.
|
40
|
+
version: '1.7'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: grape-entity
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -114,14 +114,14 @@ dependencies:
|
|
114
114
|
requirements:
|
115
115
|
- - ">="
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: '2.
|
117
|
+
version: '2.6'
|
118
118
|
type: :runtime
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: '2.
|
124
|
+
version: '2.6'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: activejob
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -285,19 +285,6 @@ files:
|
|
285
285
|
- lib/grape/app/templates/db/seeds.rb
|
286
286
|
- lib/grape/app/templates/spec/spec_helper.rb
|
287
287
|
- lib/grape_app.rb
|
288
|
-
- spec/grape/app/helpers/caching_spec.rb
|
289
|
-
- spec/grape/app/helpers/params_spec.rb
|
290
|
-
- spec/grape/app/middleware/connection_management_spec.rb
|
291
|
-
- spec/grape/app_spec.rb
|
292
|
-
- spec/scenario/Gemfile
|
293
|
-
- spec/scenario/app/api.rb
|
294
|
-
- spec/scenario/app/api/posts.rb
|
295
|
-
- spec/scenario/app/api/v1.rb
|
296
|
-
- spec/scenario/config/database.yml
|
297
|
-
- spec/scenario/config/environments/test.rb
|
298
|
-
- spec/scenario/config/locales/en.yml
|
299
|
-
- spec/scenario/lib/my_lib.rb
|
300
|
-
- spec/spec_helper.rb
|
301
288
|
homepage: https://github.com/bsm/grape-app
|
302
289
|
licenses:
|
303
290
|
- MIT
|
@@ -318,21 +305,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
318
305
|
- !ruby/object:Gem::Version
|
319
306
|
version: '0'
|
320
307
|
requirements: []
|
321
|
-
rubygems_version: 3.3.
|
308
|
+
rubygems_version: 3.3.7
|
322
309
|
signing_key:
|
323
310
|
specification_version: 4
|
324
311
|
summary: Standalone Grape API apps
|
325
|
-
test_files:
|
326
|
-
- spec/grape/app/helpers/caching_spec.rb
|
327
|
-
- spec/grape/app/helpers/params_spec.rb
|
328
|
-
- spec/grape/app/middleware/connection_management_spec.rb
|
329
|
-
- spec/grape/app_spec.rb
|
330
|
-
- spec/scenario/Gemfile
|
331
|
-
- spec/scenario/app/api.rb
|
332
|
-
- spec/scenario/app/api/posts.rb
|
333
|
-
- spec/scenario/app/api/v1.rb
|
334
|
-
- spec/scenario/config/database.yml
|
335
|
-
- spec/scenario/config/environments/test.rb
|
336
|
-
- spec/scenario/config/locales/en.yml
|
337
|
-
- spec/scenario/lib/my_lib.rb
|
338
|
-
- spec/spec_helper.rb
|
312
|
+
test_files: []
|
@@ -1,105 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
RSpec.describe Grape::App::Helpers::Caching do
|
4
|
-
include Rack::Test::Methods
|
5
|
-
|
6
|
-
let :app do
|
7
|
-
helper = described_class
|
8
|
-
Class.new(Grape::API) do
|
9
|
-
format :json
|
10
|
-
|
11
|
-
helpers helper
|
12
|
-
|
13
|
-
get '/articles' do
|
14
|
-
scope = Article.order(:id)
|
15
|
-
opts = params[:public] ? { public: params[:public] } : {}
|
16
|
-
fresh_when(scope, **opts)
|
17
|
-
scope.to_a
|
18
|
-
end
|
19
|
-
|
20
|
-
get '/articles/never_updated' do
|
21
|
-
article = Article.first
|
22
|
-
article.updated_at = nil
|
23
|
-
|
24
|
-
fresh_when(article, last_modified_field: :created_at)
|
25
|
-
end
|
26
|
-
|
27
|
-
get '/articles/:id' do
|
28
|
-
article = Article.first
|
29
|
-
article if stale?(article, stale_if_error: 5, extras: { a: 1, b: 2 })
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
let(:created_at) { Time.at(1515151500).utc }
|
34
|
-
|
35
|
-
before do
|
36
|
-
Article.create! title: 'Welcome', created_at: created_at, updated_at: created_at + 10
|
37
|
-
Article.create! title: 'Bye', created_at: created_at, updated_at: created_at + 20
|
38
|
-
end
|
39
|
-
|
40
|
-
it 'handles fresh-when' do
|
41
|
-
get '/articles'
|
42
|
-
expect(last_response.status).to eq(200)
|
43
|
-
expect(last_response.headers).to include(
|
44
|
-
'Content-Type' => 'application/json',
|
45
|
-
'ETag' => 'a5f6c4b024510c9835d8d70cbd3ed00c',
|
46
|
-
'Last-Modified' => 'Fri, 05 Jan 2018 11:25:20 GMT',
|
47
|
-
)
|
48
|
-
expect(JSON.parse(last_response.body).size).to eq(2)
|
49
|
-
|
50
|
-
get '/articles', {}, 'HTTP_IF_NONE_MATCH' => last_response.headers['ETag']
|
51
|
-
expect(last_response.status).to eq(304)
|
52
|
-
get '/articles', {}, 'HTTP_IF_MODIFIED_SINCE' => 'Fri, 05 Jan 2018 11:25:20 GMT'
|
53
|
-
expect(last_response.status).to eq(304)
|
54
|
-
get '/articles', {}, 'HTTP_IF_NONE_MATCH' => last_response.headers['ETag'], 'HTTP_IF_MODIFIED_SINCE' => 'Fri, 05 Jan 2018 11:25:21 GMT'
|
55
|
-
expect(last_response.status).to eq(304)
|
56
|
-
|
57
|
-
get '/articles', {}, 'HTTP_IF_MODIFIED_SINCE' => 'Fri, 05 Jan 2018 11:25:19 GMT'
|
58
|
-
expect(last_response.status).to eq(200)
|
59
|
-
get '/articles', {}, 'HTTP_IF_MODIFIED_SINCE' => 'Fri, 05 Jan 2018 11:25:19 GMT', 'HTTP_IF_NONE_MATCH' => last_response.headers['ETag']
|
60
|
-
expect(last_response.status).to eq(200)
|
61
|
-
get '/articles', {}, 'HTTP_IF_MODIFIED_SINCE' => 'Fri, 05 Jan 2018 11:25:20 GMT', 'HTTP_IF_NONE_MATCH' => 'other'
|
62
|
-
expect(last_response.status).to eq(200)
|
63
|
-
end
|
64
|
-
|
65
|
-
it 'handles fresh_when for records that were never updated' do
|
66
|
-
get '/articles/never_updated'
|
67
|
-
expect(last_response.status).to eq(200)
|
68
|
-
expect(last_response.headers).to include(
|
69
|
-
'Last-Modified' => 'Fri, 05 Jan 2018 11:25:00 GMT',
|
70
|
-
)
|
71
|
-
end
|
72
|
-
|
73
|
-
it 'supports cache-control' do
|
74
|
-
get '/articles?public=true'
|
75
|
-
expect(last_response.status).to eq(200)
|
76
|
-
expect(last_response.headers).to include(
|
77
|
-
'Cache-Control' => 'public',
|
78
|
-
)
|
79
|
-
end
|
80
|
-
|
81
|
-
it 'handles stale? (with cache-control)' do
|
82
|
-
get '/articles/1'
|
83
|
-
expect(last_response.status).to eq(200)
|
84
|
-
expect(last_response.headers).to include(
|
85
|
-
'Cache-Control' => 'private, stale-if-error=5, a=1, b=2',
|
86
|
-
'Content-Type' => 'application/json',
|
87
|
-
'ETag' => '0154407bafc97186a494a05e0652ff61',
|
88
|
-
'Last-Modified' => 'Fri, 05 Jan 2018 11:25:10 GMT',
|
89
|
-
)
|
90
|
-
expect(JSON.parse(last_response.body)).to eq(
|
91
|
-
'id' => 1,
|
92
|
-
'title' => 'Welcome',
|
93
|
-
'updated_at' => '2018-01-05T11:25:10.000Z',
|
94
|
-
'created_at' => '2018-01-05T11:25:00.000Z',
|
95
|
-
)
|
96
|
-
|
97
|
-
get '/articles/1', {}, 'HTTP_IF_NONE_MATCH' => last_response.headers['ETag']
|
98
|
-
expect(last_response.status).to eq(304)
|
99
|
-
expect(last_response.headers).to include(
|
100
|
-
'Cache-Control' => 'private, stale-if-error=5, a=1, b=2',
|
101
|
-
'ETag' => '0154407bafc97186a494a05e0652ff61',
|
102
|
-
'Last-Modified' => 'Fri, 05 Jan 2018 11:25:10 GMT',
|
103
|
-
)
|
104
|
-
end
|
105
|
-
end
|
@@ -1,34 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
RSpec.describe Grape::App::Helpers::Params do
|
4
|
-
include Rack::Test::Methods
|
5
|
-
|
6
|
-
let :app do
|
7
|
-
helper = described_class
|
8
|
-
Class.new(Grape::API) do
|
9
|
-
format :json
|
10
|
-
|
11
|
-
helpers helper
|
12
|
-
|
13
|
-
params do
|
14
|
-
optional :title
|
15
|
-
end
|
16
|
-
post '/articles' do
|
17
|
-
attrs = { id: 9, updated_at: Time.at(1515151515).utc }
|
18
|
-
attrs.update(declared_params)
|
19
|
-
Article.new(attrs)
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
it 'limits params' do
|
25
|
-
post '/articles', title: 'Today', id: 1234, updated_at: Time.now
|
26
|
-
expect(last_response.status).to eq(201)
|
27
|
-
expect(JSON.parse(last_response.body)).to eq(
|
28
|
-
'created_at' => nil,
|
29
|
-
'id' => 9,
|
30
|
-
'title' => 'Today',
|
31
|
-
'updated_at' => '2018-01-05T11:25:15.000Z',
|
32
|
-
)
|
33
|
-
end
|
34
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
RSpec.describe Grape::App::Middleware::ConnectionManagement do
|
4
|
-
include Rack::Test::Methods
|
5
|
-
|
6
|
-
let :app do
|
7
|
-
failing = ->(_) { raise(ActiveRecord::StatementInvalid) }
|
8
|
-
middleware = described_class
|
9
|
-
Rack::Builder.new do
|
10
|
-
use middleware
|
11
|
-
run failing
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
it 'clears active connections' do
|
16
|
-
ActiveRecord::Base.connection
|
17
|
-
expect(ActiveRecord::Base.connection_handler).to be_active_connections
|
18
|
-
|
19
|
-
expect { get '/' }.to raise_error(ActiveRecord::StatementInvalid)
|
20
|
-
expect(ActiveRecord::Base.connection_handler).not_to be_active_connections
|
21
|
-
end
|
22
|
-
end
|
data/spec/grape/app_spec.rb
DELETED
@@ -1,102 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
RSpec.describe Grape::App do
|
4
|
-
include Rack::Test::Methods
|
5
|
-
|
6
|
-
subject { described_class }
|
7
|
-
|
8
|
-
before { subject.init! File.expand_path('../scenario', __dir__) }
|
9
|
-
|
10
|
-
def app
|
11
|
-
subject.middleware
|
12
|
-
end
|
13
|
-
|
14
|
-
it 'has an env' do
|
15
|
-
expect(subject.env).to be_instance_of(ActiveSupport::StringInquirer)
|
16
|
-
expect(subject.env).to eq('test')
|
17
|
-
end
|
18
|
-
|
19
|
-
it 'has an root' do
|
20
|
-
expect(subject.root).to be_instance_of(Pathname)
|
21
|
-
end
|
22
|
-
|
23
|
-
it 'is an API instance' do
|
24
|
-
expect(subject).to be < Grape::API
|
25
|
-
end
|
26
|
-
|
27
|
-
it 'inits with default time zone' do
|
28
|
-
expect(Time.zone.name).to eq('UTC')
|
29
|
-
expect(Thread.new { Time.zone }.value.name).to eq('UTC')
|
30
|
-
end
|
31
|
-
|
32
|
-
it 'configures i18n' do
|
33
|
-
expect(I18n.load_path).to include(subject.root.join('config', 'locales', 'en.yml').to_s)
|
34
|
-
expect(I18n.default_locale).to eq(:en)
|
35
|
-
expect(I18n.exception_handler).to be_a(I18n::ExceptionHandler)
|
36
|
-
end
|
37
|
-
|
38
|
-
it 'configures ActiveSupport' do
|
39
|
-
expect(ActiveSupport.to_time_preserves_timezone).to be(true)
|
40
|
-
expect(ActiveSupport.utc_to_local_returns_utc_offset_times).to be(true)
|
41
|
-
expect(ActiveSupport::Digest.hash_digest_class).to be(OpenSSL::Digest::SHA256)
|
42
|
-
expect(ActiveSupport::MessageEncryptor.use_authenticated_message_encryption).to be(true)
|
43
|
-
if ActiveSupport::VERSION::MAJOR >= 7
|
44
|
-
expect(ActiveSupport::KeyGenerator.hash_digest_class).to be(OpenSSL::Digest::SHA256)
|
45
|
-
expect(ActiveSupport::IsolatedExecutionState.isolation_level).to be(:thread)
|
46
|
-
expect(Digest::UUID.use_rfc4122_namespaced_uuids).to be(true)
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
it 'configures ActiveRecord' do
|
51
|
-
if ActiveRecord::VERSION::MAJOR >= 7
|
52
|
-
expect(ActiveRecord.default_timezone).to be(:utc)
|
53
|
-
expect(ActiveRecord.legacy_connection_handling).to be(false)
|
54
|
-
expect(ActiveRecord.verify_foreign_keys_for_fixtures).to be(true)
|
55
|
-
expect(ActiveRecord::Base.partial_inserts).to be(false)
|
56
|
-
expect(ActiveRecord::Base.automatic_scope_inversing).to be(true)
|
57
|
-
end
|
58
|
-
expect(ActiveRecord::Base.belongs_to_required_by_default).to be(true)
|
59
|
-
expect(ActiveRecord::Base.cache_versioning).to be(true)
|
60
|
-
expect(ActiveRecord::Base.collection_cache_versioning).to be(true)
|
61
|
-
expect(ActiveRecord::Base.has_many_inversing).to be(true)
|
62
|
-
end
|
63
|
-
|
64
|
-
it 'configures ActiveJob' do
|
65
|
-
expect(ActiveJob::Base.retry_jitter).to eq(0.15)
|
66
|
-
end
|
67
|
-
|
68
|
-
it 'reads env specific initializers' do
|
69
|
-
expect(subject.config).to include(
|
70
|
-
:test_specific,
|
71
|
-
:raise_on_missing_translations,
|
72
|
-
:cors,
|
73
|
-
:middleware,
|
74
|
-
)
|
75
|
-
end
|
76
|
-
|
77
|
-
it 'prepares middleware' do
|
78
|
-
expect(subject.middleware).to be_instance_of(Rack::Builder)
|
79
|
-
expect(subject.middleware.send(:instance_variable_get, :@use).size).to eq(3)
|
80
|
-
expect(subject.middleware.send(:instance_variable_get, :@run)).to be(subject)
|
81
|
-
end
|
82
|
-
|
83
|
-
it 'applies middleware' do
|
84
|
-
header 'Origin', 'test.host'
|
85
|
-
get '/v1/ok'
|
86
|
-
expect(last_response).to be_ok
|
87
|
-
expect(last_response.body).to eq(%({"status":"OK"}))
|
88
|
-
expect(last_response.headers).to include(
|
89
|
-
'Access-Control-Allow-Origin' => '*',
|
90
|
-
'X-MyApp' => 'true',
|
91
|
-
)
|
92
|
-
|
93
|
-
header 'Origin', 'test.host'
|
94
|
-
get '/v1/failing'
|
95
|
-
expect(last_response).to be_bad_request
|
96
|
-
expect(last_response.body).to eq(%({"error":"bad request"}))
|
97
|
-
expect(last_response.headers).to include(
|
98
|
-
'Access-Control-Allow-Origin' => '*',
|
99
|
-
'X-MyApp' => 'true',
|
100
|
-
)
|
101
|
-
end
|
102
|
-
end
|
data/spec/scenario/Gemfile
DELETED
data/spec/scenario/app/api/v1.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
class API::V1 < Grape::API
|
2
|
-
version 'v1'
|
3
|
-
format :json
|
4
|
-
|
5
|
-
rescue_from MyLib::BadRequest do |e|
|
6
|
-
error!({ error: e }, 400)
|
7
|
-
end
|
8
|
-
|
9
|
-
get '/ok' do
|
10
|
-
{ status: 'OK' }
|
11
|
-
end
|
12
|
-
|
13
|
-
get '/failing' do
|
14
|
-
raise MyLib::BadRequest, 'bad request'
|
15
|
-
end
|
16
|
-
|
17
|
-
mount API::Posts
|
18
|
-
end
|
data/spec/scenario/app/api.rb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
require 'my_lib'
|
2
|
-
|
3
|
-
Grape::App.configure do |c|
|
4
|
-
c.eager_load = true
|
5
|
-
c.test_specific = true
|
6
|
-
c.raise_on_missing_translations = true
|
7
|
-
c.cors do
|
8
|
-
allow do
|
9
|
-
origins '*'
|
10
|
-
resource '*', headers: :any, methods: %i[get post options]
|
11
|
-
end
|
12
|
-
end
|
13
|
-
c.middleware do
|
14
|
-
use MyLib::Middleware
|
15
|
-
end
|
16
|
-
end
|
data/spec/scenario/lib/my_lib.rb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
class MyLib
|
2
|
-
class BadRequest < StandardError
|
3
|
-
end
|
4
|
-
|
5
|
-
class Middleware
|
6
|
-
def initialize(app)
|
7
|
-
@app = app
|
8
|
-
end
|
9
|
-
|
10
|
-
def call(env)
|
11
|
-
status, headers, body = @app.call(env)
|
12
|
-
headers['X-MyApp'] = 'true'
|
13
|
-
[status, headers, body]
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
data/spec/spec_helper.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
ENV['RACK_ENV'] ||= 'test'
|
2
|
-
require 'grape-app'
|
3
|
-
require 'rack/test'
|
4
|
-
require 'active_record'
|
5
|
-
require 'active_job'
|
6
|
-
|
7
|
-
ActiveRecord::Base.configurations = { 'test' => { 'adapter' => 'sqlite3', 'database' => ':memory:' } }
|
8
|
-
ActiveRecord::Base.establish_connection :test
|
9
|
-
ActiveRecord::Base.connection.instance_eval do
|
10
|
-
create_table :articles do |t|
|
11
|
-
t.string :title
|
12
|
-
t.timestamps
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
class Article < ActiveRecord::Base
|
17
|
-
end
|