From d6bc5cc1eb5ec7984443e852b299d8f110dea4d0 Mon Sep 17 00:00:00 2001 From: willnet Date: Mon, 11 Oct 2021 16:27:11 +0900 Subject: [PATCH 01/22] Add Rails7 support --- .github/workflows/ci.yml | 30 ++++++++++++++++++++++++++---- Gemfile | 18 +++++++++++++----- delayed_job.gemspec | 2 +- 3 files changed, 40 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1f78e0b26..29bcb0f80 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,13 +12,23 @@ jobs: strategy: fail-fast: false matrix: - ruby: [2.5, 2.6, 2.7, jruby, jruby-head, ruby-head] + ruby: [2.7, 3.0, ruby-head] rails_version: - - '5.2.0' - - '6.0.0' - - '6.1.0.rc2' + - '7.0.0.alpha2' - 'edge' include: + - ruby: 2.5 + rails_version: '6.1.0' + - ruby: 2.6 + rails_version: '6.1.0' + - ruby: 2.7 + rails_version: '6.1.0' + - ruby: 3.0 + rails_version: '6.1.0' + - ruby: jruby + rails_version: '6.1.0' + - ruby: jruby-head + rails_version: '6.1.0' # # The past # @@ -33,6 +43,18 @@ jobs: rails_version: '5.0.0' - ruby: 2.5 rails_version: '5.1.0' + - ruby: 2.5 + rails_version: '5.2.0' + - ruby: 2.5 + rails_version: '6.0.0' + - ruby: 2.6 + rails_version: '6.0.0' + - ruby: 2.7 + rails_version: '6.0.0' + - ruby: jruby + rails_version: '6.0.0' + - ruby: jruby-head + rails_version: '6.0.0' continue-on-error: ${{ matrix.rails_version == 'edge' || endsWith(matrix.ruby, 'head') }} diff --git a/Gemfile b/Gemfile index b83acb5bc..85d91dc3f 100644 --- a/Gemfile +++ b/Gemfile @@ -15,8 +15,16 @@ end platforms :jruby do if ENV['RAILS_VERSION'] == '4.2.0' gem 'activerecord-jdbcsqlite3-adapter', '< 50.0' - elsif ENV['RAILS_VERSION'] == 'edge' || ENV['RAILS_VERSION'] == '6.1.0.rc2' - gem 'activerecord-jdbcsqlite3-adapter', :github => 'jruby/activerecord-jdbc-adapter' + elsif ENV['RAILS_VERSION'] == '5.0.0' + gem 'activerecord-jdbcsqlite3-adapter', '~> 50.0' + elsif ENV['RAILS_VERSION'] == '5.1.0' + gem 'activerecord-jdbcsqlite3-adapter', '~> 51.0' + elsif ENV['RAILS_VERSION'] == '5.2.0' + gem 'activerecord-jdbcsqlite3-adapter', '~> 52.0' + elsif ENV['RAILS_VERSION'] == '6.0.0' + gem 'activerecord-jdbcsqlite3-adapter', '~> 60.0' + elsif ENV['RAILS_VERSION'] == '6.1.0' + gem 'activerecord-jdbcsqlite3-adapter', '~> 61.0' else gem 'activerecord-jdbcsqlite3-adapter' end @@ -27,7 +35,7 @@ platforms :jruby do elsif ENV['RAILS_VERSION'] gem 'railties', "~> #{ENV['RAILS_VERSION']}" else - gem 'railties', ['>= 3.0', '< 6.2'] + gem 'railties', ['>= 3.0', '< 7.0'] end end @@ -43,8 +51,8 @@ group :test do gem 'actionmailer', "~> #{ENV['RAILS_VERSION']}" gem 'activerecord', "~> #{ENV['RAILS_VERSION']}" else - gem 'actionmailer', ['>= 3.0', '< 6.2'] - gem 'activerecord', ['>= 3.0', '< 6.2'] + gem 'actionmailer', ['>= 3.0', '< 7.1'] + gem 'activerecord', ['>= 3.0', '< 7.1'] end gem 'rspec', '>= 3' diff --git a/delayed_job.gemspec b/delayed_job.gemspec index c9b60a781..23eec33e6 100644 --- a/delayed_job.gemspec +++ b/delayed_job.gemspec @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- Gem::Specification.new do |spec| - spec.add_dependency 'activesupport', ['>= 3.0', '< 6.2'] + spec.add_dependency 'activesupport', ['>= 3.0', '< 7.1'] spec.authors = ['Brandon Keepers', 'Brian Ryckbost', 'Chris Gaffney', 'David Genord II', 'Erik Michaels-Ober', 'Matt Griffin', 'Steve Richert', 'Tobias Lütke'] spec.description = 'Delayed_job (or DJ) encapsulates the common pattern of asynchronously executing longer tasks in the background. It is a direct extraction from Shopify where the job table is responsible for a multitude of core tasks.' spec.email = ['brian@collectiveidea.com'] From 9bd70707c388aea23394bb8dc7fbf2bea0750983 Mon Sep 17 00:00:00 2001 From: willnet Date: Mon, 11 Oct 2021 16:42:11 +0900 Subject: [PATCH 02/22] net/smtp isn't bundled by default from Ruby 3.1 ref: https://bugs.ruby-lang.org/issues/17873 --- Gemfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Gemfile b/Gemfile index 85d91dc3f..c309de164 100644 --- a/Gemfile +++ b/Gemfile @@ -10,6 +10,8 @@ platforms :ruby do else gem 'sqlite3' end + + gem 'net/smtp' if ENV['RAILS_VERSION'] == 'ruby-head' end platforms :jruby do From 56ae06889814c7619a68d7110c96cd6c06ed7f5a Mon Sep 17 00:00:00 2001 From: willnet Date: Mon, 11 Oct 2021 17:41:59 +0900 Subject: [PATCH 03/22] Split jruby version with 9.2.x and 9.3.x jruby 9.3 seems not to work with rails --- .github/workflows/ci.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 29bcb0f80..00fdfcd69 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,7 +25,9 @@ jobs: rails_version: '6.1.0' - ruby: 3.0 rails_version: '6.1.0' - - ruby: jruby + - ruby: jruby-9.2 + rails_version: '6.1.0' + - ruby: jruby-9.3 rails_version: '6.1.0' - ruby: jruby-head rails_version: '6.1.0' @@ -51,7 +53,9 @@ jobs: rails_version: '6.0.0' - ruby: 2.7 rails_version: '6.0.0' - - ruby: jruby + - ruby: jruby-9.2 + rails_version: '6.0.0' + - ruby: jruby-9.3 rails_version: '6.0.0' - ruby: jruby-head rails_version: '6.0.0' From 069b642b01d904ff136ef46fbf9eb3d319932a47 Mon Sep 17 00:00:00 2001 From: willnet Date: Mon, 18 Oct 2021 17:14:54 +0900 Subject: [PATCH 04/22] Add railties to use zeitwerk specs about autoload needs zeitwerk which raitlies depends on ref https://github.com/willnet/delayed_job/runs/3856963931?check_suite_focus=true --- Gemfile | 5 ++++- spec/delayed/command_spec.rb | 18 ++++++++++-------- spec/helper.rb | 12 ++++-------- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/Gemfile b/Gemfile index c309de164..28fe440bb 100644 --- a/Gemfile +++ b/Gemfile @@ -37,7 +37,7 @@ platforms :jruby do elsif ENV['RAILS_VERSION'] gem 'railties', "~> #{ENV['RAILS_VERSION']}" else - gem 'railties', ['>= 3.0', '< 7.0'] + gem 'railties', ['>= 3.0', '< 7.1'] end end @@ -49,12 +49,15 @@ group :test do if ENV['RAILS_VERSION'] == 'edge' gem 'actionmailer', :github => 'rails/rails' gem 'activerecord', :github => 'rails/rails' + gem 'railties', :github => 'rails/rails' elsif ENV['RAILS_VERSION'] gem 'actionmailer', "~> #{ENV['RAILS_VERSION']}" gem 'activerecord', "~> #{ENV['RAILS_VERSION']}" + gem 'railties', "~> #{ENV['RAILS_VERSION']}" else gem 'actionmailer', ['>= 3.0', '< 7.1'] gem 'activerecord', ['>= 3.0', '< 7.1'] + gem 'railties', ['>= 3.0', '< 7.1'] end gem 'rspec', '>= 3' diff --git a/spec/delayed/command_spec.rb b/spec/delayed/command_spec.rb index b57cd6efa..9ac6e0862 100644 --- a/spec/delayed/command_spec.rb +++ b/spec/delayed/command_spec.rb @@ -159,16 +159,18 @@ describe 'running worker pools defined by multiple --pool arguments' do it 'should run the correct worker processes' do command = Delayed::Command.new(['--pool=*:1', '--pool=test_queue:4', '--pool=mailers,misc:2']) - expect(FileUtils).to receive(:mkdir_p).with('./tmp/pids').once + pid_dir = File.expand_path('./tmp/pids') + log_dir = File.expand_path('./log') + expect(FileUtils).to receive(:mkdir_p).with(pid_dir).once [ - ['delayed_job.0', {:quiet => true, :pid_dir => './tmp/pids', :log_dir => './log', :queues => []}], - ['delayed_job.1', {:quiet => true, :pid_dir => './tmp/pids', :log_dir => './log', :queues => ['test_queue']}], - ['delayed_job.2', {:quiet => true, :pid_dir => './tmp/pids', :log_dir => './log', :queues => ['test_queue']}], - ['delayed_job.3', {:quiet => true, :pid_dir => './tmp/pids', :log_dir => './log', :queues => ['test_queue']}], - ['delayed_job.4', {:quiet => true, :pid_dir => './tmp/pids', :log_dir => './log', :queues => ['test_queue']}], - ['delayed_job.5', {:quiet => true, :pid_dir => './tmp/pids', :log_dir => './log', :queues => %w[mailers misc]}], - ['delayed_job.6', {:quiet => true, :pid_dir => './tmp/pids', :log_dir => './log', :queues => %w[mailers misc]}] + ['delayed_job.0', {:quiet => true, :pid_dir => pid_dir, :log_dir => log_dir, :queues => []}], + ['delayed_job.1', {:quiet => true, :pid_dir => pid_dir, :log_dir => log_dir, :queues => ['test_queue']}], + ['delayed_job.2', {:quiet => true, :pid_dir => pid_dir, :log_dir => log_dir, :queues => ['test_queue']}], + ['delayed_job.3', {:quiet => true, :pid_dir => pid_dir, :log_dir => log_dir, :queues => ['test_queue']}], + ['delayed_job.4', {:quiet => true, :pid_dir => pid_dir, :log_dir => log_dir, :queues => ['test_queue']}], + ['delayed_job.5', {:quiet => true, :pid_dir => pid_dir, :log_dir => log_dir, :queues => %w[mailers misc]}], + ['delayed_job.6', {:quiet => true, :pid_dir => pid_dir, :log_dir => log_dir, :queues => %w[mailers misc]}] ].each do |args| expect(command).to receive(:run_process).with(*args).once end diff --git a/spec/helper.rb b/spec/helper.rb index e3d528d1a..b39b6d8bf 100644 --- a/spec/helper.rb +++ b/spec/helper.rb @@ -21,6 +21,7 @@ require 'action_mailer' require 'active_record' +require 'rails' require 'delayed_job' require 'delayed/backend/shared_spec' @@ -36,14 +37,7 @@ end ENV['RAILS_ENV'] = 'test' -# Trigger AR to initialize -ActiveRecord::Base # rubocop:disable Void - -module Rails - def self.root - '.' - end -end +FakeApp = Class.new(Rails::Application) Delayed::Worker.backend = :test @@ -76,6 +70,8 @@ def whatever(n, _) handle_asynchronously :whatever end +FakeApp.initialize! + RSpec.configure do |config| config.after(:each) do Delayed::Worker.reset From 7246e56baa58d7f6e92981b58364779bbc84ca22 Mon Sep 17 00:00:00 2001 From: willnet Date: Mon, 18 Oct 2021 17:59:21 +0900 Subject: [PATCH 05/22] net/smtp isn't bundled with Ruby from 3.1.0-dev --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 28fe440bb..7174a2f63 100644 --- a/Gemfile +++ b/Gemfile @@ -59,7 +59,7 @@ group :test do gem 'activerecord', ['>= 3.0', '< 7.1'] gem 'railties', ['>= 3.0', '< 7.1'] end - + gem 'net-smtp' if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3.1.0-dev') gem 'rspec', '>= 3' gem 'simplecov', :require => false if /\A2.[12]/ =~ RUBY_VERSION From 587f501fedf59c7331052e27d88cf70bdbde0eb0 Mon Sep 17 00:00:00 2001 From: willnet Date: Mon, 25 Oct 2021 17:17:22 +0900 Subject: [PATCH 06/22] Fix a warning from rails ``` config.eager_load is set to nil. Please update your config/environments/*.rb files accordingly: * development - set it to false * test - set it to false (unless you use a tool that preloads your test environment) * production - set it to true ```` --- spec/helper.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/helper.rb b/spec/helper.rb index b39b6d8bf..f93219e48 100644 --- a/spec/helper.rb +++ b/spec/helper.rb @@ -38,6 +38,7 @@ ENV['RAILS_ENV'] = 'test' FakeApp = Class.new(Rails::Application) +FakeApp.config.eager_load = false Delayed::Worker.backend = :test From 80864629c1cd452a8eafa85e2ad69d6285f37c33 Mon Sep 17 00:00:00 2001 From: willnet Date: Mon, 25 Oct 2021 17:22:54 +0900 Subject: [PATCH 07/22] Fix a broken spec due to Psych >= 4 Since psych4.0, the load method has been safe_load, which causes the following error: YAML#load_dj retains the existing safeYAML support, but uses the version of psych that implements unsafe_load. In YAML#load_dj ``` 1) YAML autoloads the class of an anonymous struct Failure/Error: expect do yaml = "--- !ruby/struct\nn: 1\n" object = YAML.load(yaml) expect(object).to be_kind_of(Struct) expect(object.n).to eq(1) end.not_to raise_error expected no Exception, got # with backtrace: # (eval):2:in `struct' # ./spec/yaml_ext_spec.rb:28:in `block (3 levels) in ' # ./spec/yaml_ext_spec.rb:26:in `block (2 levels) in ' # ./spec/yaml_ext_spec.rb:26:in `block (2 levels) in ' ``` --- lib/delayed/syck_ext.rb | 8 ++++++-- spec/yaml_ext_spec.rb | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/delayed/syck_ext.rb b/lib/delayed/syck_ext.rb index c7cb8154a..52c310b63 100644 --- a/lib/delayed/syck_ext.rb +++ b/lib/delayed/syck_ext.rb @@ -36,7 +36,11 @@ def self.yaml_tag_read_class(name) module YAML def load_dj(yaml) # See https://github.com/dtao/safe_yaml - # When the method is there, we need to load our YAML like this... - respond_to?(:unsafe_load) ? load(yaml, :safe => false) : load(yaml) + # When the module is there, we need to load our YAML like this... + if Object.const_defined?(:SafeYAML) + load(yaml, :safe => false) + elsif respond_to?(:unsafe_load) # psych >= 3.3.2 + unsafe_load(yaml) + end end end diff --git a/spec/yaml_ext_spec.rb b/spec/yaml_ext_spec.rb index aebb9afce..83bceea35 100644 --- a/spec/yaml_ext_spec.rb +++ b/spec/yaml_ext_spec.rb @@ -25,7 +25,7 @@ it 'autoloads the class of an anonymous struct' do expect do yaml = "--- !ruby/struct\nn: 1\n" - object = YAML.load(yaml) + object = load_with_delayed_visitor(yaml) expect(object).to be_kind_of(Struct) expect(object.n).to eq(1) end.not_to raise_error From da97d704293369a69b1df528f3aa3413adcf04ab Mon Sep 17 00:00:00 2001 From: willnet Date: Mon, 25 Oct 2021 17:41:17 +0900 Subject: [PATCH 08/22] Fix a dependency error on ruby-head net-smtp 0.3.0 dependents digest 3.0.0, but edge ruby activates 3.1.0.pre2. The error was avoided by explicitly specifying the version in the Gemfile. ``` bundler: failed to load command: rspec (/home/runner/work/delayed_job/delayed_job/vendor/bundle/ruby/3.1.0/bin/rspec) /home/runner/.rubies/ruby-head/lib/ruby/3.1.0/bundler/runtime.rb:309:in `check_for_activated_spec!': You have already activated digest 3.1.0.pre2, but your Gemfile requires digest 3.0.0. Since digest is a default gem, you can either remove your dependency on it or try updating to a newer version of bundler that supports digest as a default gem. (Gem::LoadError) from /home/runner/.rubies/ruby-head/lib/ruby/3.1.0/bundler/runtime.rb:25:in `block in setup' from /home/runner/.rubies/ruby-head/lib/ruby/3.1.0/bundler/spec_set.rb:136:in `each' from /home/runner/.rubies/ruby-head/lib/ruby/3.1.0/bundler/spec_set.rb:136:in `each' from /home/runner/.rubies/ruby-head/lib/ruby/3.1.0/bundler/runtime.rb:24:in `map' from /home/runner/.rubies/ruby-head/lib/ruby/3.1.0/bundler/runtime.rb:24:in `setup' from /home/runner/.rubies/ruby-head/lib/ruby/3.1.0/bundler.rb:149:in `setup' from /home/runner/.rubies/ruby-head/lib/ruby/3.1.0/bundler/setup.rb:20:in `block in ' from /home/runner/.rubies/ruby-head/lib/ruby/3.1.0/bundler/ui/shell.rb:136:in `with_level' from /home/runner/.rubies/ruby-head/lib/ruby/3.1.0/bundler/ui/shell.rb:88:in `silence' from /home/runner/.rubies/ruby-head/lib/ruby/3.1.0/bundler/setup.rb:20:in `' from /home/runner/.rubies/ruby-head/lib/ruby/3.1.0/bundler/cli/exec.rb:56:in `require_relative' from /home/runner/.rubies/ruby-head/lib/ruby/3.1.0/bundler/cli/exec.rb:56:in `kernel_load' from /home/runner/.rubies/ruby-head/lib/ruby/3.1.0/bundler/cli/exec.rb:23:in `run' from /home/runner/.rubies/ruby-head/lib/ruby/3.1.0/bundler/cli.rb:478:in `exec' from /home/runner/.rubies/ruby-head/lib/ruby/3.1.0/bundler/vendor/thor/lib/thor/command.rb:27:in `run' from /home/runner/.rubies/ruby-head/lib/ruby/3.1.0/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command' from /home/runner/.rubies/ruby-head/lib/ruby/3.1.0/bundler/vendor/thor/lib/thor.rb:392:in `dispatch' from /home/runner/.rubies/ruby-head/lib/ruby/3.1.0/bundler/cli.rb:31:in `dispatch' from /home/runner/.rubies/ruby-head/lib/ruby/3.1.0/bundler/vendor/thor/lib/thor/base.rb:485:in `start' from /home/runner/.rubies/ruby-head/lib/ruby/3.1.0/bundler/cli.rb:25:in `start' from /home/runner/.rubies/ruby-head/lib/ruby/gems/3.1.0/gems/bundler-2.3.0.dev/libexec/bundle:49:in `block in ' from /home/runner/.rubies/ruby-head/lib/ruby/3.1.0/bundler/friendly_errors.rb:128:in `with_friendly_errors' from /home/runner/.rubies/ruby-head/lib/ruby/gems/3.1.0/gems/bundler-2.3.0.dev/libexec/bundle:37:in `' from /home/runner/.rubies/ruby-head/bin/bundle:23:in `load' from /home/runner/.rubies/ruby-head/bin/bundle:23:in `
' ``` --- Gemfile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 7174a2f63..d8595c005 100644 --- a/Gemfile +++ b/Gemfile @@ -59,7 +59,10 @@ group :test do gem 'activerecord', ['>= 3.0', '< 7.1'] gem 'railties', ['>= 3.0', '< 7.1'] end - gem 'net-smtp' if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3.1.0-dev') + if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3.1.0-dev') + gem 'digest', '>= 3.1.0.pre2' + gem 'net-smtp' + end gem 'rspec', '>= 3' gem 'simplecov', :require => false if /\A2.[12]/ =~ RUBY_VERSION From 7a63bc1e2ce0543a3e6319313996805df34734c9 Mon Sep 17 00:00:00 2001 From: willnet Date: Mon, 13 Dec 2021 17:13:49 +0900 Subject: [PATCH 09/22] Bump rails from 7.0.0.alpha2 to 7.0.0.rc1 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 00fdfcd69..a235ef0c9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,7 @@ jobs: matrix: ruby: [2.7, 3.0, ruby-head] rails_version: - - '7.0.0.alpha2' + - '7.0.0.rc1' - 'edge' include: - ruby: 2.5 From 5accab438177e4b02a29477a49cc2f96f1806194 Mon Sep 17 00:00:00 2001 From: willnet Date: Mon, 20 Dec 2021 16:58:11 +0900 Subject: [PATCH 10/22] Bump rails from 7.0.0.rc1 to 7.0.0 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a235ef0c9..538d41990 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,7 @@ jobs: matrix: ruby: [2.7, 3.0, ruby-head] rails_version: - - '7.0.0.rc1' + - '7.0.0' - 'edge' include: - ruby: 2.5 From aedbbd1b2c5fae22d07aad83e0984fc0b1b38504 Mon Sep 17 00:00:00 2001 From: willnet Date: Mon, 27 Dec 2021 17:16:08 +0900 Subject: [PATCH 11/22] Ruby 3.1 released we don't have to add digest gem explicitly. --- .github/workflows/ci.yml | 2 +- Gemfile | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 538d41990..a9a7046c5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,7 +12,7 @@ jobs: strategy: fail-fast: false matrix: - ruby: [2.7, 3.0, ruby-head] + ruby: [2.7, 3.0, 3.1, ruby-head] rails_version: - '7.0.0' - 'edge' diff --git a/Gemfile b/Gemfile index d8595c005..e194953d3 100644 --- a/Gemfile +++ b/Gemfile @@ -59,10 +59,7 @@ group :test do gem 'activerecord', ['>= 3.0', '< 7.1'] gem 'railties', ['>= 3.0', '< 7.1'] end - if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3.1.0-dev') - gem 'digest', '>= 3.1.0.pre2' - gem 'net-smtp' - end + gem 'net-smtp' if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3.1.0') gem 'rspec', '>= 3' gem 'simplecov', :require => false if /\A2.[12]/ =~ RUBY_VERSION From 6861d2b16be1ac592ca34f2696fd5af9b7ba5e8c Mon Sep 17 00:00:00 2001 From: willnet Date: Mon, 27 Dec 2021 17:18:38 +0900 Subject: [PATCH 12/22] Remove useless gem dependency --- Gemfile | 2 -- 1 file changed, 2 deletions(-) diff --git a/Gemfile b/Gemfile index e194953d3..3884b7cb1 100644 --- a/Gemfile +++ b/Gemfile @@ -10,8 +10,6 @@ platforms :ruby do else gem 'sqlite3' end - - gem 'net/smtp' if ENV['RAILS_VERSION'] == 'ruby-head' end platforms :jruby do From 562a46064fc6e7a765acf8b76c7aa2c7936ecaac Mon Sep 17 00:00:00 2001 From: willnet Date: Mon, 27 Dec 2021 18:01:31 +0900 Subject: [PATCH 13/22] syck has nothing to do with the pych 4.0 --- lib/delayed/syck_ext.rb | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/lib/delayed/syck_ext.rb b/lib/delayed/syck_ext.rb index 52c310b63..df04842d6 100644 --- a/lib/delayed/syck_ext.rb +++ b/lib/delayed/syck_ext.rb @@ -37,10 +37,6 @@ module YAML def load_dj(yaml) # See https://github.com/dtao/safe_yaml # When the module is there, we need to load our YAML like this... - if Object.const_defined?(:SafeYAML) - load(yaml, :safe => false) - elsif respond_to?(:unsafe_load) # psych >= 3.3.2 - unsafe_load(yaml) - end + respond_to?(:unsafe_load) ? load(yaml, :safe => false) : load(yaml) end end From 8a4ad455e1f170173f9497d52127e39b25ffdce8 Mon Sep 17 00:00:00 2001 From: willnet Date: Mon, 17 Jan 2022 16:50:15 +0900 Subject: [PATCH 14/22] Use Rails 7.0.1 instead of 7.0.0 on CI Rails 7.0.0 doesn't work with Ruby 3.1. ref: https://github.com/rails/rails/pull/43951 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a9a7046c5..98d4f8459 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,7 @@ jobs: matrix: ruby: [2.7, 3.0, 3.1, ruby-head] rails_version: - - '7.0.0' + - '7.0.1' - 'edge' include: - ruby: 2.5 From 462288be2fafd25a48b57d3a6d4fe92de600e857 Mon Sep 17 00:00:00 2001 From: willnet Date: Mon, 17 Jan 2022 16:56:24 +0900 Subject: [PATCH 15/22] Enclose every ruby version in quotations If we use Ruby 3.0 without quotations in YAML, It is interpreted as "3". If you specify 3 on GitHub Actions, it means the latest stable version of the 3 series, so 3.1 will be used. --- .github/workflows/ci.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 98d4f8459..12e65a525 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,18 +12,18 @@ jobs: strategy: fail-fast: false matrix: - ruby: [2.7, 3.0, 3.1, ruby-head] + ruby: ['2.7', '3.0', '3.1', 'ruby-head'] rails_version: - '7.0.1' - 'edge' include: - - ruby: 2.5 + - ruby: '2.5' rails_version: '6.1.0' - - ruby: 2.6 + - ruby: '2.6' rails_version: '6.1.0' - - ruby: 2.7 + - ruby: '2.7' rails_version: '6.1.0' - - ruby: 3.0 + - ruby: '3.0' rails_version: '6.1.0' - ruby: jruby-9.2 rails_version: '6.1.0' From c58252a6f0b7367def73d4583b475c080a6b05bc Mon Sep 17 00:00:00 2001 From: willnet Date: Mon, 17 Jan 2022 17:11:22 +0900 Subject: [PATCH 16/22] Remove duplicated gem dependencies MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When using Ruby 3.0 or 3.1, GitHub Actions fails likes following. ``` --- ERROR REPORT TEMPLATE ------------------------------------------------------- ``` NoMethodError: undefined method `metadata' for nil:NilClass /opt/hostedtoolcache/Ruby/3.0.3/x64/lib/ruby/3.0.0/bundler/cli/common.rb:22:in `block in output_fund_metadata_summary' /opt/hostedtoolcache/Ruby/3.0.3/x64/lib/ruby/3.0.0/bundler/cli/common.rb:22:in `count' /opt/hostedtoolcache/Ruby/3.0.3/x64/lib/ruby/3.0.0/bundler/cli/common.rb:22:in `output_fund_metadata_summary' /opt/hostedtoolcache/Ruby/3.0.3/x64/lib/ruby/3.0.0/bundler/cli/install.rb:85:in `run' /opt/hostedtoolcache/Ruby/3.0.3/x64/lib/ruby/3.0.0/bundler/cli.rb:253:in `block in install' /opt/hostedtoolcache/Ruby/3.0.3/x64/lib/ruby/3.0.0/bundler/settings.rb:131:in `temporary' /opt/hostedtoolcache/Ruby/3.0.3/x64/lib/ruby/3.0.0/bundler/cli.rb:252:in `install' /opt/hostedtoolcache/Ruby/3.0.3/x64/lib/ruby/3.0.0/bundler/vendor/thor/lib/thor/command.rb:27:in `run' /opt/hostedtoolcache/Ruby/3.0.3/x64/lib/ruby/3.0.0/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command' /opt/hostedtoolcache/Ruby/3.0.3/x64/lib/ruby/3.0.0/bundler/vendor/thor/lib/thor.rb:392:in `dispatch' /opt/hostedtoolcache/Ruby/3.0.3/x64/lib/ruby/3.0.0/bundler/cli.rb:31:in `dispatch' /opt/hostedtoolcache/Ruby/3.0.3/x64/lib/ruby/3.0.0/bundler/vendor/thor/lib/thor/base.rb:485:in `start' /opt/hostedtoolcache/Ruby/3.0.3/x64/lib/ruby/3.0.0/bundler/cli.rb:25:in `start' /opt/hostedtoolcache/Ruby/3.0.3/x64/lib/ruby/gems/3.0.0/gems/bundler-2.2.32/libexec/bundle:49:in `block in ' /opt/hostedtoolcache/Ruby/3.0.3/x64/lib/ruby/3.0.0/bundler/friendly_errors.rb:103:in `with_friendly_errors' /opt/hostedtoolcache/Ruby/3.0.3/x64/lib/ruby/gems/3.0.0/gems/bundler-2.2.32/libexec/bundle:37:in `' /opt/hostedtoolcache/Ruby/3.0.3/x64/bin/bundle:23:in `load' /opt/hostedtoolcache/Ruby/3.0.3/x64/bin/bundle:23:in `
' ``` ## Environment ``` Bundler 2.2.32 Platforms ruby, x86_64-linux Ruby 3.0.3p157 (2021-11-24 revision 3fb7d2cadc18472ec107b14234933b017a33c14d) [x86_64-linux] Full Path /opt/hostedtoolcache/Ruby/3.0.3/x64/bin/ruby Config Dir /opt/hostedtoolcache/Ruby/3.0.3/x64/etc RubyGems 3.2.32 Gem Home /home/runner/work/delayed_job/delayed_job/vendor/bundle/ruby/3.0.0 Gem Path /home/runner/work/delayed_job/delayed_job/vendor/bundle/ruby/3.0.0 User Home /home/runner User Path /home/runner/.local/share/gem/ruby/3.0.0 Bin Dir /home/runner/work/delayed_job/delayed_job/vendor/bundle/ruby/3.0.0/bin OpenSSL Compiled OpenSSL 1.1.1f 31 Mar 2020 Loaded OpenSSL 1.1.1f 31 Mar 2020 Cert File /usr/lib/ssl/cert.pem Cert Dir /usr/lib/ssl/certs Tools Git 2.34.1 RVM not installed rbenv not installed chruby not installed ``` ## Bundler Build Metadata ``` Built At 2022-01-17 Git SHA unknown Released Version false ``` ## Bundler settings ``` jobs Set for your local app (/home/runner/work/delayed_job/delayed_job/.bundle/config): 4 path Set for your local app (/home/runner/work/delayed_job/delayed_job/.bundle/config): "/home/runner/work/delayed_job/delayed_job/vendor/bundle" ``` ## Gemfile ### Gemfile ```ruby source 'https://rubygems.org' gem 'rake' platforms :ruby do # Rails 5.1 is the first to work with sqlite 1.4 # Rails 6 now requires sqlite 1.4 if ENV['RAILS_VERSION'] && ENV['RAILS_VERSION'] < '5.1' gem 'sqlite3', '< 1.4' else gem 'sqlite3' end end platforms :jruby do if ENV['RAILS_VERSION'] == '4.2.0' gem 'activerecord-jdbcsqlite3-adapter', '< 50.0' elsif ENV['RAILS_VERSION'] == '5.0.0' gem 'activerecord-jdbcsqlite3-adapter', '~> 50.0' elsif ENV['RAILS_VERSION'] == '5.1.0' gem 'activerecord-jdbcsqlite3-adapter', '~> 51.0' elsif ENV['RAILS_VERSION'] == '5.2.0' gem 'activerecord-jdbcsqlite3-adapter', '~> 52.0' elsif ENV['RAILS_VERSION'] == '6.0.0' gem 'activerecord-jdbcsqlite3-adapter', '~> 60.0' elsif ENV['RAILS_VERSION'] == '6.1.0' gem 'activerecord-jdbcsqlite3-adapter', '~> 61.0' else gem 'activerecord-jdbcsqlite3-adapter' end gem 'jruby-openssl' gem 'mime-types', ['~> 2.6', '< 2.99'] if ENV['RAILS_VERSION'] == 'edge' gem 'railties', :github => 'rails/rails' elsif ENV['RAILS_VERSION'] gem 'railties', "~> #{ENV['RAILS_VERSION']}" else gem 'railties', ['>= 3.0', '< 7.1'] end end platforms :rbx do gem 'psych' end group :test do if ENV['RAILS_VERSION'] == 'edge' gem 'actionmailer', :github => 'rails/rails' gem 'activerecord', :github => 'rails/rails' gem 'railties', :github => 'rails/rails' elsif ENV['RAILS_VERSION'] gem 'actionmailer', "~> #{ENV['RAILS_VERSION']}" gem 'activerecord', "~> #{ENV['RAILS_VERSION']}" gem 'railties', "~> #{ENV['RAILS_VERSION']}" else gem 'actionmailer', ['>= 3.0', '< 7.1'] gem 'activerecord', ['>= 3.0', '< 7.1'] gem 'railties', ['>= 3.0', '< 7.1'] end gem 'net-smtp' if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3.1.0') gem 'rspec', '>= 3' gem 'simplecov', :require => false if /\A2.[12]/ =~ RUBY_VERSION # 0.8.0 doesn't work with simplecov < 0.18.0 and older ruby can't run 0.18.0 gem 'simplecov-lcov', '< 0.8.0', :require => false else gem 'simplecov-lcov', :require => false end end group :rubocop do gem 'rubocop', '>= 0.25', '< 0.49' end gemspec ``` ### Gemfile.lock ``` PATH remote: . specs: delayed_job (4.1.9) activesupport (>= 3.0, < 7.1) GEM remote: https://rubygems.org/ specs: actionmailer (7.0.1) actionpack (= 7.0.1) actionview (= 7.0.1) activejob (= 7.0.1) activesupport (= 7.0.1) mail (~> 2.5, >= 2.5.4) net-imap net-pop net-smtp rails-dom-testing (~> 2.0) actionpack (7.0.1) actionview (= 7.0.1) activesupport (= 7.0.1) rack (~> 2.0, >= 2.2.0) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) actionview (7.0.1) activesupport (= 7.0.1) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0) activejob (7.0.1) activesupport (= 7.0.1) globalid (>= 0.3.6) activemodel (7.0.1) activesupport (= 7.0.1) activerecord (7.0.1) activemodel (= 7.0.1) activesupport (= 7.0.1) activesupport (7.0.1) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) tzinfo (~> 2.0) ast (2.4.2) builder (3.2.4) concurrent-ruby (1.1.9) crass (1.0.6) diff-lcs (1.5.0) digest (3.1.0) docile (1.4.0) erubi (1.10.0) globalid (1.0.0) activesupport (>= 5.0) i18n (1.8.11) concurrent-ruby (~> 1.0) io-wait (0.2.1) loofah (2.13.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) mail (2.7.1) mini_mime (>= 0.1.1) mini_mime (1.1.2) minitest (5.15.0) net-imap (0.2.3) digest net-protocol strscan net-pop (0.1.1) digest net-protocol timeout net-protocol (0.1.2) io-wait timeout net-smtp (0.3.1) digest net-protocol timeout nokogiri (1.13.1-x86_64-linux) racc (~> 1.4) parser (2.7.2.0) ast (~> 2.4.1) powerpack (0.1.3) psych (4.0.3) stringio racc (1.6.0) rack (2.2.3) rack-test (1.1.0) rack (>= 1.0, < 3) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) rails-html-sanitizer (1.4.2) loofah (~> 2.3) rainbow (2.2.2) rake rake (13.0.6) rspec (3.10.0) rspec-core (~> 3.10.0) rspec-expectations (~> 3.10.0) rspec-mocks (~> 3.10.0) rspec-core (3.10.1) rspec-support (~> 3.10.0) rspec-expectations (3.10.2) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.10.0) rspec-mocks (3.10.2) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.10.0) rspec-support (3.10.3) rubocop (0.48.1) parser (>= 2.3.3.1, < 3.0) powerpack (~> 0.1) rainbow (>= 1.99.1, < 3.0) ruby-progressbar (~> 1.7) unicode-display_width (~> 1.0, >= 1.0.1) ruby-progressbar (1.11.0) simplecov (0.21.2) docile (~> 1.1) simplecov-html (~> 0.11) simplecov_json_formatter (~> 0.1) simplecov-html (0.12.3) simplecov-lcov (0.8.0) simplecov_json_formatter (0.1.3) sqlite3 (1.4.2) stringio (3.0.1) strscan (3.0.1) timeout (0.2.0) tzinfo (2.0.4) concurrent-ruby (~> 1.0) unicode-display_width (1.8.0) PLATFORMS x86_64-linux DEPENDENCIES actionmailer (~> 7.0.1) activerecord (~> 7.0.1) activerecord-jdbcsqlite3-adapter delayed_job! jruby-openssl mime-types (~> 2.6, < 2.99) psych railties (~> 7.0.1) rake rspec (>= 3) rubocop (>= 0.25, < 0.49) simplecov simplecov-lcov sqlite3 BUNDLED WITH 2.2.32 ``` ## Gemspecs ### delayed_job.gemspec ```ruby # -*- encoding: utf-8 -*- Gem::Specification.new do |spec| spec.add_dependency 'activesupport', ['>= 3.0', '< 7.1'] spec.authors = ['Brandon Keepers', 'Brian Ryckbost', 'Chris Gaffney', 'David Genord II', 'Erik Michaels-Ober', 'Matt Griffin', 'Steve Richert', 'Tobias Lütke'] spec.description = 'Delayed_job (or DJ) encapsulates the common pattern of asynchronously executing longer tasks in the background. It is a direct extraction from Shopify where the job table is responsible for a multitude of core tasks.' spec.email = ['brian@collectiveidea.com'] spec.files = %w[CHANGELOG.md CONTRIBUTING.md LICENSE.md README.md Rakefile delayed_job.gemspec] spec.files += Dir.glob('{contrib,lib,recipes,spec}/**/*') # rubocop:disable SpaceAroundOperators spec.homepage = 'http://github.com/collectiveidea/delayed_job' spec.licenses = ['MIT'] spec.name = 'delayed_job' spec.require_paths = ['lib'] spec.summary = 'Database-backed asynchronous priority queue system -- Extracted from Shopify' spec.test_files = Dir.glob('spec/**/*') spec.version = '4.1.9' spec.metadata = { 'changelog_uri' => 'https://github.com/collectiveidea/delayed_job/blob/master/CHANGELOG.md', 'bug_tracker_uri' => 'https://github.com/collectiveidea/delayed_job/issues', 'source_code_uri' => 'https://github.com/collectiveidea/delayed_job' } end ``` --- TEMPLATE END ---------------------------------------------------------------- Unfortunately, an unexpected error occurred, and Bundler cannot continue. First, try this link to see if there are any existing issue reports for this error: https://github.com/rubygems/rubygems/search?q=undefined+method+%60metadata%27+for+nil+NilClass&type=Issues If there aren't any reports for this error yet, please fill in the new issue form located at https://github.com/rubygems/rubygems/issues/new?labels=Bundler&template=bundler-related-issue.md, and copy and paste the report template above in there. Took 13.62 seconds Error: The process '/opt/hostedtoolcache/Ruby/3.0.3/x64/bin/bundle' failed with exit code 1 ``` --- Gemfile | 7 ------- 1 file changed, 7 deletions(-) diff --git a/Gemfile b/Gemfile index 3884b7cb1..d0ab2521e 100644 --- a/Gemfile +++ b/Gemfile @@ -30,13 +30,6 @@ platforms :jruby do end gem 'jruby-openssl' gem 'mime-types', ['~> 2.6', '< 2.99'] - if ENV['RAILS_VERSION'] == 'edge' - gem 'railties', :github => 'rails/rails' - elsif ENV['RAILS_VERSION'] - gem 'railties', "~> #{ENV['RAILS_VERSION']}" - else - gem 'railties', ['>= 3.0', '< 7.1'] - end end platforms :rbx do From 8ac60f04bfa8188429629cf79b942f88eca5a3ba Mon Sep 17 00:00:00 2001 From: David Genord II Date: Mon, 17 Jan 2022 16:50:08 -0500 Subject: [PATCH 17/22] Bring back full matrix --- .github/workflows/ci.yml | 52 ++++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 12e65a525..3e451964d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,25 +12,39 @@ jobs: strategy: fail-fast: false matrix: - ruby: ['2.7', '3.0', '3.1', 'ruby-head'] + ruby: ['2.7', '3.0', '3.1', jruby-head, ruby-head] rails_version: - - '7.0.1' + - '6.0.0' + - '6.1.0' + - '7.0.0' - 'edge' include: - - ruby: '2.5' - rails_version: '6.1.0' - - ruby: '2.6' - rails_version: '6.1.0' - - ruby: '2.7' - rails_version: '6.1.0' - - ruby: '3.0' + # Rails 5.2 + - ruby: 2.6 + rails_version: '5.2.0' + - ruby: 2.7 + rails_version: '5.2.0' + - ruby: jruby-9.2 + rails_version: '5.2.0' + + # Ruby 2.6 + - ruby: 2.6 + rails_version: '6.0.0' + - ruby: 2.6 rails_version: '6.1.0' + + # jruby-9.2 + - ruby: jruby-9.2 + rails_version: '6.0.0' - ruby: jruby-9.2 rails_version: '6.1.0' + + # jruby-9.3 - ruby: jruby-9.3 - rails_version: '6.1.0' - - ruby: jruby-head - rails_version: '6.1.0' + rails_version: '7.0.0' + - ruby: jruby-9.3 + rails_version: 'edge' + # # The past # @@ -45,20 +59,6 @@ jobs: rails_version: '5.0.0' - ruby: 2.5 rails_version: '5.1.0' - - ruby: 2.5 - rails_version: '5.2.0' - - ruby: 2.5 - rails_version: '6.0.0' - - ruby: 2.6 - rails_version: '6.0.0' - - ruby: 2.7 - rails_version: '6.0.0' - - ruby: jruby-9.2 - rails_version: '6.0.0' - - ruby: jruby-9.3 - rails_version: '6.0.0' - - ruby: jruby-head - rails_version: '6.0.0' continue-on-error: ${{ matrix.rails_version == 'edge' || endsWith(matrix.ruby, 'head') }} From bc2c588c4d02a414561cc2d51c828bbe8be40c8b Mon Sep 17 00:00:00 2001 From: David Genord II Date: Mon, 17 Jan 2022 16:52:27 -0500 Subject: [PATCH 18/22] Revert "Add railties to use zeitwerk" This reverts commit 069b642b01d904ff136ef46fbf9eb3d319932a47. Delayed Job does not require Rails so the specs should not require it. # Conflicts: # Gemfile # spec/helper.rb --- Gemfile | 11 ++++++++--- spec/delayed/command_spec.rb | 18 ++++++++---------- spec/helper.rb | 13 ++++++++----- 3 files changed, 24 insertions(+), 18 deletions(-) diff --git a/Gemfile b/Gemfile index d0ab2521e..8b3d6134d 100644 --- a/Gemfile +++ b/Gemfile @@ -30,6 +30,14 @@ platforms :jruby do end gem 'jruby-openssl' gem 'mime-types', ['~> 2.6', '< 2.99'] + + if ENV['RAILS_VERSION'] == 'edge' + gem 'railties', :github => 'rails/rails' + elsif ENV['RAILS_VERSION'] + gem 'railties', "~> #{ENV['RAILS_VERSION']}" + else + gem 'railties', ['>= 3.0', '< 7.1'] + end end platforms :rbx do @@ -40,15 +48,12 @@ group :test do if ENV['RAILS_VERSION'] == 'edge' gem 'actionmailer', :github => 'rails/rails' gem 'activerecord', :github => 'rails/rails' - gem 'railties', :github => 'rails/rails' elsif ENV['RAILS_VERSION'] gem 'actionmailer', "~> #{ENV['RAILS_VERSION']}" gem 'activerecord', "~> #{ENV['RAILS_VERSION']}" - gem 'railties', "~> #{ENV['RAILS_VERSION']}" else gem 'actionmailer', ['>= 3.0', '< 7.1'] gem 'activerecord', ['>= 3.0', '< 7.1'] - gem 'railties', ['>= 3.0', '< 7.1'] end gem 'net-smtp' if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3.1.0') gem 'rspec', '>= 3' diff --git a/spec/delayed/command_spec.rb b/spec/delayed/command_spec.rb index 9ac6e0862..b57cd6efa 100644 --- a/spec/delayed/command_spec.rb +++ b/spec/delayed/command_spec.rb @@ -159,18 +159,16 @@ describe 'running worker pools defined by multiple --pool arguments' do it 'should run the correct worker processes' do command = Delayed::Command.new(['--pool=*:1', '--pool=test_queue:4', '--pool=mailers,misc:2']) - pid_dir = File.expand_path('./tmp/pids') - log_dir = File.expand_path('./log') - expect(FileUtils).to receive(:mkdir_p).with(pid_dir).once + expect(FileUtils).to receive(:mkdir_p).with('./tmp/pids').once [ - ['delayed_job.0', {:quiet => true, :pid_dir => pid_dir, :log_dir => log_dir, :queues => []}], - ['delayed_job.1', {:quiet => true, :pid_dir => pid_dir, :log_dir => log_dir, :queues => ['test_queue']}], - ['delayed_job.2', {:quiet => true, :pid_dir => pid_dir, :log_dir => log_dir, :queues => ['test_queue']}], - ['delayed_job.3', {:quiet => true, :pid_dir => pid_dir, :log_dir => log_dir, :queues => ['test_queue']}], - ['delayed_job.4', {:quiet => true, :pid_dir => pid_dir, :log_dir => log_dir, :queues => ['test_queue']}], - ['delayed_job.5', {:quiet => true, :pid_dir => pid_dir, :log_dir => log_dir, :queues => %w[mailers misc]}], - ['delayed_job.6', {:quiet => true, :pid_dir => pid_dir, :log_dir => log_dir, :queues => %w[mailers misc]}] + ['delayed_job.0', {:quiet => true, :pid_dir => './tmp/pids', :log_dir => './log', :queues => []}], + ['delayed_job.1', {:quiet => true, :pid_dir => './tmp/pids', :log_dir => './log', :queues => ['test_queue']}], + ['delayed_job.2', {:quiet => true, :pid_dir => './tmp/pids', :log_dir => './log', :queues => ['test_queue']}], + ['delayed_job.3', {:quiet => true, :pid_dir => './tmp/pids', :log_dir => './log', :queues => ['test_queue']}], + ['delayed_job.4', {:quiet => true, :pid_dir => './tmp/pids', :log_dir => './log', :queues => ['test_queue']}], + ['delayed_job.5', {:quiet => true, :pid_dir => './tmp/pids', :log_dir => './log', :queues => %w[mailers misc]}], + ['delayed_job.6', {:quiet => true, :pid_dir => './tmp/pids', :log_dir => './log', :queues => %w[mailers misc]}] ].each do |args| expect(command).to receive(:run_process).with(*args).once end diff --git a/spec/helper.rb b/spec/helper.rb index f93219e48..e3d528d1a 100644 --- a/spec/helper.rb +++ b/spec/helper.rb @@ -21,7 +21,6 @@ require 'action_mailer' require 'active_record' -require 'rails' require 'delayed_job' require 'delayed/backend/shared_spec' @@ -37,8 +36,14 @@ end ENV['RAILS_ENV'] = 'test' -FakeApp = Class.new(Rails::Application) -FakeApp.config.eager_load = false +# Trigger AR to initialize +ActiveRecord::Base # rubocop:disable Void + +module Rails + def self.root + '.' + end +end Delayed::Worker.backend = :test @@ -71,8 +76,6 @@ def whatever(n, _) handle_asynchronously :whatever end -FakeApp.initialize! - RSpec.configure do |config| config.after(:each) do Delayed::Worker.reset From 87ab1a68d889c91c0a7e0ec7fa236bb9d8da383a Mon Sep 17 00:00:00 2001 From: David Genord II Date: Mon, 17 Jan 2022 16:56:04 -0500 Subject: [PATCH 19/22] Fix remnant comment change --- lib/delayed/syck_ext.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/delayed/syck_ext.rb b/lib/delayed/syck_ext.rb index df04842d6..c7cb8154a 100644 --- a/lib/delayed/syck_ext.rb +++ b/lib/delayed/syck_ext.rb @@ -36,7 +36,7 @@ def self.yaml_tag_read_class(name) module YAML def load_dj(yaml) # See https://github.com/dtao/safe_yaml - # When the module is there, we need to load our YAML like this... + # When the method is there, we need to load our YAML like this... respond_to?(:unsafe_load) ? load(yaml, :safe => false) : load(yaml) end end From 8b6fd4b55d021acf263bbafeefb3ee8f44017f51 Mon Sep 17 00:00:00 2001 From: David Genord II Date: Mon, 17 Jan 2022 17:01:07 -0500 Subject: [PATCH 20/22] Expand allowed version to less than 8.0 Rails should not break anything in 7.x releases. --- Gemfile | 6 +++--- delayed_job.gemspec | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Gemfile b/Gemfile index 8b3d6134d..ddd092964 100644 --- a/Gemfile +++ b/Gemfile @@ -36,7 +36,7 @@ platforms :jruby do elsif ENV['RAILS_VERSION'] gem 'railties', "~> #{ENV['RAILS_VERSION']}" else - gem 'railties', ['>= 3.0', '< 7.1'] + gem 'railties', ['>= 3.0', '< 8.0'] end end @@ -52,8 +52,8 @@ group :test do gem 'actionmailer', "~> #{ENV['RAILS_VERSION']}" gem 'activerecord', "~> #{ENV['RAILS_VERSION']}" else - gem 'actionmailer', ['>= 3.0', '< 7.1'] - gem 'activerecord', ['>= 3.0', '< 7.1'] + gem 'actionmailer', ['>= 3.0', '< 8.0'] + gem 'activerecord', ['>= 3.0', '< 8.0'] end gem 'net-smtp' if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3.1.0') gem 'rspec', '>= 3' diff --git a/delayed_job.gemspec b/delayed_job.gemspec index 23eec33e6..a61fe4717 100644 --- a/delayed_job.gemspec +++ b/delayed_job.gemspec @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- Gem::Specification.new do |spec| - spec.add_dependency 'activesupport', ['>= 3.0', '< 7.1'] + spec.add_dependency 'activesupport', ['>= 3.0', '< 8.0'] spec.authors = ['Brandon Keepers', 'Brian Ryckbost', 'Chris Gaffney', 'David Genord II', 'Erik Michaels-Ober', 'Matt Griffin', 'Steve Richert', 'Tobias Lütke'] spec.description = 'Delayed_job (or DJ) encapsulates the common pattern of asynchronously executing longer tasks in the background. It is a direct extraction from Shopify where the job table is responsible for a multitude of core tasks.' spec.email = ['brian@collectiveidea.com'] From c62b69ed19a50ee16bac0f041c7db776b5cc513f Mon Sep 17 00:00:00 2001 From: David Genord II Date: Mon, 17 Jan 2022 18:17:01 -0500 Subject: [PATCH 21/22] Setup zeitwerk ActiveSupport 7 drops classic dependency autoloading. This does a basic zeitwerk setup to test the newer Rails autoloading system --- Gemfile | 3 +++ spec/helper.rb | 17 +++++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index ddd092964..c66ff6e7e 100644 --- a/Gemfile +++ b/Gemfile @@ -64,6 +64,9 @@ group :test do else gem 'simplecov-lcov', :require => false end + if ENV['RAILS_VERSION'].nil? || ENV['RAILS_VERSION'] >= '6.0.0' + gem 'zeitwerk', :require => false + end end group :rubocop do diff --git a/spec/helper.rb b/spec/helper.rb index e3d528d1a..0ba9657e6 100644 --- a/spec/helper.rb +++ b/spec/helper.rb @@ -47,8 +47,21 @@ def self.root Delayed::Worker.backend = :test -# Add this directory so the ActiveSupport autoloading works -ActiveSupport::Dependencies.autoload_paths << File.dirname(__FILE__) +if ActiveSupport::VERSION::MAJOR < 7 + require 'active_support/dependencies' + + # Add this directory so the ActiveSupport autoloading works + ActiveSupport::Dependencies.autoload_paths << File.dirname(__FILE__) +else + # Rails 7 dropped classic dependency auto-loading. This does a basic + # zeitwerk setup to test against zeitwerk directly as the Rails zeitwerk + # setup is intertwined in the application boot process. + require 'zeitwerk' + + loader = Zeitwerk::Loader.new + loader.push_dir File.dirname(__FILE__) + loader.setup +end # Used to test interactions between DJ and an ORM ActiveRecord::Base.establish_connection :adapter => 'sqlite3', :database => ':memory:' From 11e0212fb112c5e11e4555ef1e24510819a66347 Mon Sep 17 00:00:00 2001 From: David Genord II Date: Mon, 17 Jan 2022 19:36:42 -0500 Subject: [PATCH 22/22] Prepare 4.1.9 release --- CHANGELOG.md | 4 ++++ README.md | 2 +- delayed_job.gemspec | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 51e2dcf0e..9d8f3c37d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +4.1.10 - 2022-01-17 +=================== +* Support for Rails 7.0. NOTE: If you are using Delayed Job independent of Rails, Active Support 7 has dropped classic dependency autoloading. You will need to add and setup zeitwerk for autoloading to continue working in ActiveSupport 7. + 4.1.9 - 2020-12-09 ================== * Support for Rails 6.1 diff --git a/README.md b/README.md index 29ad10782..c72ed2f6f 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ **If you're viewing this at https://github.com/collectiveidea/delayed_job, you're reading the documentation for the master branch. [View documentation for the latest release -(4.1.9).](https://github.com/collectiveidea/delayed_job/tree/v4.1.9)** +(4.1.10).](https://github.com/collectiveidea/delayed_job/tree/v4.1.10)** Delayed::Job ============ diff --git a/delayed_job.gemspec b/delayed_job.gemspec index a61fe4717..ee290405e 100644 --- a/delayed_job.gemspec +++ b/delayed_job.gemspec @@ -13,7 +13,7 @@ Gem::Specification.new do |spec| spec.require_paths = ['lib'] spec.summary = 'Database-backed asynchronous priority queue system -- Extracted from Shopify' spec.test_files = Dir.glob('spec/**/*') - spec.version = '4.1.9' + spec.version = '4.1.10' spec.metadata = { 'changelog_uri' => 'https://github.com/collectiveidea/delayed_job/blob/master/CHANGELOG.md', 'bug_tracker_uri' => 'https://github.com/collectiveidea/delayed_job/issues',