Skip to content

Commit

Permalink
Remove support for EOL Rails 5.2
Browse files Browse the repository at this point in the history
  • Loading branch information
bensheldon committed Jun 24, 2022
1 parent be3894f commit 4a42638
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 87 deletions.
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ inherit_mode:

AllCops:
TargetRubyVersion: 2.5
TargetRailsVersion: 5.2
TargetRailsVersion: 6.0
DisplayCopNames: true
DisplayStyleGuide: true
Include:
Expand Down
7 changes: 0 additions & 7 deletions Appraisals
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
# frozen_string_literal: true
ruby_2 = Gem::Version.new(RUBY_VERSION) < Gem::Version.new('3')
ruby_27_or_higher = Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.7')
ruby_31_or_higher = Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3.1')
jruby = RUBY_PLATFORM.include?('java')

if ruby_2
appraise "rails-5.2" do
gem "rails", "~> 5.2.0"
end
end

unless ruby_31_or_higher # https://github.com/rails/rails/issues/44090#issuecomment-1007686519
appraise "rails-6.0" do
gem "rails", "~> 6.0.0"
Expand Down
25 changes: 2 additions & 23 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ PATH
remote: .
specs:
good_job (2.17.1)
activejob (>= 5.2.0)
activerecord (>= 5.2.0)
activejob (>= 6.0.0)
activerecord (>= 6.0.0)
concurrent-ruby (>= 1.0.2)
fugit (>= 1.1)
railties (>= 5.2.0)
Expand Down Expand Up @@ -73,11 +73,6 @@ GEM
activerecord-explain-analyze (0.1.0)
activerecord (>= 4)
pg
activerecord-jdbc-adapter (61.2-java)
activerecord (~> 6.1.0)
activerecord-jdbcpostgresql-adapter (61.2-java)
activerecord-jdbc-adapter (= 61.2)
jdbc-postgres (>= 9.4, < 43)
activestorage (6.1.5.1)
actionpack (= 6.1.5.1)
activejob (= 6.1.5.1)
Expand Down Expand Up @@ -187,7 +182,6 @@ GEM
faraday-rack (1.0.0)
faraday-retry (1.0.3)
ffi (1.15.5)
ffi (1.15.5-java)
fiber-local (1.0.0)
foreman (0.87.2)
fugit (1.5.3)
Expand Down Expand Up @@ -220,7 +214,6 @@ GEM
rails-i18n
rainbow (>= 2.2.2, < 4.0)
terminal-table (>= 1.5.1)
jdbc-postgres (42.2.25)
kramdown (2.4.0)
rexml
kramdown-parser-gfm (1.1.0)
Expand Down Expand Up @@ -252,12 +245,9 @@ GEM
multi_json (1.15.0)
multipart-post (2.1.1)
nio4r (2.5.8)
nio4r (2.5.8-java)
nokogiri (1.12.5)
mini_portile2 (~> 2.6.1)
racc (~> 1.4)
nokogiri (1.12.5-java)
racc (~> 1.4)
octokit (4.22.0)
faraday (>= 0.9)
sawyer (~> 0.8.0, >= 0.5.3)
Expand All @@ -276,10 +266,6 @@ GEM
pry (0.13.1)
coderay (~> 1.1)
method_source (~> 1.0)
pry (0.13.1-java)
coderay (~> 1.1)
method_source (~> 1.0)
spoon (~> 0.0)
pry-byebug (3.9.0)
byebug (~> 11.0)
pry (~> 0.13.0)
Expand All @@ -288,11 +274,8 @@ GEM
public_suffix (4.0.7)
puma (5.6.4)
nio4r (~> 2.0)
puma (5.6.4-java)
nio4r (~> 2.0)
raabro (1.4.0)
racc (1.6.0)
racc (1.6.0-java)
rack (2.2.3)
rack-test (1.1.0)
rack (>= 1.0, < 3)
Expand Down Expand Up @@ -381,8 +364,6 @@ GEM
rubyzip (>= 1.2.2)
sigdump (0.2.4)
smart_properties (1.17.0)
spoon (0.0.6)
ffi
sprockets (4.0.3)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
Expand All @@ -403,8 +384,6 @@ GEM
webrick (1.7.0)
websocket-driver (0.7.5)
websocket-extensions (>= 0.1.0)
websocket-driver (0.7.5-java)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
xpath (3.2.0)
nokogiri (~> 1.8)
Expand Down
2 changes: 1 addition & 1 deletion app/views/layouts/good_job/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<%= tag.script "", src: rails_ujs_path(format: :js, v: GoodJob::VERSION, locale: nil), nonce: content_security_policy_nonce %>
<%= tag.script "", src: es_module_shims_path(format: :js, v: GoodJob::VERSION, locale: nil), async: true, nonce: content_security_policy_nonce %>
<% importmaps = { imports: GoodJob::AssetsController.js_modules.keys.each_with_object({}) { |module_name, imports| imports[module_name] = modules_path(module_name, format: :js, locale: nil, v: GoodJob::VERSION) } } %>
<% importmaps = { imports: GoodJob::AssetsController.js_modules.keys.index_with { |module_name| modules_path(module_name, format: :js, locale: nil, v: GoodJob::VERSION) } } %>
<%= tag.script importmaps.to_json.html_safe, type: "importmap", nonce: content_security_policy_nonce %>
<%= tag.script "", src: scripts_path(format: :js, v: GoodJob::VERSION, locale: nil), type: "module", nonce: content_security_policy_nonce %>
</head>
Expand Down
29 changes: 0 additions & 29 deletions gemfiles/rails_5.2.gemfile

This file was deleted.

4 changes: 2 additions & 2 deletions good_job.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ Gem::Specification.new do |spec|

spec.required_ruby_version = ">= 2.5.0"

spec.add_dependency "activejob", ">= 5.2.0"
spec.add_dependency "activerecord", ">= 5.2.0"
spec.add_dependency "activejob", ">= 6.0.0"
spec.add_dependency "activerecord", ">= 6.0.0"
spec.add_dependency "concurrent-ruby", ">= 1.0.2"
spec.add_dependency "fugit", ">= 1.1"
spec.add_dependency "railties", ">= 5.2.0"
Expand Down
4 changes: 2 additions & 2 deletions lib/good_job/current_thread.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ def self.reset(values = {})
# Exports values to hash
# @return [Hash]
def self.to_h
ACCESSORS.each_with_object({}) do |accessor, hash|
hash[accessor] = send(accessor)
ACCESSORS.index_with do |accessor|
send(accessor)
end
end

Expand Down
41 changes: 19 additions & 22 deletions spec/lib/good_job/execution_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -287,32 +287,29 @@ def perform(result_value = nil, raise_error: false)
expect(result.unhandled_error).to be_an_instance_of TestJob::ExpectedError
end

if Gem::Version.new(Rails.version) > Gem::Version.new("6")
# Necessary instrumentation was added in Rails 6.0
context 'when retry_on is used' do
before do
TestJob.retry_on(StandardError, wait: 0, attempts: Float::INFINITY) { nil }
end

it 'returns the error' do
result = good_job.perform

expect(result.value).to be_nil
expect(result.handled_error).to be_an_instance_of TestJob::ExpectedError
end
context 'when retry_on is used' do
before do
TestJob.retry_on(StandardError, wait: 0, attempts: Float::INFINITY) { nil }
end

context 'when discard_on is used' do
before do
TestJob.discard_on(StandardError) { nil }
end
it 'returns the error' do
result = good_job.perform

it 'returns the error' do
result = good_job.perform
expect(result.value).to be_nil
expect(result.handled_error).to be_an_instance_of TestJob::ExpectedError
end
end

context 'when discard_on is used' do
before do
TestJob.discard_on(StandardError) { nil }
end

it 'returns the error' do
result = good_job.perform

expect(result.value).to be_nil
expect(result.handled_error).to be_an_instance_of TestJob::ExpectedError
end
expect(result.value).to be_nil
expect(result.handled_error).to be_an_instance_of TestJob::ExpectedError
end
end
end
Expand Down

0 comments on commit 4a42638

Please sign in to comment.