Skip to content

Commit

Permalink
Drop support ruby 2.6 and Rails 5 (#2390)
Browse files Browse the repository at this point in the history
* Remove ruby 2.6 from CI workflows
Run rubocop on ruby 2.7
Update README

* Autocorrect rubocop since running on ruby 2.7

* Add changelog
  • Loading branch information
ericproulx committed Dec 19, 2023
1 parent af36b1d commit bc1d790
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 69 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/test.yml
Expand Up @@ -26,8 +26,6 @@ jobs:
ruby: ['2.7', '3.0', '3.1', '3.2']
gemfile: [rack_2_0, rack_3_0, rails_6_0, rails_6_1, rails_7_0, rails_7_1]
include:
- ruby: '2.6'
gemfile: rails_5_2
- ruby: '2.7'
gemfile: rack_1_0
- ruby: '2.7'
Expand Down
2 changes: 1 addition & 1 deletion .rubocop.yml
@@ -1,6 +1,6 @@
AllCops:
NewCops: enable
TargetRubyVersion: 2.6
TargetRubyVersion: 2.7
SuggestExtensions: false
Exclude:
- vendor/**/*
Expand Down
22 changes: 10 additions & 12 deletions .rubocop_todo.yml
@@ -1,6 +1,6 @@
# This configuration was generated by
# `rubocop --auto-gen-config --auto-gen-only-exclude --exclude-limit 5000`
# on 2023-07-04 00:22:04 UTC using RuboCop version 1.50.2.
# on 2023-12-19 10:12:38 UTC using RuboCop version 1.50.2.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
Expand All @@ -20,7 +20,7 @@ Lint/AmbiguousBlockAssociation:
Exclude:
- 'spec/grape/dsl/routing_spec.rb'

# Offense count: 40
# Offense count: 56
# Configuration parameters: AllowedMethods.
# AllowedMethods: enums
Lint/ConstantDefinitionInBlock:
Expand All @@ -34,7 +34,6 @@ Lint/ConstantDefinitionInBlock:
- 'spec/grape/api_spec.rb'
- 'spec/grape/entity_spec.rb'
- 'spec/grape/loading_spec.rb'
- 'spec/grape/middleware/auth/strategies_spec.rb'
- 'spec/grape/middleware/base_spec.rb'
- 'spec/grape/middleware/error_spec.rb'
- 'spec/grape/middleware/formatter_spec.rb'
Expand All @@ -52,7 +51,7 @@ Lint/DuplicateBranch:
Exclude:
- 'spec/support/versioned_helpers.rb'

# Offense count: 71
# Offense count: 75
# Configuration parameters: AllowComments, AllowEmptyLambdas.
Lint/EmptyBlock:
Exclude:
Expand Down Expand Up @@ -134,7 +133,7 @@ RSpec/AnyInstance:
- 'spec/grape/api_spec.rb'
- 'spec/grape/middleware/base_spec.rb'

# Offense count: 343
# Offense count: 344
# Configuration parameters: Prefixes, AllowedPatterns.
# Prefixes: when, with, without
RSpec/ContextWording:
Expand Down Expand Up @@ -226,7 +225,7 @@ RSpec/ExpectInHook:
- 'spec/grape/api_spec.rb'
- 'spec/grape/validations/validators/values_spec.rb'

# Offense count: 43
# Offense count: 47
# Configuration parameters: Include, CustomTransform, IgnoreMethods, SpecSuffixOnly.
# Include: **/*_spec*rb*, **/spec/**/*
RSpec/FilePath:
Expand Down Expand Up @@ -289,7 +288,7 @@ RSpec/IndexedLet:
- 'spec/grape/presenters/presenter_spec.rb'
- 'spec/shared/versioning_examples.rb'

# Offense count: 38
# Offense count: 44
# Configuration parameters: AssignmentOnly.
RSpec/InstanceVariable:
Exclude:
Expand All @@ -301,7 +300,7 @@ RSpec/InstanceVariable:
- 'spec/grape/middleware/versioner/header_spec.rb'
- 'spec/grape/validations/validators/except_values_spec.rb'

# Offense count: 84
# Offense count: 98
RSpec/LeakyConstantDeclaration:
Exclude:
- 'spec/grape/api/defines_boolean_in_params_spec.rb'
Expand All @@ -313,7 +312,6 @@ RSpec/LeakyConstantDeclaration:
- 'spec/grape/api_spec.rb'
- 'spec/grape/entity_spec.rb'
- 'spec/grape/loading_spec.rb'
- 'spec/grape/middleware/auth/strategies_spec.rb'
- 'spec/grape/middleware/base_spec.rb'
- 'spec/grape/middleware/error_spec.rb'
- 'spec/grape/middleware/exception_spec.rb'
Expand Down Expand Up @@ -342,7 +340,7 @@ RSpec/MissingExampleGroupArgument:
Exclude:
- 'spec/grape/middleware/exception_spec.rb'

# Offense count: 772
# Offense count: 788
# Configuration parameters: Max.
RSpec/MultipleExpectations:
Exclude:
Expand Down Expand Up @@ -422,7 +420,7 @@ RSpec/MultipleMemoizedHelpers:
- 'spec/grape/request_spec.rb'
- 'spec/grape/validations/attributes_doc_spec.rb'

# Offense count: 2150
# Offense count: 2182
# Configuration parameters: EnforcedStyle, IgnoreSharedExamples.
# SupportedStyles: always, named_only
RSpec/NamedSubject:
Expand Down Expand Up @@ -487,7 +485,7 @@ RSpec/NamedSubject:
- 'spec/grape/validations/validators/presence_spec.rb'
- 'spec/grape/validations_spec.rb'

# Offense count: 173
# Offense count: 174
# Configuration parameters: Max, AllowedGroups.
RSpec/NestedGroups:
Exclude:
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -7,6 +7,7 @@
* [#2379](https://github.com/ruby-grape/grape/pull/2379): Take into account the `route_param` type in `recognize_path` - [@jcagarcia](https://github.com/jcagarcia).
* [#2383](https://github.com/ruby-grape/grape/pull/2383): Use regex block instead of if - [@ericproulx](https://github.com/ericproulx).
* [#2384](https://github.com/ruby-grape/grape/pull/2384): Allow to use `before/after/rescue_from` methods in any order when using `mount` - [@jcagarcia](https://github.com/jcagarcia).
* [#2390](https://github.com/ruby-grape/grape/pull/2390): Drop support for Ruby 2.6 and Rails 5 - [@ericproulx](https://github.com/ericproulx).
* Your contribution here.

#### Fixes
Expand Down
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -178,7 +178,7 @@ The maintainers of Grape are working with Tidelift to deliver commercial support

## Installation

Ruby 2.6 or newer is required.
Ruby 2.7 or newer is required.

Grape is available as a gem, to install it run:

Expand Down
44 changes: 0 additions & 44 deletions gemfiles/rails_5_2.gemfile

This file was deleted.

4 changes: 2 additions & 2 deletions grape.gemspec
Expand Up @@ -20,7 +20,7 @@ Gem::Specification.new do |s|
'source_code_uri' => "https://github.com/ruby-grape/grape/tree/v#{s.version}"
}

s.add_runtime_dependency 'activesupport', '>= 5'
s.add_runtime_dependency 'activesupport', '>= 6'
s.add_runtime_dependency 'builder'
s.add_runtime_dependency 'dry-types', '>= 1.1'
s.add_runtime_dependency 'mustermann-grape', '~> 1.1.0'
Expand All @@ -29,5 +29,5 @@ Gem::Specification.new do |s|

s.files = Dir['lib/**/*', 'CHANGELOG.md', 'CONTRIBUTING.md', 'README.md', 'grape.png', 'UPGRADING.md', 'LICENSE', 'grape.gemspec']
s.require_paths = ['lib']
s.required_ruby_version = '>= 2.6.0'
s.required_ruby_version = '>= 2.7.0'
end
8 changes: 4 additions & 4 deletions lib/grape/api.rb
Expand Up @@ -26,8 +26,8 @@ class << self
attr_accessor :base_instance, :instances

# Rather than initializing an object of type Grape::API, create an object of type Instance
def new(*args, &block)
base_instance.new(*args, &block)
def new(...)
base_instance.new(...)
end

# When inherited, will create a list of all instances (times the API was mounted)
Expand Down Expand Up @@ -77,8 +77,8 @@ def configure
# the headers, and the body. See [the rack specification]
# (http://www.rubydoc.info/github/rack/rack/master/file/SPEC) for more.
# NOTE: This will only be called on an API directly mounted on RACK
def call(*args, &block)
instance_for_rack.call(*args, &block)
def call(...)
instance_for_rack.call(...)
end

# Alleviates problems with autoloading by tring to search for the constant
Expand Down
6 changes: 3 additions & 3 deletions lib/grape/endpoint.rb
Expand Up @@ -13,8 +13,8 @@ class Endpoint
attr_reader :env, :request, :headers, :params

class << self
def new(*args, &block)
self == Endpoint ? Class.new(Endpoint).new(*args, &block) : super
def new(...)
self == Endpoint ? Class.new(Endpoint).new(...) : super
end

def before_each(new_setup = false, &block)
Expand Down Expand Up @@ -55,7 +55,7 @@ def generate_api_method(method_name, &block)

proc do |endpoint_instance|
ActiveSupport::Notifications.instrument('endpoint_render.grape', endpoint: endpoint_instance) do
method.bind(endpoint_instance).call
method.bind_call(endpoint_instance)
end
end
end
Expand Down

0 comments on commit bc1d790

Please sign in to comment.