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

Remove support for EOL Ruby 2.6/2.7, Rails 5.2/6.0 #776

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 2 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,25 +27,9 @@ jobs:
--health-retries 5
strategy:
matrix:
ruby: ['2.6', '2.7', '3.0', '3.1', '3.2', '3.3']
rails: ['5.2', '6.0.0', '6.1.0', '7.0.0', '7.1.0']
ruby: ['3.0', '3.1', '3.2', '3.3']
rails: ['6.1.0', '7.0.0', '7.1.0']
exclude:
- ruby: "2.6"
rails: "7.1.0"
- ruby: "2.6"
rails: "7.0.0"
- ruby: "2.7"
rails: "7.1.0"
- ruby: "3.0"
rails: "5.2"
- ruby: "3.1"
rails: "5.2"
- ruby: "3.1"
rails: "6.0.0"
- ruby: "3.2"
rails: "5.2"
- ruby: "3.2"
rails: "6.0.0"
- ruby: "3.2"
rails: "6.1.0"
- ruby: "3.3"
Expand Down
20 changes: 2 additions & 18 deletions .github/workflows/examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,9 @@ jobs:
--health-retries 5
strategy:
matrix:
ruby: ['2.6', '2.7', '3.0', '3.1', '3.2', '3.3']
rails: ['5.2', '6.0.0', '6.1.0', '7.0.0', '7.1.0']
ruby: ['3.0', '3.1', '3.2', '3.3']
rails: ['6.1.0', '7.0.0', '7.1.0']
exclude:
- ruby: "2.6"
rails: "7.1.0"
- ruby: "2.6"
rails: "7.0.0"
- ruby: "2.7"
rails: "7.1.0"
- ruby: "3.0"
rails: "5.2"
- ruby: "3.1"
rails: "5.2"
- ruby: "3.1"
rails: "6.0.0"
- ruby: "3.2"
rails: "5.2"
- ruby: "3.2"
rails: "6.0.0"
- ruby: "3.2"
rails: "6.1.0"
- ruby: "3.3"
Expand Down
20 changes: 4 additions & 16 deletions lib/flipper/adapter_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,12 @@ def initialize(&block)
block.arity == 0 ? instance_eval(&block) : block.call(self) if block
end

if RUBY_VERSION >= '3.0'
def use(klass, *args, **kwargs, &block)
@stack.push ->(adapter) { klass.new(adapter, *args, **kwargs, &block) }
end
else
def use(klass, *args, &block)
@stack.push ->(adapter) { klass.new(adapter, *args, &block) }
end
def use(klass, *args, **kwargs, &block)
@stack.push ->(adapter) { klass.new(adapter, *args, **kwargs, &block) }
end

if RUBY_VERSION >= '3.0'
def store(adapter, *args, **kwargs, &block)
@store = adapter.respond_to?(:call) ? adapter : -> { adapter.new(*args, **kwargs, &block) }
end
else
def store(adapter, *args, &block)
@store = adapter.respond_to?(:call) ? adapter : -> { adapter.new(*args, &block) }
end
def store(adapter, *args, **kwargs, &block)
@store = adapter.respond_to?(:call) ? adapter : -> { adapter.new(*args, **kwargs, &block) }
end

def to_adapter
Expand Down
10 changes: 2 additions & 8 deletions lib/flipper/adapters/memoizable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -143,14 +143,8 @@ def memoizing?
!!@memoize
end

if RUBY_VERSION >= '3.0'
def method_missing(name, *args, **kwargs, &block)
@adapter.send name, *args, **kwargs, &block
end
else
def method_missing(name, *args, &block)
@adapter.send name, *args, &block
end
def method_missing(name, *args, **kwargs, &block)
@adapter.send name, *args, **kwargs, &block
end

private
Expand Down
10 changes: 2 additions & 8 deletions lib/flipper/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,8 @@ def adapter(&block)
end

# An adapter to use to augment the primary storage adapter. See `AdapterBuilder#use`
if RUBY_VERSION >= '3.0'
def use(klass, *args, **kwargs, &block)
@builder.use(klass, *args, **kwargs, &block)
end
else
def use(klass, *args, &block)
@builder.use(klass, *args, &block)
end
def use(klass, *args, **kwargs, &block)
@builder.use(klass, *args, **kwargs, &block)
end

# Controls the default instance for flipper. When used with a block it
Expand Down
10 changes: 2 additions & 8 deletions lib/flipper/types/actor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,8 @@ def respond_to?(*args)
super || @actor.respond_to?(*args)
end

if RUBY_VERSION >= '3.0'
def method_missing(name, *args, **kwargs, &block)
@actor.send name, *args, **kwargs, &block
end
else
def method_missing(name, *args, &block)
@actor.send name, *args, &block
end
def method_missing(name, *args, **kwargs, &block)
@actor.send name, *args, **kwargs, &block
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/flipper/version.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module Flipper
VERSION = '1.1.2'.freeze

REQUIRED_RUBY_VERSION = '2.6'.freeze
REQUIRED_RUBY_VERSION = '3.0'.freeze
NEXT_REQUIRED_RUBY_VERSION = '3.0'.freeze

REQUIRED_RAILS_VERSION = '5.2'.freeze
Expand Down
10 changes: 4 additions & 6 deletions spec/flipper/cloud_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,10 @@
described_class.new(token: 'asdf', open_timeout: 1)
end

if RUBY_VERSION >= '2.6.0'
it 'can set write_timeout' do
expect(Flipper::Adapters::Http::Client).to receive(:new)
.with(hash_including(open_timeout: 1)).at_least(:once)
described_class.new(token: 'asdf', open_timeout: 1)
end
it 'can set write_timeout' do
expect(Flipper::Adapters::Http::Client).to receive(:new)
.with(hash_including(open_timeout: 1)).at_least(:once)
described_class.new(token: 'asdf', open_timeout: 1)
end

it 'can import' do
Expand Down