Skip to content

Commit

Permalink
Clean up various spots that were patched to support EOL Rails versions
Browse files Browse the repository at this point in the history
  • Loading branch information
larouxn committed Nov 18, 2024
1 parent f739847 commit 1a59fab
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 51 deletions.
3 changes: 1 addition & 2 deletions lib/flipper/instrumentation/log_subscriber.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,7 @@ def self.attach
end

def self.detach
# Rails 5.2 doesn't support this, that's fine
detach_from InstrumentationNamespace if respond_to?(:detach_from)
detach_from InstrumentationNamespace
end

private
Expand Down
8 changes: 4 additions & 4 deletions lib/flipper/version.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
module Flipper
VERSION = '1.3.1'.freeze

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

REQUIRED_RAILS_VERSION = '5.2'.freeze
NEXT_REQUIRED_RAILS_VERSION = '6.1.0'.freeze
REQUIRED_RAILS_VERSION = '7.0'.freeze
NEXT_REQUIRED_RAILS_VERSION = '7.1'.freeze

def self.deprecated_ruby_version?
Gem::Version.new(RUBY_VERSION) < Gem::Version.new(NEXT_REQUIRED_RUBY_VERSION)
Expand Down
20 changes: 0 additions & 20 deletions script/test
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,6 @@ cd $(dirname "$0")/..
exit 0
}

export RAILS_VERSION=5.0.0
script/bootstrap || bundle update
bundle exec rake

export RAILS_VERSION=5.1.4
script/bootstrap || bundle update
bundle exec rake

export RAILS_VERSION=5.2.3
script/bootstrap || bundle update
bundle exec rake

export RAILS_VERSION=6.0.0
script/bootstrap || bundle update
bundle exec rake

export RAILS_VERSION=6.1.0
script/bootstrap || bundle update
bundle exec rake

export RAILS_VERSION=7.0.0
script/bootstrap || bundle update
bundle exec rake
Expand Down
14 changes: 1 addition & 13 deletions spec/flipper/engine_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -298,22 +298,10 @@
end

context 'with cloud secrets in Rails.credentials' do
around do |example|
# Create temporary directory for Rails.root to write credentials to
# Once Rails 5.2 support is dropped, this can all be replaced with
# `config.credentials.content_path = Tempfile.new.path`
Dir.mktmpdir do |dir|
Dir.chdir(dir) do
Dir.mkdir("#{dir}/config")

example.run
end
end
end

before do
# Set master key which is needed to write credentials
ENV["RAILS_MASTER_KEY"] = "a" * 32
application.config.credentials.content_path = Tempfile.new.path

application.credentials.write(YAML.dump({
flipper: {
Expand Down
7 changes: 1 addition & 6 deletions spec/flipper/instrumentation/log_subscriber_spec.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
require 'logger'
require 'flipper/instrumentation/log_subscriber'
require 'flipper/adapters/instrumented'

begin
require 'active_support/isolated_execution_state'
rescue LoadError
# ActiveSupport::IsolatedExecutionState is only available in Rails 5.2+
end
require 'active_support/isolated_execution_state'

# Don't log in other tests, we'll manually re-attach when this one starts
Flipper::Instrumentation::LogSubscriber.detach
Expand Down
7 changes: 1 addition & 6 deletions spec/flipper/instrumentation/statsd_subscriber_spec.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
require 'flipper/adapters/instrumented'
require 'flipper/instrumentation/statsd'

begin
require 'active_support/isolated_execution_state'
rescue LoadError
# ActiveSupport::IsolatedExecutionState is only available in Rails 5.2+
end
require 'active_support/isolated_execution_state'

RSpec.describe Flipper::Instrumentation::StatsdSubscriber do
let(:statsd_client) { Statsd.new }
Expand Down

0 comments on commit 1a59fab

Please sign in to comment.