Skip to content

Commit 152fa40

Browse files
authored
Merge pull request #1531 from LeFnord/master
updates gem dependencies
2 parents dc5e4b0 + a4364f2 commit 152fa40

29 files changed

+179
-85
lines changed

.rubocop.yml

+9
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,12 @@ AllCops:
99
- bin/**/*
1010

1111
inherit_from: .rubocop_todo.yml
12+
13+
Style/Documentation:
14+
Enabled: false
15+
16+
Style/MultilineIfModifier:
17+
Enabled: false
18+
19+
Style/RaiseArgs:
20+
Enabled: false

.rubocop_todo.yml

+18-17
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
# This configuration was generated by
22
# `rubocop --auto-gen-config`
3-
# on 2016-09-28 13:52:41 +0200 using RuboCop version 0.39.0.
3+
# on 2016-12-01 19:41:18 +0100 using RuboCop version 0.46.0.
44
# The point is for the user to remove these configuration records
55
# one by one as the offenses are removed from the code base.
66
# Note that changes in the inspected code, or installation of new
77
# versions of RuboCop, may require this file to be generated again.
88

9-
# Offense count: 41
9+
# Offense count: 3
10+
# this must be removed for preparation of ruby 2.4
11+
Lint/UnifiedInteger:
12+
Exclude:
13+
- 'lib/grape/dsl/inside_route.rb'
14+
- 'spec/grape/validations/validators/allow_blank_spec.rb'
15+
16+
# Offense count: 44
1017
Metrics/AbcSize:
1118
Max: 44
1219

@@ -19,36 +26,30 @@ Metrics/BlockNesting:
1926
Metrics/ClassLength:
2027
Max: 279
2128

22-
# Offense count: 28
29+
# Offense count: 26
2330
Metrics/CyclomaticComplexity:
2431
Max: 14
2532

26-
# Offense count: 955
27-
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes.
33+
# Offense count: 964
34+
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
2835
# URISchemes: http, https
2936
Metrics/LineLength:
3037
Max: 215
3138

32-
# Offense count: 52
39+
# Offense count: 55
3340
# Configuration parameters: CountComments.
3441
Metrics/MethodLength:
3542
Max: 33
3643

37-
# Offense count: 8
44+
# Offense count: 9
3845
# Configuration parameters: CountComments.
3946
Metrics/ModuleLength:
4047
Max: 212
4148

42-
# Offense count: 18
49+
# Offense count: 17
4350
Metrics/PerceivedComplexity:
4451
Max: 14
4552

46-
# Offense count: 114
47-
Style/Documentation:
48-
Enabled: false
49-
50-
# Offense count: 16
51-
# Configuration parameters: EnforcedStyle, SupportedStyles.
52-
# SupportedStyles: compact, exploded
53-
Style/RaiseArgs:
54-
Enabled: false
53+
Style/MethodMissing:
54+
Exclude:
55+
- 'lib/grape/router/attribute_translator.rb'

.travis.yml

+17-9
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,32 @@ sudo: false
44

55
matrix:
66
include:
7-
- rvm: 2.3.1
7+
- rvm: 2.3.3
88
script:
99
- bundle exec danger
10-
- rvm: 2.3.1
10+
- rvm: 2.3.3
1111
gemfile: Gemfile
12-
- rvm: 2.3.1
12+
- rvm: 2.3.3
13+
gemfile: gemfiles/rack_edge.gemfile
14+
- rvm: 2.3.3
15+
gemfile: gemfiles/rack_1.5.2.gemfile
16+
- rvm: 2.3.3
17+
gemfile: gemfiles/rails_edge.gemfile
18+
- rvm: 2.3.3
1319
gemfile: gemfiles/rails_5.gemfile
14-
- rvm: 2.3.1
20+
- rvm: 2.2.6
21+
gemfile: Gemfile
22+
- rvm: 2.2.6
1523
gemfile: gemfiles/rack_1.5.2.gemfile
16-
- rvm: 2.3.0
17-
- rvm: 2.2.5
18-
- rvm: 2.1.10
24+
- rvm: 2.2.6
25+
gemfile: gemfiles/rails_5.gemfile
26+
- rvm: 2.2.6
1927
gemfile: gemfiles/rails_4.gemfile
20-
- rvm: 2.1.10
28+
- rvm: 2.2.6
2129
gemfile: gemfiles/rails_3.gemfile
22-
- rvm: rbx-2
2330
- rvm: ruby-head
2431
- rvm: jruby-head
32+
- rvm: rbx-2
2533
allow_failures:
2634
- rvm: ruby-head
2735
- rvm: jruby-head

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ Next Release
1414
* [#1512](https://github.com/ruby-grape/grape/pull/1512): Fix: deeply nested parameters are included within `#declared(params)` - [@krbs](https://github.com/krbs).
1515
* [#1510](https://github.com/ruby-grape/grape/pull/1510): Fix: inconsistent validation for multiple parameters - [@dgasper](https://github.com/dgasper).
1616
* [#1526](https://github.com/ruby-grape/grape/pull/1526): Reduce warnings caused by instance variables not initialized - [@cpetschnig](https://github.com/cpetschnig).
17+
* [#1531](https://github.com/ruby-grape/grape/pull/1531): Updates gem dependencies - [@LeFnord](https://github.com/LeFnord).
18+
1719

1820
0.18.0 (10/7/2016)
1921
==================

Gemfile

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ gemspec
77
group :development, :test do
88
gem 'bundler'
99
gem 'rake'
10-
gem 'rubocop', '0.39.0'
10+
gem 'rubocop', '~> 0.45'
1111
end
1212

1313
group :development do
@@ -21,12 +21,12 @@ group :development do
2121
end
2222

2323
group :test do
24-
gem 'grape-entity', '0.5.0'
24+
gem 'grape-entity', '~> 0.6'
2525
gem 'maruku'
2626
gem 'rack-test'
2727
gem 'rspec', '~> 3.0'
2828
gem 'cookiejar'
2929
gem 'rack-jsonp', require: 'rack/jsonp'
30-
gem 'mime-types', '< 3.0'
30+
gem 'mime-types', '~> 3.0'
3131
gem 'ruby-grape-danger', '~> 0.1.0', require: false
3232
end

gemfiles/rack_edge.gemfile

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# This file was generated by Appraisal
2+
3+
source 'https://rubygems.org'
4+
5+
gem 'rack', github: 'rack/rack'
6+
7+
group :development, :test do
8+
gem 'bundler'
9+
gem 'rake'
10+
gem 'rubocop', '~> 0.45.0'
11+
end
12+
13+
group :development do
14+
gem 'guard'
15+
gem 'guard-rspec'
16+
gem 'guard-rubocop'
17+
gem 'yard'
18+
gem 'appraisal'
19+
gem 'benchmark-ips'
20+
gem 'redcarpet'
21+
end
22+
23+
group :test do
24+
gem 'grape-entity', '~> 0.6'
25+
gem 'maruku'
26+
gem 'rack-test'
27+
gem 'rspec', '~> 3.0'
28+
gem 'cookiejar'
29+
gem 'rack-jsonp', require: 'rack/jsonp'
30+
gem 'mime-types', '~> 3.0'
31+
gem 'ruby-grape-danger', '~> 0.1.0', require: false
32+
end
33+
34+
gemspec path: '../'

gemfiles/rails_5.gemfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ gem 'rails', '5.0.0'
77
group :development, :test do
88
gem 'bundler'
99
gem 'rake'
10-
gem 'rubocop', '0.39.0'
10+
gem 'rubocop', '0.45.0'
1111
end
1212

1313
group :development do

gemfiles/rails_edge.gemfile

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# This file was generated by Appraisal
2+
3+
source 'https://rubygems.org'
4+
5+
gem 'rails', github: 'rails/rails'
6+
7+
group :development, :test do
8+
gem 'bundler'
9+
gem 'rake'
10+
gem 'rubocop', '~> 0.45.0'
11+
end
12+
13+
group :development do
14+
gem 'guard'
15+
gem 'guard-rspec'
16+
gem 'guard-rubocop'
17+
gem 'yard'
18+
gem 'appraisal'
19+
gem 'benchmark-ips'
20+
gem 'redcarpet'
21+
end
22+
23+
group :test do
24+
gem 'grape-entity', '~> 0.6'
25+
gem 'maruku'
26+
gem 'rack-test'
27+
gem 'rspec', '~> 3.0'
28+
gem 'cookiejar'
29+
gem 'rack-jsonp', require: 'rack/jsonp'
30+
gem 'mime-types', '~> 3.0'
31+
gem 'ruby-grape-danger', '~> 0.1.0', require: false
32+
end
33+
34+
gemspec path: '../'

lib/grape/dsl/helpers.rb

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ def helpers(new_mod = nil, &block)
3131
mod = new_mod || Module.new
3232
define_boolean_in_mod(mod)
3333
inject_api_helpers_to_mod(mod) if new_mod
34+
3435
inject_api_helpers_to_mod(mod) do
3536
mod.class_eval(&block)
3637
end if block_given?

lib/grape/dsl/parameters.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,8 @@ def all_or_none_of(*attrs)
176176
# @yield a parameter definition DSL
177177
def given(*attrs, &block)
178178
attrs.each do |attr|
179-
attr_ = attr.is_a?(Hash) ? attr.keys[0] : attr
180-
raise Grape::Exceptions::UnknownParameter.new(attr_) unless declared_param?(attr_)
179+
proxy_attr = attr.is_a?(Hash) ? attr.keys[0] : attr
180+
raise Grape::Exceptions::UnknownParameter.new(proxy_attr) unless declared_param?(proxy_attr)
181181
end
182182
new_lateral_scope(dependent_on: attrs, &block)
183183
end

lib/grape/dsl/request_response.rb

+2-3
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,10 @@ def rescue_from(*args, &block)
110110
end
111111
handler ||= extract_with(options)
112112

113-
case
114-
when args.include?(:all)
113+
if args.include?(:all)
115114
namespace_inheritable(:rescue_all, true)
116115
namespace_inheritable :all_rescue_handler, handler
117-
when args.include?(:grape_exceptions)
116+
elsif args.include?(:grape_exceptions)
118117
namespace_inheritable(:rescue_all, true)
119118
namespace_inheritable(:rescue_grape_exceptions, true)
120119
else

lib/grape/dsl/routing.rb

+2
Original file line numberDiff line numberDiff line change
@@ -200,13 +200,15 @@ def reset_endpoints!
200200
# @option options [Regexp] You may supply a regular expression that the declared parameter must meet.
201201
def route_param(param, options = {}, &block)
202202
options = options.dup
203+
203204
options[:requirements] = {
204205
param.to_sym => options[:requirements]
205206
} if options[:requirements].is_a?(Regexp)
206207

207208
Grape::Validations::ParamsScope.new(api: self) do
208209
requires param, type: options[:type]
209210
end if options.key?(:type)
211+
210212
namespace(":#{param}", options, &block)
211213
end
212214

lib/grape/error_formatter/base.rb

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ def present(message, env)
1515
# env['api.endpoint'].route does not work when the error occurs within a middleware
1616
# the Endpoint does not have a valid env at this moment
1717
http_codes = env[Grape::Env::GRAPE_ROUTING_ARGS][:route_info].http_codes || []
18+
1819
found_code = http_codes.find do |http_code|
1920
(http_code[0].to_i == env[Grape::Env::API_ENDPOINT].status) && http_code[2].respond_to?(:represent)
2021
end if env[Grape::Env::API_ENDPOINT].request

lib/grape/middleware/base.rb

+2-4
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,12 @@ def call!(env)
4545

4646
# @abstract
4747
# Called before the application is called in the middleware lifecycle.
48-
def before
49-
end
48+
def before; end
5049

5150
# @abstract
5251
# Called after the application is called in the middleware lifecycle.
5352
# @return [Response, nil] a Rack SPEC response or nil to call the application afterwards.
54-
def after
55-
end
53+
def after; end
5654

5755
def response
5856
return @app_response if @app_response.is_a?(Rack::Response)

lib/grape/middleware/error.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def rescuable_by_grape?(klass)
7070
end
7171

7272
def exec_handler(e, &handler)
73-
if handler.lambda? && handler.arity == 0
73+
if handler.lambda? && handler.arity.zero?
7474
instance_exec(&handler)
7575
else
7676
instance_exec(e, &handler)

lib/grape/middleware/versioner/path.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def default_options
2626
def before
2727
path = env[Grape::Http::Headers::PATH_INFO].dup
2828

29-
if prefix && path.index(prefix) == 0
29+
if prefix && path.index(prefix).zero?
3030
path.sub!(prefix, '')
3131
path = Grape::Router.normalize_path(path)
3232
end

lib/grape/router.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def transaction(env)
109109
return response if response && !(cascade = cascade?(response))
110110
end
111111

112-
(!cascade && neighbor) ? call_with_allow_headers(env, neighbor.allow_header, neighbor.endpoint) : nil
112+
!cascade && neighbor ? call_with_allow_headers(env, neighbor.allow_header, neighbor.endpoint) : nil
113113
end
114114

115115
def process_route(route, env)

lib/grape/router/attribute_translator.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def to_h
1313
def method_missing(m, *args)
1414
if m[-1] == '='
1515
@attributes[m[0..-1]] = *args
16-
else
16+
elsif m[-1] != '='
1717
@attributes[m]
1818
end
1919
end

lib/grape/router/pattern.rb

+2
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,11 @@ def build_path(pattern, anchor: false, suffix: nil, **_options)
3939
pattern << '/' unless pattern.end_with?('/')
4040
pattern << '*path'
4141
end
42+
4243
pattern = pattern.split('/').tap do |parts|
4344
parts[parts.length - 1] = '?' + parts.last
4445
end.join('/') if pattern.end_with?('*path')
46+
4547
pattern + suffix.to_s
4648
end
4749

lib/grape/router/route.rb

+4
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ def method_missing(method_id, *arguments)
2828
end
2929
end
3030

31+
def respond_to_missing?(method_id, _)
32+
ROUTE_ATTRIBUTE_REGEXP.match(method_id.to_s)
33+
end
34+
3135
[
3236
:prefix,
3337
:version,

0 commit comments

Comments
 (0)