From 83cdeeb6fed6cdd6e769c9b2dbfa2b15a4907af8 Mon Sep 17 00:00:00 2001 From: Nathan Griffith Date: Wed, 2 Jun 2021 16:37:24 -0400 Subject: [PATCH] Fix `detect_queue_adapter!` for aliased adapter constants (#19) * Fix queue adapter name lookup * queue_adapter_name is not supported on Rails 5.1, remove 5.1 support * Bump to 3.1.0 --- .circleci/config.yml | 124 ++++++++++++++++++++++--------------- Appraisals | 4 -- coach.yml | 2 +- gemfiles/rails_5_1.gemfile | 7 --- journaled.gemspec | 2 +- lib/journaled.rb | 2 +- lib/journaled/version.rb | 2 +- 7 files changed, 78 insertions(+), 65 deletions(-) delete mode 100644 gemfiles/rails_5_1.gemfile diff --git a/.circleci/config.yml b/.circleci/config.yml index b0b5302..2a7cfa3 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -35,10 +35,10 @@ jobs: name: notify coach of Job Completions command: notify_coach job_completions when: always - journaled--lint--rails_5_1_gemfile: + journaled--lint--rails_5_2_gemfile: resource_class: small environment: - BUNDLE_GEMFILE: gemfiles/rails_5_1.gemfile + BUNDLE_GEMFILE: gemfiles/rails_5_2.gemfile docker: - image: 907128454492.dkr.ecr.us-east-1.amazonaws.com/betterment/ruby/2.6.1:v4.x environment: @@ -69,10 +69,10 @@ jobs: coach check - restore_cache: keys: - - v4-journaled-2.6.1-gemfiles/rails_5_1.gemfile-{{ checksum "./coach.yml" - }}-{{ checksum "./gemfiles/rails_5_1.gemfile" }}-{{ checksum "./journaled.gemspec" + - v4-journaled-2.6.1-gemfiles/rails_5_2.gemfile-{{ checksum "./coach.yml" + }}-{{ checksum "./gemfiles/rails_5_2.gemfile" }}-{{ checksum "./journaled.gemspec" }} - - v4-journaled-2.6.1-gemfiles/rails_5_1.gemfile- + - v4-journaled-2.6.1-gemfiles/rails_5_2.gemfile- - run: name: bundle install dependencies command: | @@ -82,8 +82,8 @@ jobs: - save_cache: paths: - "./gemfiles/vendor/bundle" - key: v4-journaled-2.6.1-gemfiles/rails_5_1.gemfile-{{ checksum "./coach.yml" - }}-{{ checksum "./gemfiles/rails_5_1.gemfile" }}-{{ checksum "./journaled.gemspec" + key: v4-journaled-2.6.1-gemfiles/rails_5_2.gemfile-{{ checksum "./coach.yml" + }}-{{ checksum "./gemfiles/rails_5_2.gemfile" }}-{{ checksum "./journaled.gemspec" }} - run: name: run rubocop @@ -104,10 +104,14 @@ jobs: name: notify coach of Job Completions command: notify_coach job_completions when: always - journaled--lint--rails_5_2_gemfile: + parameters: + _project: + default: journaled + type: string + journaled--lint--rails_6_0_gemfile: resource_class: small environment: - BUNDLE_GEMFILE: gemfiles/rails_5_2.gemfile + BUNDLE_GEMFILE: gemfiles/rails_6_0.gemfile docker: - image: 907128454492.dkr.ecr.us-east-1.amazonaws.com/betterment/ruby/2.6.1:v4.x environment: @@ -138,10 +142,10 @@ jobs: coach check - restore_cache: keys: - - v4-journaled-2.6.1-gemfiles/rails_5_2.gemfile-{{ checksum "./coach.yml" - }}-{{ checksum "./gemfiles/rails_5_2.gemfile" }}-{{ checksum "./journaled.gemspec" + - v4-journaled-2.6.1-gemfiles/rails_6_0.gemfile-{{ checksum "./coach.yml" + }}-{{ checksum "./gemfiles/rails_6_0.gemfile" }}-{{ checksum "./journaled.gemspec" }} - - v4-journaled-2.6.1-gemfiles/rails_5_2.gemfile- + - v4-journaled-2.6.1-gemfiles/rails_6_0.gemfile- - run: name: bundle install dependencies command: | @@ -151,8 +155,8 @@ jobs: - save_cache: paths: - "./gemfiles/vendor/bundle" - key: v4-journaled-2.6.1-gemfiles/rails_5_2.gemfile-{{ checksum "./coach.yml" - }}-{{ checksum "./gemfiles/rails_5_2.gemfile" }}-{{ checksum "./journaled.gemspec" + key: v4-journaled-2.6.1-gemfiles/rails_6_0.gemfile-{{ checksum "./coach.yml" + }}-{{ checksum "./gemfiles/rails_6_0.gemfile" }}-{{ checksum "./journaled.gemspec" }} - run: name: run rubocop @@ -173,10 +177,14 @@ jobs: name: notify coach of Job Completions command: notify_coach job_completions when: always - journaled--lint--rails_6_0_gemfile: + parameters: + _project: + default: journaled + type: string + journaled--lint--rails_6_1_gemfile: resource_class: small environment: - BUNDLE_GEMFILE: gemfiles/rails_6_0.gemfile + BUNDLE_GEMFILE: gemfiles/rails_6_1.gemfile docker: - image: 907128454492.dkr.ecr.us-east-1.amazonaws.com/betterment/ruby/2.6.1:v4.x environment: @@ -207,10 +215,10 @@ jobs: coach check - restore_cache: keys: - - v4-journaled-2.6.1-gemfiles/rails_6_0.gemfile-{{ checksum "./coach.yml" - }}-{{ checksum "./gemfiles/rails_6_0.gemfile" }}-{{ checksum "./journaled.gemspec" + - v4-journaled-2.6.1-gemfiles/rails_6_1.gemfile-{{ checksum "./coach.yml" + }}-{{ checksum "./gemfiles/rails_6_1.gemfile" }}-{{ checksum "./journaled.gemspec" }} - - v4-journaled-2.6.1-gemfiles/rails_6_0.gemfile- + - v4-journaled-2.6.1-gemfiles/rails_6_1.gemfile- - run: name: bundle install dependencies command: | @@ -220,8 +228,8 @@ jobs: - save_cache: paths: - "./gemfiles/vendor/bundle" - key: v4-journaled-2.6.1-gemfiles/rails_6_0.gemfile-{{ checksum "./coach.yml" - }}-{{ checksum "./gemfiles/rails_6_0.gemfile" }}-{{ checksum "./journaled.gemspec" + key: v4-journaled-2.6.1-gemfiles/rails_6_1.gemfile-{{ checksum "./coach.yml" + }}-{{ checksum "./gemfiles/rails_6_1.gemfile" }}-{{ checksum "./journaled.gemspec" }} - run: name: run rubocop @@ -242,10 +250,14 @@ jobs: name: notify coach of Job Completions command: notify_coach job_completions when: always - journaled--test--rails_5_1_gemfile: + parameters: + _project: + default: journaled + type: string + journaled--test--rails_5_2_gemfile: resource_class: small environment: - BUNDLE_GEMFILE: gemfiles/rails_5_1.gemfile + BUNDLE_GEMFILE: gemfiles/rails_5_2.gemfile EAGER_LOAD: true parallelism: 1 docker: @@ -273,10 +285,10 @@ jobs: key: v2-git-refs-{{ checksum "/tmp/.git-refs-cache-key" }} - restore_cache: keys: - - v4-journaled-2.6.1-gemfiles/rails_5_1.gemfile-{{ checksum "./coach.yml" - }}-{{ checksum "./gemfiles/rails_5_1.gemfile" }}-{{ checksum "./journaled.gemspec" + - v4-journaled-2.6.1-gemfiles/rails_5_2.gemfile-{{ checksum "./coach.yml" + }}-{{ checksum "./gemfiles/rails_5_2.gemfile" }}-{{ checksum "./journaled.gemspec" }} - - v4-journaled-2.6.1-gemfiles/rails_5_1.gemfile- + - v4-journaled-2.6.1-gemfiles/rails_5_2.gemfile- - run: name: bundle install dependencies command: | @@ -286,8 +298,8 @@ jobs: - save_cache: paths: - "./gemfiles/vendor/bundle" - key: v4-journaled-2.6.1-gemfiles/rails_5_1.gemfile-{{ checksum "./coach.yml" - }}-{{ checksum "./gemfiles/rails_5_1.gemfile" }}-{{ checksum "./journaled.gemspec" + key: v4-journaled-2.6.1-gemfiles/rails_5_2.gemfile-{{ checksum "./coach.yml" + }}-{{ checksum "./gemfiles/rails_5_2.gemfile" }}-{{ checksum "./journaled.gemspec" }} - run: name: run rspec tests @@ -353,10 +365,14 @@ jobs: name: notify coach of Job Completions command: notify_coach job_completions when: always - journaled--test--rails_5_2_gemfile: + parameters: + _project: + default: journaled + type: string + journaled--test--rails_6_0_gemfile: resource_class: small environment: - BUNDLE_GEMFILE: gemfiles/rails_5_2.gemfile + BUNDLE_GEMFILE: gemfiles/rails_6_0.gemfile EAGER_LOAD: true parallelism: 1 docker: @@ -384,10 +400,10 @@ jobs: key: v2-git-refs-{{ checksum "/tmp/.git-refs-cache-key" }} - restore_cache: keys: - - v4-journaled-2.6.1-gemfiles/rails_5_2.gemfile-{{ checksum "./coach.yml" - }}-{{ checksum "./gemfiles/rails_5_2.gemfile" }}-{{ checksum "./journaled.gemspec" + - v4-journaled-2.6.1-gemfiles/rails_6_0.gemfile-{{ checksum "./coach.yml" + }}-{{ checksum "./gemfiles/rails_6_0.gemfile" }}-{{ checksum "./journaled.gemspec" }} - - v4-journaled-2.6.1-gemfiles/rails_5_2.gemfile- + - v4-journaled-2.6.1-gemfiles/rails_6_0.gemfile- - run: name: bundle install dependencies command: | @@ -397,8 +413,8 @@ jobs: - save_cache: paths: - "./gemfiles/vendor/bundle" - key: v4-journaled-2.6.1-gemfiles/rails_5_2.gemfile-{{ checksum "./coach.yml" - }}-{{ checksum "./gemfiles/rails_5_2.gemfile" }}-{{ checksum "./journaled.gemspec" + key: v4-journaled-2.6.1-gemfiles/rails_6_0.gemfile-{{ checksum "./coach.yml" + }}-{{ checksum "./gemfiles/rails_6_0.gemfile" }}-{{ checksum "./journaled.gemspec" }} - run: name: run rspec tests @@ -464,10 +480,14 @@ jobs: name: notify coach of Job Completions command: notify_coach job_completions when: always - journaled--test--rails_6_0_gemfile: + parameters: + _project: + default: journaled + type: string + journaled--test--rails_6_1_gemfile: resource_class: small environment: - BUNDLE_GEMFILE: gemfiles/rails_6_0.gemfile + BUNDLE_GEMFILE: gemfiles/rails_6_1.gemfile EAGER_LOAD: true parallelism: 1 docker: @@ -495,10 +515,10 @@ jobs: key: v2-git-refs-{{ checksum "/tmp/.git-refs-cache-key" }} - restore_cache: keys: - - v4-journaled-2.6.1-gemfiles/rails_6_0.gemfile-{{ checksum "./coach.yml" - }}-{{ checksum "./gemfiles/rails_6_0.gemfile" }}-{{ checksum "./journaled.gemspec" + - v4-journaled-2.6.1-gemfiles/rails_6_1.gemfile-{{ checksum "./coach.yml" + }}-{{ checksum "./gemfiles/rails_6_1.gemfile" }}-{{ checksum "./journaled.gemspec" }} - - v4-journaled-2.6.1-gemfiles/rails_6_0.gemfile- + - v4-journaled-2.6.1-gemfiles/rails_6_1.gemfile- - run: name: bundle install dependencies command: | @@ -508,8 +528,8 @@ jobs: - save_cache: paths: - "./gemfiles/vendor/bundle" - key: v4-journaled-2.6.1-gemfiles/rails_6_0.gemfile-{{ checksum "./coach.yml" - }}-{{ checksum "./gemfiles/rails_6_0.gemfile" }}-{{ checksum "./journaled.gemspec" + key: v4-journaled-2.6.1-gemfiles/rails_6_1.gemfile-{{ checksum "./coach.yml" + }}-{{ checksum "./gemfiles/rails_6_1.gemfile" }}-{{ checksum "./journaled.gemspec" }} - run: name: run rspec tests @@ -575,6 +595,10 @@ jobs: name: notify coach of Job Completions command: notify_coach job_completions when: always + parameters: + _project: + default: journaled + type: string workflows: version: 2 all: @@ -585,16 +609,12 @@ workflows: context: org-global requires: - started - - journaled--lint--rails_5_1_gemfile - journaled--lint--rails_5_2_gemfile - journaled--lint--rails_6_0_gemfile - - journaled--test--rails_5_1_gemfile + - journaled--lint--rails_6_1_gemfile - journaled--test--rails_5_2_gemfile - journaled--test--rails_6_0_gemfile - - journaled--lint--rails_5_1_gemfile: - context: org-global - requires: - - started + - journaled--test--rails_6_1_gemfile - journaled--lint--rails_5_2_gemfile: context: org-global requires: @@ -603,7 +623,7 @@ workflows: context: org-global requires: - started - - journaled--test--rails_5_1_gemfile: + - journaled--lint--rails_6_1_gemfile: context: org-global requires: - started @@ -615,8 +635,12 @@ workflows: context: org-global requires: - started + - journaled--test--rails_6_1_gemfile: + context: org-global + requires: + - started when: "<< pipeline.parameters.run_default_workflows >>" -coach_version: 0.31.1 +coach_version: 1.0.3.pre parameters: run_default_workflows: type: boolean diff --git a/Appraisals b/Appraisals index 49971aa..6cc5282 100644 --- a/Appraisals +++ b/Appraisals @@ -1,7 +1,3 @@ -appraise 'rails-5-1' do - gem 'railties', '~> 5.1.0' -end - appraise 'rails-5-2' do gem 'railties', '~> 5.2.0' end diff --git a/coach.yml b/coach.yml index 75f75cc..5053607 100644 --- a/coach.yml +++ b/coach.yml @@ -3,7 +3,7 @@ ruby_version: 2.6.1 resource_class: small cache_sequence: 4 test_gemfiles: - - gemfiles/rails_5_1.gemfile - gemfiles/rails_5_2.gemfile - gemfiles/rails_6_0.gemfile + - gemfiles/rails_6_1.gemfile base_runtime_image_version: dev diff --git a/gemfiles/rails_5_1.gemfile b/gemfiles/rails_5_1.gemfile deleted file mode 100644 index 66a5a0b..0000000 --- a/gemfiles/rails_5_1.gemfile +++ /dev/null @@ -1,7 +0,0 @@ -# This file was generated by Appraisal - -source "https://rubygems.org" - -gem "railties", "~> 5.1.0" - -gemspec path: "../" diff --git a/journaled.gemspec b/journaled.gemspec index 231fa08..f2441e2 100644 --- a/journaled.gemspec +++ b/journaled.gemspec @@ -21,7 +21,7 @@ Gem::Specification.new do |s| s.add_dependency "activerecord" s.add_dependency "aws-sdk-kinesis", "< 2" s.add_dependency "json-schema" - s.add_dependency "railties", ">= 5.1", "< 7.0" + s.add_dependency "railties", ">= 5.2" s.add_dependency "request_store" s.add_development_dependency "appraisal", "~> 2.2.0" diff --git a/lib/journaled.rb b/lib/journaled.rb index 6cb2c07..60d92f6 100644 --- a/lib/journaled.rb +++ b/lib/journaled.rb @@ -36,7 +36,7 @@ def actor_uri end def detect_queue_adapter! - adapter = job_base_class_name.constantize.queue_adapter.class.name.split('::').last.underscore.gsub("_adapter", "") + adapter = job_base_class_name.constantize.queue_adapter_name unless SUPPORTED_QUEUE_ADAPTERS.include?(adapter) raise <<~MSG Journaled has detected an unsupported ActiveJob queue adapter: `:#{adapter}` diff --git a/lib/journaled/version.rb b/lib/journaled/version.rb index 4491539..ac48e39 100644 --- a/lib/journaled/version.rb +++ b/lib/journaled/version.rb @@ -1,3 +1,3 @@ module Journaled - VERSION = "3.0.0".freeze + VERSION = "3.1.0".freeze end