grape-app 0.8.6 → 0.8.7

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: 9b76f380cd6957fb37025cb07c4343471d9fa892f387c9f5110eb5a713f7a5bc
4
- data.tar.gz: 34b4f3c1c0912fac71bed2d75448f90bf6aba60ec96300c208c13aca324a19a7
3
+ metadata.gz: feff7b4ee1c4e672754a8e9e85f4c80016e2414a6f81b10d40cb8cea5ccdc900
4
+ data.tar.gz: 15ede4a9152b0e274041a1f0a94c0edd9eaaaabc3ca6be7fd28e5a50041f54ed
5
5
  SHA512:
6
- metadata.gz: f2325d245dba242af124309a3a9193e9c4af1fe17fb9e611650a1230b453b4086a3870073690e60911141e9e10696db9f416c49f530f95d6a9a6e818d70e0822
7
- data.tar.gz: c1415686241fffa006cfb36b4518b2342e2fa889e175beae428659acf0b4dbd4a8f934eb89cf734fba729189d640d6377cd3fe6fabebc4d5cc72517c296fbfd0
6
+ metadata.gz: adf69f2a62a197ac8393abbf00da46b093313900701cbdb9b3ab76cc21e78331c20ebfbbde3131e023a014b0dae76946a6949f275e0bc8cd5fc7f3ea27c552d0
7
+ data.tar.gz: b5f4919555de644ba358415a2473ef6ea51d290d32acc82b2e52baf6919a245f3e7fa1bc79ec08b9f7c53a0afacc8ac89d4e62d69eb1b549956111f4c7c4769a
@@ -1,8 +1,14 @@
1
- inherit_from:
2
- - https://gitlab.com/bsm/misc/raw/master/rubocop/default.yml
1
+ inherit_gem:
2
+ rubocop-bsm:
3
+ - default.yml
4
+ inherit_mode:
5
+ merge:
6
+ - Exclude
3
7
 
4
8
  AllCops:
5
- TargetRubyVersion: "2.5"
9
+ TargetRubyVersion: "2.6"
6
10
  Metrics/ParameterLists:
7
11
  Exclude:
8
12
  - lib/grape/app/helpers/caching.rb
13
+ Rake/Desc:
14
+ Enabled: false
@@ -1,6 +1,5 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.5
4
3
  - 2.6
5
4
  - 2.7
6
5
  before_install:
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- grape-app (0.8.6)
4
+ grape-app (0.8.7)
5
5
  activesupport
6
6
  grape (>= 1.2)
7
7
  grape-entity
@@ -13,17 +13,17 @@ PATH
13
13
  GEM
14
14
  remote: https://rubygems.org/
15
15
  specs:
16
- activemodel (6.0.3.2)
17
- activesupport (= 6.0.3.2)
18
- activerecord (6.0.3.2)
19
- activemodel (= 6.0.3.2)
20
- activesupport (= 6.0.3.2)
21
- activesupport (6.0.3.2)
16
+ activemodel (6.1.1)
17
+ activesupport (= 6.1.1)
18
+ activerecord (6.1.1)
19
+ activemodel (= 6.1.1)
20
+ activesupport (= 6.1.1)
21
+ activesupport (6.1.1)
22
22
  concurrent-ruby (~> 1.0, >= 1.0.2)
23
- i18n (>= 0.7, < 2)
24
- minitest (~> 5.1)
25
- tzinfo (~> 1.1)
26
- zeitwerk (~> 2.2, >= 2.2.2)
23
+ i18n (>= 1.6, < 2)
24
+ minitest (>= 5.1)
25
+ tzinfo (~> 2.0)
26
+ zeitwerk (~> 2.3)
27
27
  ast (2.4.1)
28
28
  axiom-types (0.1.1)
29
29
  descendants_tracker (~> 0.0.4)
@@ -32,25 +32,23 @@ GEM
32
32
  builder (3.2.4)
33
33
  coercible (1.0.0)
34
34
  descendants_tracker (~> 0.0.1)
35
- concurrent-ruby (1.1.6)
35
+ concurrent-ruby (1.1.7)
36
36
  descendants_tracker (0.0.4)
37
37
  thread_safe (~> 0.3, >= 0.3.1)
38
38
  diff-lcs (1.4.4)
39
- dry-configurable (0.11.6)
39
+ dry-configurable (0.12.0)
40
40
  concurrent-ruby (~> 1.0)
41
- dry-core (~> 0.4, >= 0.4.7)
42
- dry-equalizer (~> 0.2)
41
+ dry-core (~> 0.5, >= 0.5.0)
43
42
  dry-container (0.7.2)
44
43
  concurrent-ruby (~> 1.0)
45
44
  dry-configurable (~> 0.1, >= 0.1.3)
46
- dry-core (0.4.9)
45
+ dry-core (0.5.0)
47
46
  concurrent-ruby (~> 1.0)
48
47
  dry-equalizer (0.3.0)
49
48
  dry-inflector (0.2.0)
50
- dry-logic (1.0.6)
49
+ dry-logic (1.1.0)
51
50
  concurrent-ruby (~> 1.0)
52
- dry-core (~> 0.2)
53
- dry-equalizer (~> 0.2)
51
+ dry-core (~> 0.5, >= 0.5)
54
52
  dry-types (1.4.0)
55
53
  concurrent-ruby (~> 1.0)
56
54
  dry-container (~> 0.3)
@@ -59,27 +57,27 @@ GEM
59
57
  dry-inflector (~> 0.1, >= 0.1.2)
60
58
  dry-logic (~> 1.0, >= 1.0.2)
61
59
  equalizer (0.0.11)
62
- grape (1.3.3)
60
+ grape (1.5.1)
63
61
  activesupport
64
62
  builder
65
63
  dry-types (>= 1.1)
66
64
  mustermann-grape (~> 1.0.0)
67
65
  rack (>= 1.3.0)
68
66
  rack-accept
69
- grape-entity (0.8.0)
67
+ grape-entity (0.8.2)
70
68
  activesupport (>= 3.0.0)
71
69
  multi_json (>= 1.3.2)
72
- i18n (1.8.3)
70
+ i18n (1.8.7)
73
71
  concurrent-ruby (~> 1.0)
74
72
  ice_nine (0.11.2)
75
- minitest (5.14.1)
76
- multi_json (1.14.1)
73
+ minitest (5.14.3)
74
+ multi_json (1.15.0)
77
75
  mustermann (1.1.1)
78
76
  ruby2_keywords (~> 0.0.1)
79
77
  mustermann-grape (1.0.1)
80
78
  mustermann (>= 1.0.0)
81
- parallel (1.19.2)
82
- parser (2.7.1.4)
79
+ parallel (1.20.1)
80
+ parser (3.0.0.0)
83
81
  ast (~> 2.4.1)
84
82
  rack (2.2.3)
85
83
  rack-accept (0.4.5)
@@ -90,47 +88,65 @@ GEM
90
88
  rack-test (1.1.0)
91
89
  rack (>= 1.0, < 3)
92
90
  rainbow (3.0.0)
93
- rake (13.0.1)
94
- regexp_parser (1.7.1)
91
+ rake (13.0.3)
92
+ regexp_parser (2.0.3)
95
93
  rexml (3.2.4)
96
- rspec (3.9.0)
97
- rspec-core (~> 3.9.0)
98
- rspec-expectations (~> 3.9.0)
99
- rspec-mocks (~> 3.9.0)
100
- rspec-core (3.9.2)
101
- rspec-support (~> 3.9.3)
102
- rspec-expectations (3.9.2)
94
+ rspec (3.10.0)
95
+ rspec-core (~> 3.10.0)
96
+ rspec-expectations (~> 3.10.0)
97
+ rspec-mocks (~> 3.10.0)
98
+ rspec-core (3.10.1)
99
+ rspec-support (~> 3.10.0)
100
+ rspec-expectations (3.10.1)
103
101
  diff-lcs (>= 1.2.0, < 2.0)
104
- rspec-support (~> 3.9.0)
105
- rspec-mocks (3.9.1)
102
+ rspec-support (~> 3.10.0)
103
+ rspec-mocks (3.10.1)
106
104
  diff-lcs (>= 1.2.0, < 2.0)
107
- rspec-support (~> 3.9.0)
108
- rspec-support (3.9.3)
109
- rubocop (0.86.0)
105
+ rspec-support (~> 3.10.0)
106
+ rspec-support (3.10.1)
107
+ rubocop (1.8.1)
110
108
  parallel (~> 1.10)
111
- parser (>= 2.7.0.1)
109
+ parser (>= 3.0.0.0)
112
110
  rainbow (>= 2.2.2, < 4.0)
113
- regexp_parser (>= 1.7)
111
+ regexp_parser (>= 1.8, < 3.0)
114
112
  rexml
115
- rubocop-ast (>= 0.0.3, < 1.0)
113
+ rubocop-ast (>= 1.2.0, < 2.0)
116
114
  ruby-progressbar (~> 1.7)
117
- unicode-display_width (>= 1.4.0, < 2.0)
118
- rubocop-ast (0.1.0)
119
- parser (>= 2.7.0.1)
120
- ruby-progressbar (1.10.1)
121
- ruby2_keywords (0.0.2)
115
+ unicode-display_width (>= 1.4.0, < 3.0)
116
+ rubocop-ast (1.4.0)
117
+ parser (>= 2.7.1.5)
118
+ rubocop-bsm (0.5.4)
119
+ rubocop (~> 1.0)
120
+ rubocop-performance
121
+ rubocop-rails
122
+ rubocop-rake
123
+ rubocop-rspec
124
+ rubocop-performance (1.9.2)
125
+ rubocop (>= 0.90.0, < 2.0)
126
+ rubocop-ast (>= 0.4.0)
127
+ rubocop-rails (2.9.1)
128
+ activesupport (>= 4.2.0)
129
+ rack (>= 1.1)
130
+ rubocop (>= 0.90.0, < 2.0)
131
+ rubocop-rake (0.5.1)
132
+ rubocop
133
+ rubocop-rspec (2.1.0)
134
+ rubocop (~> 1.0)
135
+ rubocop-ast (>= 1.1.0)
136
+ ruby-progressbar (1.11.0)
137
+ ruby2_keywords (0.0.3)
122
138
  sqlite3 (1.4.2)
123
139
  thor (1.0.1)
124
140
  thread_safe (0.3.6)
125
- tzinfo (1.2.7)
126
- thread_safe (~> 0.1)
127
- unicode-display_width (1.7.0)
141
+ tzinfo (2.0.4)
142
+ concurrent-ruby (~> 1.0)
143
+ unicode-display_width (2.0.0)
128
144
  virtus (1.0.5)
129
145
  axiom-types (~> 0.1)
130
146
  coercible (~> 1.0)
131
147
  descendants_tracker (~> 0.0, >= 0.0.3)
132
148
  equalizer (~> 0.0, >= 0.0.9)
133
- zeitwerk (2.3.1)
149
+ zeitwerk (2.4.2)
134
150
 
135
151
  PLATFORMS
136
152
  ruby
@@ -142,9 +158,9 @@ DEPENDENCIES
142
158
  rack-test
143
159
  rake
144
160
  rspec
145
- rubocop
161
+ rubocop-bsm
146
162
  sqlite3
147
163
  virtus
148
164
 
149
165
  BUNDLED WITH
150
- 2.1.4
166
+ 2.2.5
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'grape-app'
3
- s.version = '0.8.6'
3
+ s.version = '0.8.7'
4
4
  s.authors = ['Black Square Media Ltd']
5
5
  s.email = ['info@blacksquaremedia.com']
6
6
  s.summary = %(Standalone Grape API apps)
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
12
12
  s.test_files = `git ls-files -z -- spec/*`.split("\x0")
13
13
  s.executables = ['grape-app']
14
14
  s.require_paths = ['lib']
15
- s.required_ruby_version = '>= 2.5'
15
+ s.required_ruby_version = '>= 2.6'
16
16
 
17
17
  s.add_dependency 'activesupport'
18
18
  s.add_dependency 'grape', '>= 1.2'
@@ -27,7 +27,7 @@ Gem::Specification.new do |s|
27
27
  s.add_development_dependency 'rack-test'
28
28
  s.add_development_dependency 'rake'
29
29
  s.add_development_dependency 'rspec'
30
- s.add_development_dependency 'rubocop'
30
+ s.add_development_dependency 'rubocop-bsm'
31
31
  s.add_development_dependency 'sqlite3'
32
32
  s.add_development_dependency 'virtus'
33
33
  end
@@ -72,7 +72,12 @@ class Grape::App < Grape::API
72
72
  config = self.config
73
73
  @middleware ||= Rack::Builder.new do
74
74
  use Rack::Cors, &config.cors if config.cors
75
- use Rack::SslEnforcer if config.force_ssl
75
+
76
+ if config.force_ssl.is_a?(Hash)
77
+ use Rack::SslEnforcer, **config.force_ssl
78
+ elsif config.force_ssl
79
+ use Rack::SslEnforcer
80
+ end
76
81
  config.middleware.each do |block|
77
82
  instance_eval(&block)
78
83
  end
@@ -1,6 +1,8 @@
1
1
  Grape::App.configure do |config|
2
- # Force SSL
3
- # config.force_ssl = true
2
+ # Force SSL, please see https://github.com/tobmatth/rack-ssl-enforcer
3
+ # for configuration options.
4
+ #
5
+ # config.force_ssl = { strict: true }
4
6
 
5
7
  # CORS is disabled by default, please see https://github.com/cyu/rack-cors
6
8
  # for configuration options.
@@ -12,7 +12,7 @@ RSpec.configure do |config|
12
12
  DatabaseCleaner.strategy = :transaction
13
13
  DatabaseCleaner.clean_with :truncation
14
14
  end
15
- config.around :each do |example|
15
+ config.around do |example|
16
16
  DatabaseCleaner.cleaning { example.run }
17
17
  end
18
18
 
@@ -5,7 +5,7 @@ RSpec.describe Grape::App::Helpers::Caching do
5
5
 
6
6
  let(:app) { TestAPI }
7
7
 
8
- it 'should handle fresh-when' do
8
+ it 'handles fresh-when' do
9
9
  get '/articles'
10
10
  expect(last_response.status).to eq(200)
11
11
  expect(last_response.headers).to include(
@@ -30,7 +30,7 @@ RSpec.describe Grape::App::Helpers::Caching do
30
30
  expect(last_response.status).to eq(200)
31
31
  end
32
32
 
33
- it 'should handle fresh_when for records that were never updated' do
33
+ it 'handles fresh_when for records that were never updated' do
34
34
  get '/articles/never_updated'
35
35
  expect(last_response.status).to eq(200)
36
36
  expect(last_response.headers).to include(
@@ -38,7 +38,7 @@ RSpec.describe Grape::App::Helpers::Caching do
38
38
  )
39
39
  end
40
40
 
41
- it 'should support cache-control' do
41
+ it 'supports cache-control' do
42
42
  get '/articles?public=true'
43
43
  expect(last_response.status).to eq(200)
44
44
  expect(last_response.headers).to include(
@@ -46,7 +46,7 @@ RSpec.describe Grape::App::Helpers::Caching do
46
46
  )
47
47
  end
48
48
 
49
- it 'should handle stale? (with cache-control)' do
49
+ it 'handles stale? (with cache-control)' do
50
50
  get '/articles/1'
51
51
  expect(last_response.status).to eq(200)
52
52
  expect(last_response.headers).to include(
@@ -5,7 +5,7 @@ RSpec.describe Grape::App::Helpers::Params do
5
5
 
6
6
  let(:app) { TestAPI }
7
7
 
8
- it 'should limit params' do
8
+ it 'limits params' do
9
9
  post '/articles', title: 'Today', fresh: true, id: 1234, updated_at: Time.now
10
10
  expect(last_response.status).to eq(201)
11
11
  expect(JSON.parse(last_response.body)).to eq(
@@ -4,37 +4,38 @@ RSpec.describe Grape::App do
4
4
  include Rack::Test::Methods
5
5
 
6
6
  subject { described_class }
7
+
7
8
  before { subject.init! File.expand_path('../scenario', __dir__) }
8
9
 
9
10
  def app
10
11
  subject.middleware
11
12
  end
12
13
 
13
- it 'should have an env' do
14
+ it 'has an env' do
14
15
  expect(subject.env).to be_instance_of(ActiveSupport::StringInquirer)
15
16
  expect(subject.env).to eq('test')
16
17
  end
17
18
 
18
- it 'should have an root' do
19
+ it 'has an root' do
19
20
  expect(subject.root).to be_instance_of(Pathname)
20
21
  end
21
22
 
22
- it 'should be an API instance' do
23
+ it 'is an API instance' do
23
24
  expect(subject).to be < Grape::API
24
25
  end
25
26
 
26
- it 'should init with default time zone' do
27
+ it 'inits with default time zone' do
27
28
  expect(Time.zone.name).to eq('UTC')
28
29
  expect(Thread.new { Time.zone }.value.name).to eq('UTC')
29
30
  end
30
31
 
31
- it 'should configure i18n' do
32
+ it 'configures i18n' do
32
33
  expect(I18n.load_path).to include(subject.root.join('config', 'locales', 'en.yml').to_s)
33
34
  expect(I18n.default_locale).to eq(:en)
34
35
  expect(I18n.exception_handler).to be_instance_of(Proc)
35
36
  end
36
37
 
37
- it 'should read env specific initializers' do
38
+ it 'reads env specific initializers' do
38
39
  expect(subject.config).to include(
39
40
  :test_specific,
40
41
  :raise_on_missing_translations,
@@ -43,13 +44,13 @@ RSpec.describe Grape::App do
43
44
  )
44
45
  end
45
46
 
46
- it 'should prepare middleware' do
47
+ it 'prepares middleware' do
47
48
  expect(subject.middleware).to be_instance_of(Rack::Builder)
48
49
  expect(subject.middleware.send(:instance_variable_get, :@use).size).to eq(2)
49
50
  expect(subject.middleware.send(:instance_variable_get, :@run)).to be(subject)
50
51
  end
51
52
 
52
- it 'should apply middleware' do
53
+ it 'applies middleware' do
53
54
  header 'Origin', 'test.host'
54
55
  get '/v1/ok'
55
56
  expect(last_response).to be_ok
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.8.6
4
+ version: 0.8.7
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: 2020-07-03 00:00:00.000000000 Z
11
+ date: 2021-01-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -179,7 +179,7 @@ dependencies:
179
179
  - !ruby/object:Gem::Version
180
180
  version: '0'
181
181
  - !ruby/object:Gem::Dependency
182
- name: rubocop
182
+ name: rubocop-bsm
183
183
  requirement: !ruby/object:Gem::Requirement
184
184
  requirements:
185
185
  - - ">="
@@ -291,7 +291,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
291
291
  requirements:
292
292
  - - ">="
293
293
  - !ruby/object:Gem::Version
294
- version: '2.5'
294
+ version: '2.6'
295
295
  required_rubygems_version: !ruby/object:Gem::Requirement
296
296
  requirements:
297
297
  - - ">="