Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ruby 3.0.0 compatibility #2145

Merged
merged 4 commits into from
Dec 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ jobs:
- 2.5
- 2.6
- 2.7
- 3.0
gemfile:
- Gemfile
- gemfiles/rack1.gemfile
Expand All @@ -36,8 +37,15 @@ jobs:
- gemfiles/rails_edge.gemfile
- gemfiles/rails_5.gemfile
- gemfiles/rails_6.gemfile
- gemfiles/rails_6_1.gemfile
experimental: [false]
include:
- ruby: 3.0
gemfile: 'gemfiles/multi_json.gemfile'
experimental: false
- ruby: 3.0
gemfile: 'gemfiles/multi_xml.gemfile'
experimental: false
- ruby: 2.7
gemfile: 'gemfiles/multi_json.gemfile'
experimental: false
Expand Down
4 changes: 4 additions & 0 deletions Appraisals
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ appraise 'rails-6' do
gem 'rails', '~> 6.0'
end

appraise 'rails-6-1' do
gem 'rails', '~> 6.1'
end

appraise 'rails-edge' do
gem 'rails', github: 'rails/rails'
end
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
#### Features

* Your contribution here.
* [#2145](https://github.com/ruby-grape/grape/pull/2145): Ruby 3.0 compatibility - [@ericproulx](https://github.com/ericproulx).
* [#2143](https://github.com/ruby-grape/grape/pull/2143): Enable GitHub Actions with updated RuboCop and Danger - [@anakinj](https://github.com/anakinj).


#### Fixes

* Your contribution here.
Expand Down
10 changes: 5 additions & 5 deletions gemfiles/multi_json.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@ group :development, :test do
gem 'bundler'
gem 'hashie'
gem 'rake'
gem 'rubocop', '0.84.0'
gem 'rubocop-ast', '< 0.7'
gem 'rubocop-performance', require: false
gem 'rubocop', '1.7.0'
gem 'rubocop-ast', '1.3.0'
gem 'rubocop-performance', '1.9.1', require: false
end

group :development do
gem 'appraisal'
gem 'benchmark-ips'
gem 'benchmark-memory'
gem 'guard'
gem 'guard-rspec'
gem 'guard-rubocop'
Expand All @@ -26,14 +27,13 @@ end
group :test do
gem 'cookiejar'
gem 'coveralls_reborn'
gem 'danger-toc', '~> 0.1.2'
gem 'grape-entity', '~> 0.6'
gem 'maruku'
gem 'mime-types'
gem 'rack-jsonp', require: 'rack/jsonp'
gem 'rack-test', '~> 1.1.0'
gem 'rspec', '~> 3.0'
gem 'ruby-grape-danger', '~> 0.1.0', require: false
gem 'ruby-grape-danger', '~> 0.2.0', require: false
end

gemspec path: '../'
10 changes: 5 additions & 5 deletions gemfiles/multi_xml.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@ group :development, :test do
gem 'bundler'
gem 'hashie'
gem 'rake'
gem 'rubocop', '0.84.0'
gem 'rubocop-ast', '< 0.7'
gem 'rubocop-performance', require: false
gem 'rubocop', '1.7.0'
gem 'rubocop-ast', '1.3.0'
gem 'rubocop-performance', '1.9.1', require: false
end

group :development do
gem 'appraisal'
gem 'benchmark-ips'
gem 'benchmark-memory'
gem 'guard'
gem 'guard-rspec'
gem 'guard-rubocop'
Expand All @@ -26,14 +27,13 @@ end
group :test do
gem 'cookiejar'
gem 'coveralls_reborn'
gem 'danger-toc', '~> 0.1.2'
gem 'grape-entity', '~> 0.6'
gem 'maruku'
gem 'mime-types'
gem 'rack-jsonp', require: 'rack/jsonp'
gem 'rack-test', '~> 1.1.0'
gem 'rspec', '~> 3.0'
gem 'ruby-grape-danger', '~> 0.1.0', require: false
gem 'ruby-grape-danger', '~> 0.2.0', require: false
end

gemspec path: '../'
10 changes: 5 additions & 5 deletions gemfiles/rack1.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@ group :development, :test do
gem 'bundler'
gem 'hashie'
gem 'rake'
gem 'rubocop', '0.84.0'
gem 'rubocop-ast', '< 0.7'
gem 'rubocop-performance', require: false
gem 'rubocop', '1.7.0'
gem 'rubocop-ast', '1.3.0'
gem 'rubocop-performance', '1.9.1', require: false
end

group :development do
gem 'appraisal'
gem 'benchmark-ips'
gem 'benchmark-memory'
gem 'guard'
gem 'guard-rspec'
gem 'guard-rubocop'
Expand All @@ -26,14 +27,13 @@ end
group :test do
gem 'cookiejar'
gem 'coveralls_reborn'
gem 'danger-toc', '~> 0.1.2'
gem 'grape-entity', '~> 0.6'
gem 'maruku'
gem 'mime-types'
gem 'rack-jsonp', require: 'rack/jsonp'
gem 'rack-test', '~> 1.1.0'
gem 'rspec', '~> 3.0'
gem 'ruby-grape-danger', '~> 0.1.0', require: false
gem 'ruby-grape-danger', '~> 0.2.0', require: false
end

gemspec path: '../'
10 changes: 5 additions & 5 deletions gemfiles/rack2.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@ group :development, :test do
gem 'bundler'
gem 'hashie'
gem 'rake'
gem 'rubocop', '0.84.0'
gem 'rubocop-ast', '< 0.7'
gem 'rubocop-performance', require: false
gem 'rubocop', '1.7.0'
gem 'rubocop-ast', '1.3.0'
gem 'rubocop-performance', '1.9.1', require: false
end

group :development do
gem 'appraisal'
gem 'benchmark-ips'
gem 'benchmark-memory'
gem 'guard'
gem 'guard-rspec'
gem 'guard-rubocop'
Expand All @@ -26,14 +27,13 @@ end
group :test do
gem 'cookiejar'
gem 'coveralls_reborn'
gem 'danger-toc', '~> 0.1.2'
gem 'grape-entity', '~> 0.6'
gem 'maruku'
gem 'mime-types'
gem 'rack-jsonp', require: 'rack/jsonp'
gem 'rack-test', '~> 1.1.0'
gem 'rspec', '~> 3.0'
gem 'ruby-grape-danger', '~> 0.1.0', require: false
gem 'ruby-grape-danger', '~> 0.2.0', require: false
end

gemspec path: '../'
10 changes: 5 additions & 5 deletions gemfiles/rack_edge.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@ group :development, :test do
gem 'bundler'
gem 'hashie'
gem 'rake'
gem 'rubocop', '0.84.0'
gem 'rubocop-ast', '< 0.7'
gem 'rubocop-performance', require: false
gem 'rubocop', '1.7.0'
gem 'rubocop-ast', '1.3.0'
gem 'rubocop-performance', '1.9.1', require: false
end

group :development do
gem 'appraisal'
gem 'benchmark-ips'
gem 'benchmark-memory'
gem 'guard'
gem 'guard-rspec'
gem 'guard-rubocop'
Expand All @@ -26,14 +27,13 @@ end
group :test do
gem 'cookiejar'
gem 'coveralls_reborn'
gem 'danger-toc', '~> 0.1.2'
gem 'grape-entity', '~> 0.6'
gem 'maruku'
gem 'mime-types'
gem 'rack-jsonp', require: 'rack/jsonp'
gem 'rack-test', '~> 1.1.0'
gem 'rspec', '~> 3.0'
gem 'ruby-grape-danger', '~> 0.1.0', require: false
gem 'ruby-grape-danger', '~> 0.2.0', require: false
end

gemspec path: '../'
10 changes: 5 additions & 5 deletions gemfiles/rails_5.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@ group :development, :test do
gem 'bundler'
gem 'hashie'
gem 'rake'
gem 'rubocop', '0.84.0'
gem 'rubocop-ast', '< 0.7'
gem 'rubocop-performance', require: false
gem 'rubocop', '1.7.0'
gem 'rubocop-ast', '1.3.0'
gem 'rubocop-performance', '1.9.1', require: false
end

group :development do
gem 'appraisal'
gem 'benchmark-ips'
gem 'benchmark-memory'
gem 'guard'
gem 'guard-rspec'
gem 'guard-rubocop'
Expand All @@ -26,14 +27,13 @@ end
group :test do
gem 'cookiejar'
gem 'coveralls_reborn'
gem 'danger-toc', '~> 0.1.2'
gem 'grape-entity', '~> 0.6'
gem 'maruku'
gem 'mime-types'
gem 'rack-jsonp', require: 'rack/jsonp'
gem 'rack-test', '~> 1.1.0'
gem 'rspec', '~> 3.0'
gem 'ruby-grape-danger', '~> 0.1.0', require: false
gem 'ruby-grape-danger', '~> 0.2.0', require: false
end

gemspec path: '../'
10 changes: 5 additions & 5 deletions gemfiles/rails_6.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@ group :development, :test do
gem 'bundler'
gem 'hashie'
gem 'rake'
gem 'rubocop', '0.84.0'
gem 'rubocop-ast', '< 0.7'
gem 'rubocop-performance', require: false
gem 'rubocop', '1.7.0'
gem 'rubocop-ast', '1.3.0'
gem 'rubocop-performance', '1.9.1', require: false
end

group :development do
gem 'appraisal'
gem 'benchmark-ips'
gem 'benchmark-memory'
gem 'guard'
gem 'guard-rspec'
gem 'guard-rubocop'
Expand All @@ -26,14 +27,13 @@ end
group :test do
gem 'cookiejar'
gem 'coveralls_reborn'
gem 'danger-toc', '~> 0.1.2'
gem 'grape-entity', '~> 0.6'
gem 'maruku'
gem 'mime-types'
gem 'rack-jsonp', require: 'rack/jsonp'
gem 'rack-test', '~> 1.1.0'
gem 'rspec', '~> 3.0'
gem 'ruby-grape-danger', '~> 0.1.0', require: false
gem 'ruby-grape-danger', '~> 0.2.0', require: false
end

gemspec path: '../'
39 changes: 39 additions & 0 deletions gemfiles/rails_6_1.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# frozen_string_literal: true

# This file was generated by Appraisal

source 'https://rubygems.org'

gem 'rails', '~> 6.1'

group :development, :test do
gem 'bundler'
gem 'hashie'
gem 'rake'
gem 'rubocop', '1.7.0'
gem 'rubocop-ast', '1.3.0'
gem 'rubocop-performance', '1.9.1', require: false
end

group :development do
gem 'appraisal'
gem 'benchmark-ips'
gem 'benchmark-memory'
gem 'guard'
gem 'guard-rspec'
gem 'guard-rubocop'
end

group :test do
gem 'cookiejar'
gem 'coveralls_reborn'
gem 'grape-entity', '~> 0.6'
gem 'maruku'
gem 'mime-types'
gem 'rack-jsonp', require: 'rack/jsonp'
gem 'rack-test', '~> 1.1.0'
gem 'rspec', '~> 3.0'
gem 'ruby-grape-danger', '~> 0.2.0', require: false
end

gemspec path: '../'
10 changes: 5 additions & 5 deletions gemfiles/rails_edge.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@ group :development, :test do
gem 'bundler'
gem 'hashie'
gem 'rake'
gem 'rubocop', '0.84.0'
gem 'rubocop-ast', '< 0.7'
gem 'rubocop-performance', require: false
gem 'rubocop', '1.7.0'
gem 'rubocop-ast', '1.3.0'
gem 'rubocop-performance', '1.9.1', require: false
end

group :development do
gem 'appraisal'
gem 'benchmark-ips'
gem 'benchmark-memory'
gem 'guard'
gem 'guard-rspec'
gem 'guard-rubocop'
Expand All @@ -26,14 +27,13 @@ end
group :test do
gem 'cookiejar'
gem 'coveralls_reborn'
gem 'danger-toc', '~> 0.1.2'
gem 'grape-entity', '~> 0.6'
gem 'maruku'
gem 'mime-types'
gem 'rack-jsonp', require: 'rack/jsonp'
gem 'rack-test', '~> 1.1.0'
gem 'rspec', '~> 3.0'
gem 'ruby-grape-danger', '~> 0.1.0', require: false
gem 'ruby-grape-danger', '~> 0.2.0', require: false
end

gemspec path: '../'
5 changes: 3 additions & 2 deletions lib/grape/dsl/routing.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,12 @@ def do_not_route_options!
namespace_inheritable(:do_not_route_options, true)
end

def mount(mounts, **opts)
def mount(mounts, *opts)
mounts = { mounts => '/' } unless mounts.respond_to?(:each_pair)
mounts.each_pair do |app, path|
if app.respond_to?(:mount_instance)
mount(app.mount_instance(configuration: opts[:with] || {}) => path)
opts_with = opts.any? ? opts.shift[:with] : {}
mount({ app.mount_instance(configuration: opts_with) => path })
next
end
in_setting = inheritable_setting
Expand Down
2 changes: 1 addition & 1 deletion lib/grape/exceptions/validation_errors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def as_json(**_opts)
end
end

def to_json(**_opts)
def to_json(*_opts)
as_json.to_json
end

Expand Down
Loading