From b987d52f292a90fa7d3a4186c96b818bb97be533 Mon Sep 17 00:00:00 2001 From: Andrew White Date: Mon, 9 Apr 2018 22:28:10 +0100 Subject: [PATCH 01/66] Allow Rails 5.2 to be used Also bump the Ruby versions tested against. --- .travis.yml | 23 +++++++++++++---------- Gemfile | 6 +++--- delayed_job.gemspec | 2 +- 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/.travis.yml b/.travis.yml index c0ddcc183..9d9ae2086 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,12 +9,13 @@ env: - RAILS_VERSION="~> 4.2.0" - RAILS_VERSION="~> 5.0.0" - RAILS_VERSION="~> 5.1.0" + - RAILS_VERSION="~> 5.2.0" - RAILS_VERSION="edge" rvm: - - 2.2.9 - - 2.3.6 - - 2.4.3 - - 2.5.0 + - 2.2.10 + - 2.3.7 + - 2.4.4 + - 2.5.1 - jruby-9.1.15.0 - jruby-head - ruby-head @@ -28,24 +29,26 @@ matrix: - env: RAILS_VERSION="edge" - rvm: jruby-9.1.15.0 env: RAILS_VERSION="~> 5.1.0" + - rvm: jruby-9.1.15.0 + env: RAILS_VERSION="~> 5.2.0" fast_finish: true # legacy testing # things still run and we don't have a good reason to break it # but we don't need to keep running the full matrix include: - - rvm: 2.3.6 + - rvm: 2.3.7 env: RAILS_VERSION="~> 3.0.0" - - rvm: 2.3.6 + - rvm: 2.3.7 env: RAILS_VERSION="~> 3.1.0" - - rvm: 2.3.6 + - rvm: 2.3.7 env: RAILS_VERSION="~> 3.2.0" - - rvm: 2.3.6 + - rvm: 2.3.7 env: RAILS_VERSION="~> 4.0.0" - - rvm: 2.3.6 + - rvm: 2.3.7 env: RAILS_VERSION="~> 4.1.0" - rvm: 2.1.10 env: RAILS_VERSION="~> 4.2.0" exclude: - - rvm: 2.2.9 + - rvm: 2.2.10 env: RAILS_VERSION="edge" sudo: false diff --git a/Gemfile b/Gemfile index ab189562d..e995fac2d 100644 --- a/Gemfile +++ b/Gemfile @@ -17,7 +17,7 @@ platforms :jruby do if ENV['RAILS_VERSION'] == 'edge' gem 'railties', :github => 'rails/rails' else - gem 'railties', (ENV['RAILS_VERSION'] || ['>= 3.0', '< 5.2']) + gem 'railties', (ENV['RAILS_VERSION'] || ['>= 3.0', '< 6.0']) end end @@ -30,8 +30,8 @@ group :test do gem 'actionmailer', :github => 'rails/rails' gem 'activerecord', :github => 'rails/rails' else - gem 'actionmailer', (ENV['RAILS_VERSION'] || ['>= 3.0', '< 5.2']) - gem 'activerecord', (ENV['RAILS_VERSION'] || ['>= 3.0', '< 5.2']) + gem 'actionmailer', (ENV['RAILS_VERSION'] || ['>= 3.0', '< 6.0']) + gem 'activerecord', (ENV['RAILS_VERSION'] || ['>= 3.0', '< 6.0']) end gem 'coveralls', :require => false diff --git a/delayed_job.gemspec b/delayed_job.gemspec index c132b35ee..2cfa783d4 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', '< 5.2'] + spec.add_dependency 'activesupport', ['>= 3.0', '< 6.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 84b000480899b2a61c48f1b9531c106e8800284d Mon Sep 17 00:00:00 2001 From: David Genord II Date: Fri, 13 Apr 2018 10:03:34 -0400 Subject: [PATCH 02/66] We don't know for sure the next version will be 6 While I believe 6 is the next planned release, plans can change. --- Gemfile | 6 +++--- delayed_job.gemspec | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Gemfile b/Gemfile index e995fac2d..614958389 100644 --- a/Gemfile +++ b/Gemfile @@ -17,7 +17,7 @@ platforms :jruby do if ENV['RAILS_VERSION'] == 'edge' gem 'railties', :github => 'rails/rails' else - gem 'railties', (ENV['RAILS_VERSION'] || ['>= 3.0', '< 6.0']) + gem 'railties', (ENV['RAILS_VERSION'] || ['>= 3.0', '< 5.3']) end end @@ -30,8 +30,8 @@ group :test do gem 'actionmailer', :github => 'rails/rails' gem 'activerecord', :github => 'rails/rails' else - gem 'actionmailer', (ENV['RAILS_VERSION'] || ['>= 3.0', '< 6.0']) - gem 'activerecord', (ENV['RAILS_VERSION'] || ['>= 3.0', '< 6.0']) + gem 'actionmailer', (ENV['RAILS_VERSION'] || ['>= 3.0', '< 5.3']) + gem 'activerecord', (ENV['RAILS_VERSION'] || ['>= 3.0', '< 5.3']) end gem 'coveralls', :require => false diff --git a/delayed_job.gemspec b/delayed_job.gemspec index 2cfa783d4..5ba300b88 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.0'] + spec.add_dependency 'activesupport', ['>= 3.0', '< 5.3'] 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 bce6fe3b369dcf75775c1c0d94d8786da528e484 Mon Sep 17 00:00:00 2001 From: David Genord II Date: Fri, 13 Apr 2018 10:12:30 -0400 Subject: [PATCH 03/66] Rails 5.0 is now unsupported by rails Limit the rails 5.0 build matrix as 5.0 is no longer supported by the rails community. As with the other versions we don't have a good reason to break support but we don't need to tax travis building every combination. --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 9d9ae2086..da3109de4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,6 @@ env: - JRUBY_OPTS="$JRUBY_OPTS --debug" matrix: - RAILS_VERSION="~> 4.2.0" - - RAILS_VERSION="~> 5.0.0" - RAILS_VERSION="~> 5.1.0" - RAILS_VERSION="~> 5.2.0" - RAILS_VERSION="edge" @@ -48,6 +47,8 @@ matrix: env: RAILS_VERSION="~> 4.1.0" - rvm: 2.1.10 env: RAILS_VERSION="~> 4.2.0" + - rvm: 2.4.4 + env: RAILS_VERSION="~> 5.0.0" exclude: - rvm: 2.2.10 env: RAILS_VERSION="edge" From f31546a369564c8ca12e89c4adbada8b966a28ec Mon Sep 17 00:00:00 2001 From: David Genord II Date: Fri, 13 Apr 2018 10:19:22 -0400 Subject: [PATCH 04/66] Prepare 4.1.5 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 97614530f..f8e80c679 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +4.1.5 - 2018-04-13 +================= +* Allow Rails 5.2 + 4.1.4 - 2017-12-29 ================= * Use `yaml_tag` instead of deprecated `yaml_as` (#996) diff --git a/README.md b/README.md index 893cb8f7a..9e11b06d2 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.4).](https://github.com/collectiveidea/delayed_job/tree/v4.1.4)** +(4.1.5).](https://github.com/collectiveidea/delayed_job/tree/v4.1.5)** Delayed::Job ============ diff --git a/delayed_job.gemspec b/delayed_job.gemspec index 5ba300b88..76adbfe0f 100644 --- a/delayed_job.gemspec +++ b/delayed_job.gemspec @@ -13,5 +13,5 @@ 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.4' + spec.version = '4.1.5' end From f1ec6cb502c17c4a7a270881a0fd05ea38f957ff Mon Sep 17 00:00:00 2001 From: David Genord II Date: Fri, 8 Jun 2018 11:29:30 -0400 Subject: [PATCH 05/66] Remove the Gemnasium badge This is a service we no longer use. --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index 9e11b06d2..0d764ab4d 100644 --- a/README.md +++ b/README.md @@ -7,13 +7,11 @@ Delayed::Job ============ [![Gem Version](https://badge.fury.io/rb/delayed_job.png)][gem] [![Build Status](https://travis-ci.org/collectiveidea/delayed_job.png?branch=master)][travis] -[![Dependency Status](https://gemnasium.com/collectiveidea/delayed_job.png?travis)][gemnasium] [![Code Climate](https://codeclimate.com/github/collectiveidea/delayed_job.png)][codeclimate] [![Coverage Status](https://coveralls.io/repos/collectiveidea/delayed_job/badge.png?branch=master)][coveralls] [gem]: https://rubygems.org/gems/delayed_job [travis]: https://travis-ci.org/collectiveidea/delayed_job -[gemnasium]: https://gemnasium.com/collectiveidea/delayed_job [codeclimate]: https://codeclimate.com/github/collectiveidea/delayed_job [coveralls]: https://coveralls.io/r/collectiveidea/delayed_job From 62acbd5ce57fa01eeda8d4b04cb687d92e3da75e Mon Sep 17 00:00:00 2001 From: Dan Jensen Date: Sun, 23 Sep 2018 10:01:51 -0400 Subject: [PATCH 06/66] Replace REMOVED with FAILED in log message The term REMOVED was misleading when destroy_failed_jobs = false. The term FAILED is not misleading, and is also used elsewhere in similar contexts, so is more conventional. --- lib/delayed/worker.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/delayed/worker.rb b/lib/delayed/worker.rb index ea778be4f..1a352f775 100644 --- a/lib/delayed/worker.rb +++ b/lib/delayed/worker.rb @@ -251,7 +251,7 @@ def reschedule(job, time = nil) job.unlock job.save! else - job_say job, "REMOVED permanently because of #{job.attempts} consecutive failures", 'error' + job_say job, "FAILED permanently because of #{job.attempts} consecutive failures", 'error' failed(job) end end From 5b59e9c108111ea09dc74d62c56f337886ac36a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ton=C4=8Di=20Damjani=C4=87?= Date: Wed, 10 Oct 2018 12:47:05 +0200 Subject: [PATCH 07/66] Mention Active Job instead of Rails 4.2 It seems to be a preferred by the Rails team. --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 0d764ab4d..3866cf0df 100644 --- a/README.md +++ b/README.md @@ -67,9 +67,9 @@ Development In development mode, if you are using Rails 3.1+, your application code will automatically reload every 100 jobs or when the queue finishes. You no longer need to restart Delayed Job every time you update your code in development. -Rails 4.2 -========= -Set the queue_adapter in config/application.rb +Active Job +========== +In Rails 4.2+, set the queue_adapter in config/application.rb ```ruby config.active_job.queue_adapter = :delayed_job From c2df3a30ff7a0e4ced7304abecc6e64f537a0dae Mon Sep 17 00:00:00 2001 From: Luciano Sousa Date: Wed, 28 Nov 2018 13:13:49 -0500 Subject: [PATCH 08/66] update doc fix broken link --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3866cf0df..f30e8b255 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,7 @@ running the following command: rails generate delayed_job:active_record rake db:migrate -For Rails 4.2, see [below](#rails-42) +For Rails 4.2+, see [below](#active-job) Development =========== From 2bb4164b03ca74f4b9ef1d04a8ecf86980543363 Mon Sep 17 00:00:00 2001 From: C Rahul <3462960+bitsapien@users.noreply.github.com> Date: Mon, 3 Dec 2018 14:18:46 +0530 Subject: [PATCH 09/66] Grammar correction --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3866cf0df..d56e60db2 100644 --- a/README.md +++ b/README.md @@ -428,7 +428,7 @@ end On error, the job is scheduled again in 5 seconds + N ** 4, where N is the number of attempts or using the job's defined `reschedule_at` method. -The default `Worker.max_attempts` is 25. After this, the job either deleted (default), or left in the database with "failed_at" set. +The default `Worker.max_attempts` is 25. After this, the job is either deleted (default), or left in the database with "failed_at" set. With the default of 25 attempts, the last retry will be 20 days later, with the last interval being almost 100 hours. The default `Worker.max_run_time` is 4.hours. If your job takes longer than that, another computer could pick it up. It's up to you to From f59261d40dee17151a06c5c7d9e4a469aeef85a8 Mon Sep 17 00:00:00 2001 From: Olivier Lacan Date: Mon, 11 Feb 2019 14:42:02 -0500 Subject: [PATCH 10/66] Use modern SVG alternatives of PNG badges These are soon to be deprecated and render very poorly on most high density displays. Here's a visual diff from a 2015 Retina MacBook Pro: http://link.olivierlacan.com/e15d4429a85f --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 3866cf0df..a3c1724c6 100644 --- a/README.md +++ b/README.md @@ -5,10 +5,10 @@ you're reading the documentation for the master branch. Delayed::Job ============ -[![Gem Version](https://badge.fury.io/rb/delayed_job.png)][gem] -[![Build Status](https://travis-ci.org/collectiveidea/delayed_job.png?branch=master)][travis] -[![Code Climate](https://codeclimate.com/github/collectiveidea/delayed_job.png)][codeclimate] -[![Coverage Status](https://coveralls.io/repos/collectiveidea/delayed_job/badge.png?branch=master)][coveralls] +[![Gem Version](https://badge.fury.io/rb/delayed_job.svg)][gem] +[![Build Status](https://travis-ci.org/collectiveidea/delayed_job.svg?branch=master)][travis] +[![Code Climate](https://codeclimate.com/github/collectiveidea/delayed_job.svg)][codeclimate] +[![Coverage Status](https://coveralls.io/repos/collectiveidea/delayed_job/badge.svg?branch=master)][coveralls] [gem]: https://rubygems.org/gems/delayed_job [travis]: https://travis-ci.org/collectiveidea/delayed_job From 43624b39c1bc6358a9553d9d325cc09a25268c56 Mon Sep 17 00:00:00 2001 From: David Genord II Date: Mon, 18 Feb 2019 10:18:05 -0500 Subject: [PATCH 11/66] Update matrix for ruby and rails updates --- .travis.yml | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/.travis.yml b/.travis.yml index da3109de4..b96a40406 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,15 +11,13 @@ env: - RAILS_VERSION="~> 5.2.0" - RAILS_VERSION="edge" rvm: - - 2.2.10 - - 2.3.7 - - 2.4.4 - - 2.5.1 + - 2.3.8 + - 2.4.5 + - 2.5.3 + - 2.6.1 - jruby-9.1.15.0 - jruby-head - ruby-head -before_install: - - "gem install bundler" jdk: oraclejdk8 matrix: allow_failures: @@ -35,21 +33,25 @@ matrix: # things still run and we don't have a good reason to break it # but we don't need to keep running the full matrix include: - - rvm: 2.3.7 + - rvm: 2.3.8 env: RAILS_VERSION="~> 3.0.0" - - rvm: 2.3.7 + - rvm: 2.3.8 env: RAILS_VERSION="~> 3.1.0" - - rvm: 2.3.7 + - rvm: 2.3.8 env: RAILS_VERSION="~> 3.2.0" - - rvm: 2.3.7 + - rvm: 2.3.8 env: RAILS_VERSION="~> 4.0.0" - - rvm: 2.3.7 + - rvm: 2.3.8 env: RAILS_VERSION="~> 4.1.0" - rvm: 2.1.10 env: RAILS_VERSION="~> 4.2.0" + - rvm: 2.2.10 + env: RAILS_VERSION="~> 4.2.0" - rvm: 2.4.4 env: RAILS_VERSION="~> 5.0.0" exclude: - - rvm: 2.2.10 + - rvm: 2.3.8 + env: RAILS_VERSION="edge" + - rvm: 2.4.5 env: RAILS_VERSION="edge" sudo: false From e0c141bae679af111f2f2cf34fcb0d13f70bb64b Mon Sep 17 00:00:00 2001 From: David Genord II Date: Mon, 18 Feb 2019 10:29:34 -0500 Subject: [PATCH 12/66] Rails does not work with sqlite 1.4 before 5.1 However, the relaxed activerecord requirement is not yet in released versions of the gems --- Gemfile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 614958389..8b80601ac 100644 --- a/Gemfile +++ b/Gemfile @@ -3,7 +3,13 @@ source 'https://rubygems.org' gem 'rake' platforms :ruby do - gem 'sqlite3' + # Rails 5.1 is the first to work with sqlite 1.4 + # TODO: When new versions of 5.1 and 5.2 are cut, sqlite 1.4 will work + # if ENV['RAILS_VERSION'].split.last < '5.1' + gem 'sqlite3', '< 1.4' + # else + # gem 'sqlite3' + # end end platforms :jruby do From 43b3591af812a6ae0d244a56ded081ddad3245e5 Mon Sep 17 00:00:00 2001 From: David Genord II Date: Mon, 18 Feb 2019 12:08:05 -0500 Subject: [PATCH 13/66] Properly initialize ActionMailer outside railties The divided load was triggering errors when encountering an unexpected load order. This allows the dependencies to properly load in any configuration. --- lib/delayed/railtie.rb | 4 ---- lib/delayed_job.rb | 11 +++++------ spec/helper.rb | 4 ---- spec/performable_mailer_spec.rb | 1 - 4 files changed, 5 insertions(+), 15 deletions(-) diff --git a/lib/delayed/railtie.rb b/lib/delayed/railtie.rb index 0249ea0f9..a50ca1b4b 100644 --- a/lib/delayed/railtie.rb +++ b/lib/delayed/railtie.rb @@ -4,10 +4,6 @@ module Delayed class Railtie < Rails::Railtie initializer :after_initialize do - ActiveSupport.on_load(:action_mailer) do - ActionMailer::Base.extend(Delayed::DelayMail) - end - Delayed::Worker.logger ||= if defined?(Rails) Rails.logger elsif defined?(RAILS_DEFAULT_LOGGER) diff --git a/lib/delayed_job.rb b/lib/delayed_job.rb index 439dd8587..dde4e41b7 100644 --- a/lib/delayed_job.rb +++ b/lib/delayed_job.rb @@ -3,12 +3,6 @@ require 'delayed/exceptions' require 'delayed/message_sending' require 'delayed/performable_method' - -if defined?(ActionMailer) - require 'action_mailer/version' - require 'delayed/performable_mailer' -end - require 'delayed/yaml_ext' require 'delayed/lifecycle' require 'delayed/plugin' @@ -19,5 +13,10 @@ require 'delayed/deserialization_error' require 'delayed/railtie' if defined?(Rails::Railtie) +ActiveSupport.on_load(:action_mailer) do + require 'delayed/performable_mailer' + ActionMailer::Base.extend(Delayed::DelayMail) +end + Object.send(:include, Delayed::MessageSending) Module.send(:include, Delayed::MessageSendingClassMethods) diff --git a/spec/helper.rb b/spec/helper.rb index d33ea7f5d..d07b28607 100644 --- a/spec/helper.rb +++ b/spec/helper.rb @@ -14,7 +14,6 @@ require 'rspec' require 'action_mailer' -require 'active_support/dependencies' require 'active_record' require 'delayed_job' @@ -45,9 +44,6 @@ def self.root # Add this directory so the ActiveSupport autoloading works ActiveSupport::Dependencies.autoload_paths << File.dirname(__FILE__) -# Add this to simulate Railtie initializer being executed -ActionMailer::Base.extend(Delayed::DelayMail) - # Used to test interactions between DJ and an ORM ActiveRecord::Base.establish_connection :adapter => 'sqlite3', :database => ':memory:' ActiveRecord::Base.logger = Delayed::Worker.logger diff --git a/spec/performable_mailer_spec.rb b/spec/performable_mailer_spec.rb index 72e5e2068..520d96596 100644 --- a/spec/performable_mailer_spec.rb +++ b/spec/performable_mailer_spec.rb @@ -1,6 +1,5 @@ require 'helper' -require 'action_mailer' class MyMailer < ActionMailer::Base def signup(email) mail :to => email, :subject => 'Delaying Emails', :from => 'delayedjob@example.com', :body => 'Delaying Emails Body' From 460018e338e6552fdb756eab5ac2bd8958652073 Mon Sep 17 00:00:00 2001 From: David Genord II Date: Mon, 18 Feb 2019 16:54:54 -0500 Subject: [PATCH 14/66] Add a note about ActiveJob callbacks --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index c47d83df9..4224fa1a4 100644 --- a/README.md +++ b/README.md @@ -375,6 +375,9 @@ Hooks ===== You can define hooks on your job that will be called at different stages in the process: + +**NOTE:** If you are using ActiveJob these hooks are **not** available to your jobs. You will need to use ActiveJob's callbacks. You can find details here https://guides.rubyonrails.org/active_job_basics.html#callbacks + ```ruby class ParanoidNewsletterJob < NewsletterJob def enqueue(job) From 393b2683404d6797a14da9c55d50978845cf70be Mon Sep 17 00:00:00 2001 From: David Genord II Date: Wed, 19 Jun 2019 12:03:32 -0400 Subject: [PATCH 15/66] Bump jruby and the jdk on travis --- .travis.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index b96a40406..8f05c1087 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,18 +15,18 @@ rvm: - 2.4.5 - 2.5.3 - 2.6.1 - - jruby-9.1.15.0 + - jruby-9.2.7.0 - jruby-head - ruby-head -jdk: oraclejdk8 +jdk: oraclejdk11 matrix: allow_failures: - rvm: jruby-head - rvm: ruby-head - env: RAILS_VERSION="edge" - - rvm: jruby-9.1.15.0 + - rvm: jruby-9.2.7.0 env: RAILS_VERSION="~> 5.1.0" - - rvm: jruby-9.1.15.0 + - rvm: jruby-9.2.7.0 env: RAILS_VERSION="~> 5.2.0" fast_finish: true # legacy testing From 7f993da278c875812382d8322a0acfa69fddc172 Mon Sep 17 00:00:00 2001 From: David Genord II Date: Wed, 19 Jun 2019 13:39:11 -0400 Subject: [PATCH 16/66] Fix for change in Psych loading It is very rare to hit this, but Rails uses it to handle class renames so data can deserialize after upgrading rails. https://github.com/rails/rails/commit/c3675f50d2e59b7fc173d7b332860c4b1a24a726#diff-0543aa8566327ece879b8ce6f394d391R185 This update allows us to handle either version of the load_tags data. --- lib/delayed/psych_ext.rb | 8 +++++++- spec/psych_ext_spec.rb | 24 +++++++++++++++++++++++- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/lib/delayed/psych_ext.rb b/lib/delayed/psych_ext.rb index 8cd941907..00350a453 100644 --- a/lib/delayed/psych_ext.rb +++ b/lib/delayed/psych_ext.rb @@ -28,7 +28,13 @@ def self.create end def visit_Psych_Nodes_Mapping(object) # rubocop:disable CyclomaticComplexity, MethodName, PerceivedComplexity - return revive(Psych.load_tags[object.tag], object) if Psych.load_tags[object.tag] + klass = Psych.load_tags[object.tag] + if klass + # Implementation changed here https://github.com/ruby/psych/commit/2c644e184192975b261a81f486a04defa3172b3f + # load_tags used to have class values, now the values are strings + klass = resolve_class(klass) if klass.is_a?(String) + return revive(klass, object) + end case object.tag when %r{^!ruby/object} diff --git a/spec/psych_ext_spec.rb b/spec/psych_ext_spec.rb index 86cc7391c..82e67aef4 100644 --- a/spec/psych_ext_spec.rb +++ b/spec/psych_ext_spec.rb @@ -3,10 +3,32 @@ describe 'Psych::Visitors::ToRuby', :if => defined?(Psych::Visitors::ToRuby) do context BigDecimal do it 'deserializes correctly' do - deserialized = YAML.load("--- !ruby/object:BigDecimal 18:0.1337E2\n...\n") + deserialized = YAML.load_dj("--- !ruby/object:BigDecimal 18:0.1337E2\n...\n") expect(deserialized).to be_an_instance_of(BigDecimal) expect(deserialized).to eq(BigDecimal('13.37')) end end + + context 'load_tag handling' do + # This only broadly works in ruby 2.0 but will cleanly work through load_dj + # here because this class is so simple it only touches our extention + YAML.load_tags['!ruby/object:RenamedClass'] = SimpleJob + # This is how ruby 2.1 and newer works throughout the yaml handling + YAML.load_tags['!ruby/object:RenamedString'] = 'SimpleJob' + + it 'deserializes class tag' do + deserialized = YAML.load_dj("--- !ruby/object:RenamedClass\ncheck: 12\n") + + expect(deserialized).to be_an_instance_of(SimpleJob) + expect(deserialized.instance_variable_get(:@check)).to eq(12) + end + + it 'deserializes string tag' do + deserialized = YAML.load_dj("--- !ruby/object:RenamedString\ncheck: 12\n") + + expect(deserialized).to be_an_instance_of(SimpleJob) + expect(deserialized.instance_variable_get(:@check)).to eq(12) + end + end end From dff39e95414dd9569b338cf31e16629606c09ddd Mon Sep 17 00:00:00 2001 From: David Genord II Date: Wed, 19 Jun 2019 15:21:44 -0400 Subject: [PATCH 17/66] Prepare 4.1.6 release --- CHANGELOG.md | 7 +++++++ README.md | 2 +- delayed_job.gemspec | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f8e80c679..d08a306a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +4.1.6 - 2019-06-19 +================= +* Properly initialize ActionMailer outside railties (#1077) +* Fix Psych load_tags support (#1093) +* Replace REMOVED with FAILED in log message (#1048) +* Misc doc updates (#1052, #1074, #1064, #1063) + 4.1.5 - 2018-04-13 ================= * Allow Rails 5.2 diff --git a/README.md b/README.md index 4224fa1a4..5a9475baa 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.5).](https://github.com/collectiveidea/delayed_job/tree/v4.1.5)** +(4.1.6).](https://github.com/collectiveidea/delayed_job/tree/v4.1.6)** Delayed::Job ============ diff --git a/delayed_job.gemspec b/delayed_job.gemspec index 76adbfe0f..14523d1b0 100644 --- a/delayed_job.gemspec +++ b/delayed_job.gemspec @@ -13,5 +13,5 @@ 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.5' + spec.version = '4.1.6' end From bd74058985d87dd4b55e1306a62d1a06f54674d9 Mon Sep 17 00:00:00 2001 From: David Genord II Date: Thu, 20 Jun 2019 11:59:38 -0400 Subject: [PATCH 18/66] Fix Delayed::PerformableMailer loading With the update to better handle disabling ActionMailer there is an edge case where Delayed::PerformableMailer isn't always loaded when it is needed. --- lib/delayed_job.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/delayed_job.rb b/lib/delayed_job.rb index dde4e41b7..511bf7b88 100644 --- a/lib/delayed_job.rb +++ b/lib/delayed_job.rb @@ -18,5 +18,9 @@ ActionMailer::Base.extend(Delayed::DelayMail) end +module Delayed + autoload :PerformableMailer, 'delayed/performable_mailer' +end + Object.send(:include, Delayed::MessageSending) Module.send(:include, Delayed::MessageSendingClassMethods) From 31dfb981a3e94fc8f18b24cf624e36fc3ddcbf58 Mon Sep 17 00:00:00 2001 From: David Genord II Date: Thu, 20 Jun 2019 12:12:44 -0400 Subject: [PATCH 19/66] Prepare 4.1.7 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 d08a306a4..5613b77c5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +4.1.7 - 2019-06-20 +================= +* Fix loading Delayed::PerformableMailer when ActionMailer isn't loaded yet + 4.1.6 - 2019-06-19 ================= * Properly initialize ActionMailer outside railties (#1077) diff --git a/README.md b/README.md index 5a9475baa..ed0a2e738 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.6).](https://github.com/collectiveidea/delayed_job/tree/v4.1.6)** +(4.1.7).](https://github.com/collectiveidea/delayed_job/tree/v4.1.7)** Delayed::Job ============ diff --git a/delayed_job.gemspec b/delayed_job.gemspec index 14523d1b0..b4f1c051f 100644 --- a/delayed_job.gemspec +++ b/delayed_job.gemspec @@ -13,5 +13,5 @@ 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.6' + spec.version = '4.1.7' end From 94b4d0b5ed77bad80c1c924626e9d09e216f1a49 Mon Sep 17 00:00:00 2001 From: David Genord II Date: Mon, 18 Feb 2019 13:50:25 -0500 Subject: [PATCH 20/66] Allow Rails 6.0 --- delayed_job.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/delayed_job.gemspec b/delayed_job.gemspec index b4f1c051f..620dbd670 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', '< 5.3'] + spec.add_dependency 'activesupport', ['>= 3.0', '< 6.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 0052ece991803e4e4a82cfc6d5bdfe99ba46b764 Mon Sep 17 00:00:00 2001 From: David Genord II Date: Mon, 18 Feb 2019 13:51:41 -0500 Subject: [PATCH 21/66] Rails 6 has deprecated update_attributes --- lib/delayed/backend/base.rb | 3 ++- lib/delayed/backend/shared_spec.rb | 3 ++- spec/delayed/backend/test.rb | 5 ----- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/lib/delayed/backend/base.rb b/lib/delayed/backend/base.rb index 4f18fb39d..494c33b2d 100644 --- a/lib/delayed/backend/base.rb +++ b/lib/delayed/backend/base.rb @@ -133,7 +133,8 @@ def destroy_failed_jobs? end def fail! - update_attributes(:failed_at => self.class.db_time_now) + self.failed_at = self.class.db_time_now + save! end protected diff --git a/lib/delayed/backend/shared_spec.rb b/lib/delayed/backend/shared_spec.rb index 771e0cd9c..39f497670 100644 --- a/lib/delayed/backend/shared_spec.rb +++ b/lib/delayed/backend/shared_spec.rb @@ -523,7 +523,8 @@ def create_job(opts = {}) it 'reloads changed attributes' do story = Story.create(:text => 'hello') job = story.delay.tell - story.update_attributes :text => 'goodbye' + story.text = 'goodbye' + story.save! expect(job.reload.payload_object.object.text).to eq('goodbye') end diff --git a/spec/delayed/backend/test.rb b/spec/delayed/backend/test.rb index 28031171f..6835a7b49 100644 --- a/spec/delayed/backend/test.rb +++ b/spec/delayed/backend/test.rb @@ -87,11 +87,6 @@ def self.db_time_now Time.current end - def update_attributes(attrs = {}) - attrs.each { |k, v| send(:"#{k}=", v) } - save - end - def destroy self.class.all.delete(self) end From 032fad092c835f8f9aef50056d269cb06c286f8d Mon Sep 17 00:00:00 2001 From: David Genord II Date: Thu, 20 Jun 2019 13:48:47 -0400 Subject: [PATCH 22/66] Start using sqlite 1.4 in testing New rails versions are cut and rails 6 actually requires it --- Gemfile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Gemfile b/Gemfile index 8b80601ac..0c349d188 100644 --- a/Gemfile +++ b/Gemfile @@ -4,12 +4,12 @@ gem 'rake' platforms :ruby do # Rails 5.1 is the first to work with sqlite 1.4 - # TODO: When new versions of 5.1 and 5.2 are cut, sqlite 1.4 will work - # if ENV['RAILS_VERSION'].split.last < '5.1' - gem 'sqlite3', '< 1.4' - # else - # gem 'sqlite3' - # end + # Rails 6 now requires sqlite 1.4 + if ENV['RAILS_VERSION'] && ENV['RAILS_VERSION'].split.last < '5.1' + gem 'sqlite3', '< 1.4' + else + gem 'sqlite3' + end end platforms :jruby do From a2d3fbb58b925495a8a19dc3df6fb9aee5402da1 Mon Sep 17 00:00:00 2001 From: David Genord II Date: Fri, 16 Aug 2019 16:34:40 -0400 Subject: [PATCH 23/66] Add Rails 6.0.0 to the build matrix --- .travis.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.travis.yml b/.travis.yml index 8f05c1087..3ebb7baf2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,6 +9,7 @@ env: - RAILS_VERSION="~> 4.2.0" - RAILS_VERSION="~> 5.1.0" - RAILS_VERSION="~> 5.2.0" + - RAILS_VERSION="~> 6.0.0" - RAILS_VERSION="edge" rvm: - 2.3.8 @@ -50,6 +51,10 @@ matrix: - rvm: 2.4.4 env: RAILS_VERSION="~> 5.0.0" exclude: + - rvm: 2.3.8 + env: RAILS_VERSION="~> 6.0.0" + - rvm: 2.4.5 + env: RAILS_VERSION="~> 6.0.0" - rvm: 2.3.8 env: RAILS_VERSION="edge" - rvm: 2.4.5 From 5ac5adea8d18325d0470eeebfa81227b1f5961e3 Mon Sep 17 00:00:00 2001 From: David Genord II Date: Fri, 16 Aug 2019 17:02:03 -0400 Subject: [PATCH 24/66] Prepare 4.1.8 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 5613b77c5..48a472251 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +4.1.8 - 2019-08-16 +================= +* Support for Rails 6.0.0 + 4.1.7 - 2019-06-20 ================= * Fix loading Delayed::PerformableMailer when ActionMailer isn't loaded yet diff --git a/README.md b/README.md index ed0a2e738..3bf63336e 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.7).](https://github.com/collectiveidea/delayed_job/tree/v4.1.7)** +(4.1.8).](https://github.com/collectiveidea/delayed_job/tree/v4.1.8)** Delayed::Job ============ diff --git a/delayed_job.gemspec b/delayed_job.gemspec index 620dbd670..b45c7d1cf 100644 --- a/delayed_job.gemspec +++ b/delayed_job.gemspec @@ -13,5 +13,5 @@ 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.7' + spec.version = '4.1.8' end From 9db85f9148f9c4af39a1d2d5f63e1a7e902cd78d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stanis=C5=82aw=20Pitucha?= Date: Mon, 19 Aug 2019 08:01:47 +1000 Subject: [PATCH 25/66] Add metadata link Add links which are exposed on rubygems and help with update automation. --- delayed_job.gemspec | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/delayed_job.gemspec b/delayed_job.gemspec index b45c7d1cf..f7bcb979c 100644 --- a/delayed_job.gemspec +++ b/delayed_job.gemspec @@ -14,4 +14,9 @@ Gem::Specification.new do |spec| spec.summary = 'Database-backed asynchronous priority queue system -- Extracted from Shopify' spec.test_files = Dir.glob('spec/**/*') spec.version = '4.1.8' + 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 From a346ab87577d6f3436b029ee82c276c78ef96dc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stanis=C5=82aw=20Pitucha?= Date: Mon, 19 Aug 2019 11:38:37 +1000 Subject: [PATCH 26/66] Fix quoting for rubocop --- delayed_job.gemspec | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/delayed_job.gemspec b/delayed_job.gemspec index f7bcb979c..ab252b723 100644 --- a/delayed_job.gemspec +++ b/delayed_job.gemspec @@ -15,8 +15,8 @@ Gem::Specification.new do |spec| spec.test_files = Dir.glob('spec/**/*') spec.version = '4.1.8' 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" + '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 From 7660286379d7232c8bf38ea44560b058bf9df125 Mon Sep 17 00:00:00 2001 From: Johnny Shields Date: Tue, 22 Sep 2020 18:25:14 +0900 Subject: [PATCH 27/66] Make .delay method work with ActionMailer::Parameterized::Mailer This PR unifies the DelayedJob behavior of ActionMailer::Base and ActionMailer::Parameterized::Mailer Now, the following syntax works equivalently: ```ruby # works currently MyMailer.delay.my_method # this PR makes the following work MyMailer.with(foo: 1, bar: 2).delay.my_method ``` Note that ActionMailer::Parameterized::Mailer does not inherit ActionMailer::Base (moreover, the `.with()` method returns an object instance, hence we use `include` rather than `extend`) --- lib/delayed_job.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/delayed_job.rb b/lib/delayed_job.rb index 511bf7b88..5146ed215 100644 --- a/lib/delayed_job.rb +++ b/lib/delayed_job.rb @@ -16,6 +16,7 @@ ActiveSupport.on_load(:action_mailer) do require 'delayed/performable_mailer' ActionMailer::Base.extend(Delayed::DelayMail) + ActionMailer::Parameterized::Mailer.include(Delayed::DelayMail) end module Delayed From fc0e9e219225e40cd8f78bc4d79f859e62c26c8c Mon Sep 17 00:00:00 2001 From: shields Date: Tue, 22 Sep 2020 18:38:38 +0900 Subject: [PATCH 28/66] Add specs --- lib/delayed_job.rb | 2 +- spec/performable_mailer_spec.rb | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/lib/delayed_job.rb b/lib/delayed_job.rb index 5146ed215..d38f2edbc 100644 --- a/lib/delayed_job.rb +++ b/lib/delayed_job.rb @@ -16,7 +16,7 @@ ActiveSupport.on_load(:action_mailer) do require 'delayed/performable_mailer' ActionMailer::Base.extend(Delayed::DelayMail) - ActionMailer::Parameterized::Mailer.include(Delayed::DelayMail) + ActionMailer::Parameterized::Mailer.include(Delayed::DelayMail) if defined?(ActionMailer::Parameterized::Mailer) end module Delayed diff --git a/spec/performable_mailer_spec.rb b/spec/performable_mailer_spec.rb index 520d96596..0cc9a4b6e 100644 --- a/spec/performable_mailer_spec.rb +++ b/spec/performable_mailer_spec.rb @@ -40,3 +40,29 @@ def signup(email) end end end + +if defined?(ActionMailer::Parameterized::Mailer) + describe ActionMailer::Parameterized::Mailer do + describe 'delay' do + it 'enqueues a PerformableEmail job' do + expect do + job = MyMailer.with(foo: 1, bar: 2).delay.signup('john@example.com') + expect(job.payload_object.class).to eq(Delayed::PerformableMailer) + expect(job.payload_object.object.class).to eq(ActionMailer::Parameterized::Mailer) + expect(job.payload_object.object.instance_variable_get('@mailer')).to eq(MyMailer) + expect(job.payload_object.object.instance_variable_get('@params')).to eq(foo: 1, bar: 2) + expect(job.payload_object.method_name).to eq(:signup) + expect(job.payload_object.args).to eq(['john@example.com']) + end.to change { Delayed::Job.count }.by(1) + end + end + + describe 'delay on a mail object' do + it 'raises an exception' do + expect do + MyMailer.with(foo: 1, bar: 2).signup('john@example.com').delay + end.to raise_error(RuntimeError) + end + end + end +end From 4878fcd255ed11ea6ea81b80fe9c85d716721bb7 Mon Sep 17 00:00:00 2001 From: shields Date: Tue, 22 Sep 2020 19:10:27 +0900 Subject: [PATCH 29/66] Add to and improve README for Mailers --- README.md | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 3bf63336e..37998eb05 100644 --- a/README.md +++ b/README.md @@ -168,9 +168,10 @@ end If you ever want to call a `handle_asynchronously`'d method without Delayed Job, for instance while debugging something at the console, just add `_without_delay` to the method name. For instance, if your original method was `foo`, then call `foo_without_delay`. -Rails 3 Mailers -=============== -Due to how mailers are implemented in Rails 3, we had to do a little work around to get delayed_job to work. +Rails Mailers +============= +Delayed Job uses special syntax for Rails Mailers. +Do not call the `.deliver` method when using `.delay`. ```ruby # without delayed_job @@ -179,12 +180,16 @@ Notifier.signup(@user).deliver # with delayed_job Notifier.delay.signup(@user) -# with delayed_job running at a specific time +# delayed_job running at a specific time Notifier.delay(run_at: 5.minutes.from_now).signup(@user) + +# when using parameters, the .with method must be called before the .delay method +Notifier.with(foo: 1, bar: 2).delay.signup(@user) ``` -Remove the `.deliver` method to make it work. It's not ideal, but it's the best -we could do for now. +You may also wish to consider using +[Active Job with Action Mailer](https://edgeguides.rubyonrails.org/active_job_basics.html#action-mailer) +which provides convenient `.deliver_later` syntax that forwards to Delayed Job under-the-hood. Named Queues ============ From 75bec31fb407b7444e943ad40312f464754af5df Mon Sep 17 00:00:00 2001 From: shields Date: Tue, 22 Sep 2020 19:28:34 +0900 Subject: [PATCH 30/66] Fix rubocop --- spec/performable_mailer_spec.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/performable_mailer_spec.rb b/spec/performable_mailer_spec.rb index 0cc9a4b6e..39796eea2 100644 --- a/spec/performable_mailer_spec.rb +++ b/spec/performable_mailer_spec.rb @@ -46,11 +46,11 @@ def signup(email) describe 'delay' do it 'enqueues a PerformableEmail job' do expect do - job = MyMailer.with(foo: 1, bar: 2).delay.signup('john@example.com') + job = MyMailer.with(:foo => 1, :bar => 2).delay.signup('john@example.com') expect(job.payload_object.class).to eq(Delayed::PerformableMailer) expect(job.payload_object.object.class).to eq(ActionMailer::Parameterized::Mailer) expect(job.payload_object.object.instance_variable_get('@mailer')).to eq(MyMailer) - expect(job.payload_object.object.instance_variable_get('@params')).to eq(foo: 1, bar: 2) + expect(job.payload_object.object.instance_variable_get('@params')).to eq(:foo => 1, :bar => 2) expect(job.payload_object.method_name).to eq(:signup) expect(job.payload_object.args).to eq(['john@example.com']) end.to change { Delayed::Job.count }.by(1) @@ -60,7 +60,7 @@ def signup(email) describe 'delay on a mail object' do it 'raises an exception' do expect do - MyMailer.with(foo: 1, bar: 2).signup('john@example.com').delay + MyMailer.with(:foo => 1, :bar => 2).signup('john@example.com').delay end.to raise_error(RuntimeError) end end From 065fc51b17abdf47908240032d84338f8c417564 Mon Sep 17 00:00:00 2001 From: David Genord II Date: Tue, 8 Dec 2020 16:53:54 -0500 Subject: [PATCH 31/66] Add Github Action CI --- .github/workflows/ci.yml | 65 ++++++++++++++++++++++++++++++++++++++++ Gemfile | 4 +-- spec/helper.rb | 16 ++++++---- 3 files changed, 78 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..7fd338afe --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,65 @@ +name: CI + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + test: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + ruby: [2.5, 2.6, 2.7, jruby, jruby-head, ruby-head] + rails_version: + - '~> 5.2.0' + - '~> 6.0.0' + - 'edge' + include: + # + # The past + # + # EOL Active Record + - ruby: 2.2 + rails_version: '~> 3.2.0' + - ruby: 2.1 + rails_version: '~> 4.1.0' + - ruby: 2.4 + rails_version: '~> 4.2.0' + - ruby: 2.4 + rails_version: '~> 5.0.0' + - ruby: 2.5 + rails_version: '~> 5.1.0' + + continue-on-error: ${{ matrix.rails_version == 'edge' || endsWith(matrix.ruby, 'head') }} + + steps: + - uses: actions/checkout@v2 + - uses: ruby/setup-ruby@v1 + env: + RAILS_VERSION: ${{ matrix.rails_version }} + with: + ruby-version: ${{ matrix.ruby }} + bundler-cache: true # runs 'bundle install' and caches installed gems automatically + - name: Run tests + env: + RAILS_VERSION: ${{ matrix.rails_version }} + run: bundle exec rspec + - name: Coveralls Parallel + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.github_token }} + flag-name: run-${{ matrix.ruby }}-${{ matrix.rails_version }} + parallel: true + + finish: + needs: test + runs-on: ubuntu-latest + steps: + - name: Coveralls Finished + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.github_token }} + parallel-finished: true diff --git a/Gemfile b/Gemfile index 0c349d188..c9a41ec1f 100644 --- a/Gemfile +++ b/Gemfile @@ -40,10 +40,10 @@ group :test do gem 'activerecord', (ENV['RAILS_VERSION'] || ['>= 3.0', '< 5.3']) end - gem 'coveralls', :require => false gem 'rspec', '>= 3' gem 'rubocop', '>= 0.25', '< 0.49' - gem 'simplecov', '>= 0.9' + gem 'simplecov', '>= 0.20.0', :require => false + gem 'simplecov-lcov', '>= 0.8.0', :require => false end gemspec diff --git a/spec/helper.rb b/spec/helper.rb index d07b28607..e3d528d1a 100644 --- a/spec/helper.rb +++ b/spec/helper.rb @@ -1,13 +1,19 @@ require 'simplecov' -require 'coveralls' +require 'simplecov-lcov' -SimpleCov.formatters = [SimpleCov::Formatter::HTMLFormatter, Coveralls::SimpleCov::Formatter] +SimpleCov::Formatter::LcovFormatter.config do |c| + c.report_with_single_file = true + c.single_report_path = 'coverage/lcov.info' +end +SimpleCov.formatters = SimpleCov::Formatter::MultiFormatter.new( + [ + SimpleCov::Formatter::HTMLFormatter, + SimpleCov::Formatter::LcovFormatter + ] +) SimpleCov.start do add_filter '/spec/' - # Each version of ruby and version of rails test different things - # This should probably just be removed. - minimum_coverage(85.0) end require 'logger' From 80aa67a2eaf91c318d539ac7552a35e2e5541b85 Mon Sep 17 00:00:00 2001 From: David Genord II Date: Tue, 8 Dec 2020 16:54:19 -0500 Subject: [PATCH 32/66] Add rubocop Github Action --- .github/workflows/rubocop.yml | 30 ++++++++++++++++++++++++++++++ Gemfile | 5 ++++- 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/rubocop.yml diff --git a/.github/workflows/rubocop.yml b/.github/workflows/rubocop.yml new file mode 100644 index 000000000..739473987 --- /dev/null +++ b/.github/workflows/rubocop.yml @@ -0,0 +1,30 @@ +name: RuboCop + +on: [push, pull_request] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up Ruby 2.7 + uses: ruby/setup-ruby@v1 + with: + ruby-version: 2.7 + - name: Generate lockfile for cache key + run: bundle lock + - name: Cache gems + uses: actions/cache@v1 + with: + path: vendor/bundle + key: ${{ runner.os }}-rubocop-${{ hashFiles('**/Gemfile.lock') }} + restore-keys: | + ${{ runner.os }}-rubocop- + - name: Install gems + run: | + bundle config path vendor/bundle + bundle config set without 'default test' + bundle install --jobs 4 --retry 3 + - name: Run RuboCop + run: bundle exec rubocop diff --git a/Gemfile b/Gemfile index c9a41ec1f..cd4e86fae 100644 --- a/Gemfile +++ b/Gemfile @@ -41,9 +41,12 @@ group :test do end gem 'rspec', '>= 3' - gem 'rubocop', '>= 0.25', '< 0.49' gem 'simplecov', '>= 0.20.0', :require => false gem 'simplecov-lcov', '>= 0.8.0', :require => false end +group :rubocop do + gem 'rubocop', '>= 0.25', '< 0.49' +end + gemspec From 8ad44ac4b910c9855997bc5fe473ee3c8bb4e08d Mon Sep 17 00:00:00 2001 From: David Genord II Date: Tue, 8 Dec 2020 16:54:50 -0500 Subject: [PATCH 33/66] Remove Travis CI --- .travis.yml | 62 ----------------------------------------------------- 1 file changed, 62 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 3ebb7baf2..000000000 --- a/.travis.yml +++ /dev/null @@ -1,62 +0,0 @@ -language: ruby -branches: - only: - - master -env: - global: - - JRUBY_OPTS="$JRUBY_OPTS --debug" - matrix: - - RAILS_VERSION="~> 4.2.0" - - RAILS_VERSION="~> 5.1.0" - - RAILS_VERSION="~> 5.2.0" - - RAILS_VERSION="~> 6.0.0" - - RAILS_VERSION="edge" -rvm: - - 2.3.8 - - 2.4.5 - - 2.5.3 - - 2.6.1 - - jruby-9.2.7.0 - - jruby-head - - ruby-head -jdk: oraclejdk11 -matrix: - allow_failures: - - rvm: jruby-head - - rvm: ruby-head - - env: RAILS_VERSION="edge" - - rvm: jruby-9.2.7.0 - env: RAILS_VERSION="~> 5.1.0" - - rvm: jruby-9.2.7.0 - env: RAILS_VERSION="~> 5.2.0" - fast_finish: true - # legacy testing - # things still run and we don't have a good reason to break it - # but we don't need to keep running the full matrix - include: - - rvm: 2.3.8 - env: RAILS_VERSION="~> 3.0.0" - - rvm: 2.3.8 - env: RAILS_VERSION="~> 3.1.0" - - rvm: 2.3.8 - env: RAILS_VERSION="~> 3.2.0" - - rvm: 2.3.8 - env: RAILS_VERSION="~> 4.0.0" - - rvm: 2.3.8 - env: RAILS_VERSION="~> 4.1.0" - - rvm: 2.1.10 - env: RAILS_VERSION="~> 4.2.0" - - rvm: 2.2.10 - env: RAILS_VERSION="~> 4.2.0" - - rvm: 2.4.4 - env: RAILS_VERSION="~> 5.0.0" - exclude: - - rvm: 2.3.8 - env: RAILS_VERSION="~> 6.0.0" - - rvm: 2.4.5 - env: RAILS_VERSION="~> 6.0.0" - - rvm: 2.3.8 - env: RAILS_VERSION="edge" - - rvm: 2.4.5 - env: RAILS_VERSION="edge" -sudo: false From 0ca7b4a62d76fa9c13b6f61ad4db2f3dbb6a2ec0 Mon Sep 17 00:00:00 2001 From: David Genord II Date: Tue, 8 Dec 2020 17:12:27 -0500 Subject: [PATCH 34/66] Fix simplecov issue --- Gemfile | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index cd4e86fae..5f70351a3 100644 --- a/Gemfile +++ b/Gemfile @@ -41,8 +41,13 @@ group :test do end gem 'rspec', '>= 3' - gem 'simplecov', '>= 0.20.0', :require => false - gem 'simplecov-lcov', '>= 0.8.0', :require => false + 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 From 1a8f49cbea932b8a01f337ce7f7ad420056a1223 Mon Sep 17 00:00:00 2001 From: David Genord II Date: Tue, 8 Dec 2020 17:25:47 -0500 Subject: [PATCH 35/66] Tweak version handling for cleaner display --- .github/workflows/ci.yml | 14 +++++++------- Gemfile | 15 ++++++++++----- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7fd338afe..2d9394839 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,8 +14,8 @@ jobs: matrix: ruby: [2.5, 2.6, 2.7, jruby, jruby-head, ruby-head] rails_version: - - '~> 5.2.0' - - '~> 6.0.0' + - '5.2.0' + - '6.0.0' - 'edge' include: # @@ -23,15 +23,15 @@ jobs: # # EOL Active Record - ruby: 2.2 - rails_version: '~> 3.2.0' + rails_version: '3.2.0' - ruby: 2.1 - rails_version: '~> 4.1.0' + rails_version: '4.1.0' - ruby: 2.4 - rails_version: '~> 4.2.0' + rails_version: '4.2.0' - ruby: 2.4 - rails_version: '~> 5.0.0' + rails_version: '5.0.0' - ruby: 2.5 - rails_version: '~> 5.1.0' + rails_version: '5.1.0' continue-on-error: ${{ matrix.rails_version == 'edge' || endsWith(matrix.ruby, 'head') }} diff --git a/Gemfile b/Gemfile index 5f70351a3..e88e39671 100644 --- a/Gemfile +++ b/Gemfile @@ -5,7 +5,7 @@ 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'].split.last < '5.1' + if ENV['RAILS_VERSION'] && ENV['RAILS_VERSION'] < '5.1' gem 'sqlite3', '< 1.4' else gem 'sqlite3' @@ -13,7 +13,7 @@ platforms :ruby do end platforms :jruby do - if ENV['RAILS_VERSION'] == '~> 4.2.0' + if ENV['RAILS_VERSION'] == '4.2.0' gem 'activerecord-jdbcsqlite3-adapter', '< 50.0' else gem 'activerecord-jdbcsqlite3-adapter' @@ -22,8 +22,10 @@ platforms :jruby do 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', (ENV['RAILS_VERSION'] || ['>= 3.0', '< 5.3']) + gem 'railties', ['>= 3.0', '< 5.3'] end end @@ -35,9 +37,12 @@ group :test do if ENV['RAILS_VERSION'] == 'edge' gem 'actionmailer', :github => 'rails/rails' gem 'activerecord', :github => 'rails/rails' + elsif ENV['RAILS_VERSION'] + gem 'actionmailer', "~> #{ENV['RAILS_VERSION']}" + gem 'activerecord', "~> #{ENV['RAILS_VERSION']}" else - gem 'actionmailer', (ENV['RAILS_VERSION'] || ['>= 3.0', '< 5.3']) - gem 'activerecord', (ENV['RAILS_VERSION'] || ['>= 3.0', '< 5.3']) + gem 'actionmailer', ['>= 3.0', '< 5.3'] + gem 'activerecord', ['>= 3.0', '< 5.3'] end gem 'rspec', '>= 3' From 44412a57c5d5f3d941223508d6c6104a019b02a8 Mon Sep 17 00:00:00 2001 From: David Genord II Date: Wed, 9 Dec 2020 10:19:54 -0500 Subject: [PATCH 36/66] Update build status badge --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 3bf63336e..453a904c8 100644 --- a/README.md +++ b/README.md @@ -6,12 +6,11 @@ you're reading the documentation for the master branch. Delayed::Job ============ [![Gem Version](https://badge.fury.io/rb/delayed_job.svg)][gem] -[![Build Status](https://travis-ci.org/collectiveidea/delayed_job.svg?branch=master)][travis] +![CI](https://github.com/collectiveidea/delayed_job/workflows/CI/badge.svg) [![Code Climate](https://codeclimate.com/github/collectiveidea/delayed_job.svg)][codeclimate] [![Coverage Status](https://coveralls.io/repos/collectiveidea/delayed_job/badge.svg?branch=master)][coveralls] [gem]: https://rubygems.org/gems/delayed_job -[travis]: https://travis-ci.org/collectiveidea/delayed_job [codeclimate]: https://codeclimate.com/github/collectiveidea/delayed_job [coveralls]: https://coveralls.io/r/collectiveidea/delayed_job From 1f16417d19ce9e7dcd6566e193771cc995f10bf5 Mon Sep 17 00:00:00 2001 From: David Genord II Date: Wed, 9 Dec 2020 11:34:37 -0500 Subject: [PATCH 37/66] Allow rails 6.1 --- .github/workflows/ci.yml | 1 + CHANGELOG.md | 4 ++++ Gemfile | 6 +++--- delayed_job.gemspec | 2 +- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2d9394839..1f78e0b26 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,6 +16,7 @@ jobs: rails_version: - '5.2.0' - '6.0.0' + - '6.1.0.rc2' - 'edge' include: # diff --git a/CHANGELOG.md b/CHANGELOG.md index 48a472251..14a4a71f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +4.1.9 - not yet released +================= +* Support for Rails 6.1 + 4.1.8 - 2019-08-16 ================= * Support for Rails 6.0.0 diff --git a/Gemfile b/Gemfile index e88e39671..edeb51305 100644 --- a/Gemfile +++ b/Gemfile @@ -25,7 +25,7 @@ platforms :jruby do elsif ENV['RAILS_VERSION'] gem 'railties', "~> #{ENV['RAILS_VERSION']}" else - gem 'railties', ['>= 3.0', '< 5.3'] + gem 'railties', ['>= 3.0', '< 6.2'] end end @@ -41,8 +41,8 @@ group :test do gem 'actionmailer', "~> #{ENV['RAILS_VERSION']}" gem 'activerecord', "~> #{ENV['RAILS_VERSION']}" else - gem 'actionmailer', ['>= 3.0', '< 5.3'] - gem 'activerecord', ['>= 3.0', '< 5.3'] + gem 'actionmailer', ['>= 3.0', '< 6.2'] + gem 'activerecord', ['>= 3.0', '< 6.2'] end gem 'rspec', '>= 3' diff --git a/delayed_job.gemspec b/delayed_job.gemspec index b45c7d1cf..e40bcdcf7 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.1'] + spec.add_dependency 'activesupport', ['>= 3.0', '< 6.2'] 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 2b064f78b9bb78096a5d25e980d9cc2f2cbe609b Mon Sep 17 00:00:00 2001 From: David Genord II Date: Wed, 9 Dec 2020 11:48:31 -0500 Subject: [PATCH 38/66] Pull dev jdbcsqlite3 for edge and rails 6.1 We can remove the rails 6.1 part when 61.0 is released --- Gemfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Gemfile b/Gemfile index edeb51305..b83acb5bc 100644 --- a/Gemfile +++ b/Gemfile @@ -15,6 +15,8 @@ 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' else gem 'activerecord-jdbcsqlite3-adapter' end From baed6e813870e1144e7a4291bc71e06a67a533de Mon Sep 17 00:00:00 2001 From: David Genord II Date: Wed, 9 Dec 2020 15:17:46 -0500 Subject: [PATCH 39/66] Prepare 4.1.9 release --- CHANGELOG.md | 17 +++++++++-------- README.md | 4 ++-- delayed_job.gemspec | 2 +- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 14a4a71f7..51e2dcf0e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,33 +1,34 @@ -4.1.9 - not yet released -================= +4.1.9 - 2020-12-09 +================== * Support for Rails 6.1 +* Add support for parameterized mailers via delay call (#1121) 4.1.8 - 2019-08-16 -================= +================== * Support for Rails 6.0.0 4.1.7 - 2019-06-20 -================= +================== * Fix loading Delayed::PerformableMailer when ActionMailer isn't loaded yet 4.1.6 - 2019-06-19 -================= +================== * Properly initialize ActionMailer outside railties (#1077) * Fix Psych load_tags support (#1093) * Replace REMOVED with FAILED in log message (#1048) * Misc doc updates (#1052, #1074, #1064, #1063) 4.1.5 - 2018-04-13 -================= +================== * Allow Rails 5.2 4.1.4 - 2017-12-29 -================= +================== * Use `yaml_tag` instead of deprecated `yaml_as` (#996) * Support ruby 2.5.0 4.1.3 - 2017-05-26 -================= +================== * Don't mutate the options hash (#877) * Log an error message when a deserialization error occurs (#894) * Adding the queue name to the log output (#917) diff --git a/README.md b/README.md index ded92378c..29ad10782 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.8).](https://github.com/collectiveidea/delayed_job/tree/v4.1.8)** +(4.1.9).](https://github.com/collectiveidea/delayed_job/tree/v4.1.9)** Delayed::Job ============ @@ -182,7 +182,7 @@ Notifier.delay.signup(@user) # delayed_job running at a specific time Notifier.delay(run_at: 5.minutes.from_now).signup(@user) -# when using parameters, the .with method must be called before the .delay method +# when using parameters, the .with method must be called before the .delay method Notifier.with(foo: 1, bar: 2).delay.signup(@user) ``` diff --git a/delayed_job.gemspec b/delayed_job.gemspec index 047125511..c9b60a781 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.8' + 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', From d6bc5cc1eb5ec7984443e852b299d8f110dea4d0 Mon Sep 17 00:00:00 2001 From: willnet Date: Mon, 11 Oct 2021 16:27:11 +0900 Subject: [PATCH 40/66] 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 41/66] 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 42/66] 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 43/66] 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 44/66] 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 45/66] 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 46/66] 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 47/66] 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 48/66] 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 49/66] 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 50/66] 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 51/66] 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 52/66] 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 53/66] 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 54/66] 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 55/66] 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 56/66] 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 57/66] 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 58/66] 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 59/66] 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 60/66] 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 61/66] 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', From f5624ce694e6fba3170ee2ea93c160ef85ff2d95 Mon Sep 17 00:00:00 2001 From: Ariel Valentin Date: Tue, 10 May 2022 00:11:30 +0000 Subject: [PATCH 62/66] fix: ActiveSupport 7.0.3 Compatibility Fixes https://github.com/collectiveidea/delayed_job/issues/1168 --- lib/delayed/worker.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/delayed/worker.rb b/lib/delayed/worker.rb index 1a352f775..7b983a206 100644 --- a/lib/delayed/worker.rb +++ b/lib/delayed/worker.rb @@ -1,5 +1,6 @@ require 'timeout' require 'active_support/dependencies' +require 'active_support/core_ext/kernel/reporting' require 'active_support/core_ext/numeric/time' require 'active_support/core_ext/class/attribute_accessors' require 'active_support/hash_with_indifferent_access' From 7042b1ddb87d3b3f468e8350bc2101a283922ed6 Mon Sep 17 00:00:00 2001 From: David Genord II Date: Wed, 28 Sep 2022 14:41:01 -0400 Subject: [PATCH 63/66] Prepare 4.1.11 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 9d8f3c37d..86d801219 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +4.1.11 - 2022-09-28 +=================== +* Fix missing require for Rails 7.0.3+ + 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. diff --git a/README.md b/README.md index c72ed2f6f..ff7f2660b 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.10).](https://github.com/collectiveidea/delayed_job/tree/v4.1.10)** +(4.1.11).](https://github.com/collectiveidea/delayed_job/tree/v4.1.11)** Delayed::Job ============ diff --git a/delayed_job.gemspec b/delayed_job.gemspec index ee290405e..0ed7afc33 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.10' + spec.version = '4.1.11' spec.metadata = { 'changelog_uri' => 'https://github.com/collectiveidea/delayed_job/blob/master/CHANGELOG.md', 'bug_tracker_uri' => 'https://github.com/collectiveidea/delayed_job/issues', From a83d1a4ac8dfa5851eb4f701428c2c6f2b41bc65 Mon Sep 17 00:00:00 2001 From: Orien Madgwick <497874+orien@users.noreply.github.com> Date: Sun, 15 Jan 2023 22:06:08 +1100 Subject: [PATCH 64/66] CI: add Ruby 3.2 to the test matrix --- .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 3e451964d..8cb154edf 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', '3.1', jruby-head, ruby-head] + ruby: ['2.7', '3.0', '3.1', '3.2', jruby-head, ruby-head] rails_version: - '6.0.0' - '6.1.0' From c2f29f322d6bedf462084f2039d7a5e47f9b138d Mon Sep 17 00:00:00 2001 From: Orien Madgwick <497874+orien@users.noreply.github.com> Date: Sun, 15 Jan 2023 22:14:15 +1100 Subject: [PATCH 65/66] CI: use JRuby 9.4 to test Rails 7.0 and edge Rails 7 and above requires Ruby 2.7 compatibility, however JRuby 9.3.x provides only Ruby 2.6 compatibility. --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8cb154edf..31b73af00 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,10 +39,10 @@ jobs: - ruby: jruby-9.2 rails_version: '6.1.0' - # jruby-9.3 - - ruby: jruby-9.3 + # jruby-9.4 + - ruby: jruby-9.4 rails_version: '7.0.0' - - ruby: jruby-9.3 + - ruby: jruby-9.4 rails_version: 'edge' # From 4dfb33de7fa57b6cf5aefd12ca799265fbf4b6eb Mon Sep 17 00:00:00 2001 From: Swati Krishnan Date: Mon, 17 Jul 2023 23:24:30 -0700 Subject: [PATCH 66/66] allowing 6.2 versions --- Gemfile | 6 +++--- delayed_job.gemspec | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Gemfile b/Gemfile index ab189562d..f3a4194a6 100644 --- a/Gemfile +++ b/Gemfile @@ -17,7 +17,7 @@ platforms :jruby do if ENV['RAILS_VERSION'] == 'edge' gem 'railties', :github => 'rails/rails' else - gem 'railties', (ENV['RAILS_VERSION'] || ['>= 3.0', '< 5.2']) + gem 'railties', (ENV['RAILS_VERSION'] || ['>= 3.0', '< 6.2']) end end @@ -30,8 +30,8 @@ group :test do gem 'actionmailer', :github => 'rails/rails' gem 'activerecord', :github => 'rails/rails' else - gem 'actionmailer', (ENV['RAILS_VERSION'] || ['>= 3.0', '< 5.2']) - gem 'activerecord', (ENV['RAILS_VERSION'] || ['>= 3.0', '< 5.2']) + gem 'actionmailer', (ENV['RAILS_VERSION'] || ['>= 3.0', '< 6.2']) + gem 'activerecord', (ENV['RAILS_VERSION'] || ['>= 3.0', '< 6.2']) end gem 'coveralls', :require => false diff --git a/delayed_job.gemspec b/delayed_job.gemspec index 75f014a2f..ab6841ea7 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.1'] + spec.add_dependency 'activesupport', ['>= 3.0', '< 6.2'] 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']