From ef85338290908f83e7485a6d11d170a13cff8453 Mon Sep 17 00:00:00 2001 From: Matt Muller Date: Sat, 16 Nov 2024 19:16:23 -0500 Subject: [PATCH 1/5] Prepare aws-sdk-rails 4.2 modularization --- .github/workflows/ci.yml | 17 +++++------------ .gitignore | 34 +++++++++++++--------------------- .rubocop.yml | 1 - .rubocop_todo.yml | 29 ----------------------------- Gemfile | 25 +++++++++++++------------ gemfiles/rails-7.1.gemfile | 5 ----- gemfiles/rails-7.2.gemfile | 5 ----- gemfiles/rails-8.0.gemfile | 5 ----- gemfiles/rails-main.gemfile | 5 ----- 9 files changed, 31 insertions(+), 95 deletions(-) delete mode 100644 .rubocop_todo.yml delete mode 100644 gemfiles/rails-7.1.gemfile delete mode 100644 gemfiles/rails-7.2.gemfile delete mode 100644 gemfiles/rails-8.0.gemfile delete mode 100644 gemfiles/rails-main.gemfile diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f441e556..fe625ef1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,27 +46,20 @@ jobs: - rails: main ruby: jruby-9.4 - env: - RAILS_ENV: test - RAILS_VERSION: ${{ matrix.rails }} steps: + - uses: actions/checkout@v4 + + - name: Set RAILS_VERSION + run: echo "RAILS_VERSION=${{ matrix.rails }}" >> $GITHUB_ENV + - name: Setup Ruby uses: ruby/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby }} bundler-cache: true - - uses: actions/checkout@v4 - - - name: Install gems - run: bundle install - env: - BUNDLE_GEMFILE: gemfiles/rails-${{ matrix.rails }}.gemfile - - name: Test run: bundle exec rake spec - env: - BUNDLE_GEMFILE: gemfiles/rails-${{ matrix.rails }}.gemfile rubocop: runs-on: ubuntu-latest diff --git a/.gitignore b/.gitignore index 66e63452..3ef763b0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,28 +1,20 @@ -.DS_Store - +.idea/ .byebug_history -/.bundle -/.yardoc -/doc + Gemfile.lock -/coverage *.gem -/.release -.idea/ +coverage/ +.yardoc/ +doc/ +docs.zip +.release/ -gemfiles/*.gemfile.lock -sample-app/Gemfile.lock -sample-app/log -sample-app/tmp -sample-app.zip - -test/dummy/db/migrate -test/dummy/log/ - -spec/dummy/db/test.db-shm -spec/dummy/db/test.db-wal -spec/dummy/db/test.db -spec/dummy/db/schema.rb spec/dummy/log/ spec/dummy/tmp/ +spec/dummy/storage/ + +sample-app/Gemfile.lock +sample-app/log/ +sample-app/tmp/ +sample-app.zip \ No newline at end of file diff --git a/.rubocop.yml b/.rubocop.yml index 21025455..7253302b 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -20,7 +20,6 @@ Metrics/MethodLength: Naming/FileName: Exclude: - - 'gemfiles/*.gemfile' - 'lib/aws-sdk-rails.rb' Style/BlockComments: diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml deleted file mode 100644 index e0f95914..00000000 --- a/.rubocop_todo.yml +++ /dev/null @@ -1,29 +0,0 @@ -# This configuration was generated by -# `rubocop --auto-gen-config` -# on 2024-11-16 00:49:51 UTC using RuboCop version 1.68.0. -# The point is for the user to remove these configuration records -# one by one as the offenses are removed from the code base. -# Note that changes in the inspected code, or installation of new -# versions of RuboCop, may require this file to be generated again. - -# Offense count: 3 -# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes. -Metrics/AbcSize: - Max: 21 - -# Offense count: 2 -# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns. -Metrics/MethodLength: - Max: 11 - -# Offense count: 1 -# Configuration parameters: CountComments, CountAsOne. -Metrics/ModuleLength: - Max: 215 - -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns. -# URISchemes: http, https -Layout/LineLength: - Max: 130 diff --git a/Gemfile b/Gemfile index a12cdff3..69568a57 100644 --- a/Gemfile +++ b/Gemfile @@ -4,26 +4,27 @@ source 'https://rubygems.org' gemspec -gem 'aws-actiondispatch-dynamodb', git: 'https://github.com/aws/aws-actiondispatch-dynamodb-ruby' -gem 'aws-actionmailbox-ses', git: 'https://github.com/aws/aws-actionmailbox-ses-ruby' -gem 'aws-actionmailer-ses', git: 'https://github.com/aws/aws-actionmailer-ses-ruby' -gem 'aws-activejob-sqs', git: 'https://github.com/aws/aws-activejob-sqs-ruby' -gem 'aws-record-rails', git: 'https://github.com/aws/aws-record-rails' - -group :development, :test do - gem 'pry' +gem 'rake', require: false + +case ENV.fetch('RAILS_VERSION', nil) +when '7.1' + gem 'rails', '~> 7.1.0' +when '7.2' + gem 'rails', '~> 7.2.0' +when '8.0' + gem 'rails', '~> 8.0.0' +else + gem 'rails', github: 'rails/rails' end group :development do gem 'byebug', platforms: :ruby + gem 'pry' gem 'rubocop' end group :test do - gem 'bcrypt' - gem 'minitest-spec-rails' - gem 'rspec-rails' - gem 'webmock' + gem 'rspec' end group :docs do diff --git a/gemfiles/rails-7.1.gemfile b/gemfiles/rails-7.1.gemfile deleted file mode 100644 index babb65fd..00000000 --- a/gemfiles/rails-7.1.gemfile +++ /dev/null @@ -1,5 +0,0 @@ -# frozen_string_literal: true - -eval_gemfile '../Gemfile' - -gem 'rails', '~> 7.1.0' diff --git a/gemfiles/rails-7.2.gemfile b/gemfiles/rails-7.2.gemfile deleted file mode 100644 index 6866a47a..00000000 --- a/gemfiles/rails-7.2.gemfile +++ /dev/null @@ -1,5 +0,0 @@ -# frozen_string_literal: true - -eval_gemfile '../Gemfile' - -gem 'rails', '~> 7.2.0' diff --git a/gemfiles/rails-8.0.gemfile b/gemfiles/rails-8.0.gemfile deleted file mode 100644 index cd3dbac3..00000000 --- a/gemfiles/rails-8.0.gemfile +++ /dev/null @@ -1,5 +0,0 @@ -# frozen_string_literal: true - -eval_gemfile '../Gemfile' - -gem 'rails', '~> 8.0.0' diff --git a/gemfiles/rails-main.gemfile b/gemfiles/rails-main.gemfile deleted file mode 100644 index 80b01d94..00000000 --- a/gemfiles/rails-main.gemfile +++ /dev/null @@ -1,5 +0,0 @@ -# frozen_string_literal: true - -eval_gemfile '../Gemfile' - -gem 'rails', github: 'rails/rails' From 60bed46ed12c1df6664447c6c74076d8307f50a3 Mon Sep 17 00:00:00 2001 From: Matt Muller Date: Sat, 16 Nov 2024 19:20:52 -0500 Subject: [PATCH 2/5] Fix CI --- .rubocop_todo.yml | 29 +++++++++++++++++++++++++++++ spec/spec_helper.rb | 2 +- 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 .rubocop_todo.yml diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml new file mode 100644 index 00000000..056b5aee --- /dev/null +++ b/.rubocop_todo.yml @@ -0,0 +1,29 @@ +# This configuration was generated by +# `rubocop --auto-gen-config` +# on 2024-11-17 00:20:44 UTC using RuboCop version 1.68.0. +# The point is for the user to remove these configuration records +# one by one as the offenses are removed from the code base. +# Note that changes in the inspected code, or installation of new +# versions of RuboCop, may require this file to be generated again. + +# Offense count: 3 +# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes. +Metrics/AbcSize: + Max: 21 + +# Offense count: 2 +# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns. +Metrics/MethodLength: + Max: 11 + +# Offense count: 1 +# Configuration parameters: CountComments, CountAsOne. +Metrics/ModuleLength: + Max: 215 + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns. +# URISchemes: http, https +Layout/LineLength: + Max: 130 diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index e107a91e..f75ccd14 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -6,7 +6,7 @@ Rails.application.initialize! -require 'rspec/rails' +require 'rspec' # This file was generated by the `rspec --init` command. Conventionally, all # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. From b757a96d4310647ab47cf3b9276073f434382043 Mon Sep 17 00:00:00 2001 From: Matt Muller Date: Sat, 16 Nov 2024 19:22:16 -0500 Subject: [PATCH 3/5] Fix task loading in Rakefile --- Rakefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Rakefile b/Rakefile index 97205f65..6a600e7d 100644 --- a/Rakefile +++ b/Rakefile @@ -3,7 +3,7 @@ require 'rspec/core/rake_task' require 'rubocop/rake_task' -Dir.glob('**/*.rake').each do |task_file| +Dir.glob('tasks/**/*.rake').each do |task_file| load task_file end From a1cd2a56f41a95246b62f0f2afb9073f354ca88c Mon Sep 17 00:00:00 2001 From: Matt Muller Date: Sat, 16 Nov 2024 19:44:20 -0500 Subject: [PATCH 4/5] Fix SES::RSpec symlink --- lib/aws/rails/action_mailbox/rspec.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/aws/rails/action_mailbox/rspec.rb b/lib/aws/rails/action_mailbox/rspec.rb index 2edaac8f..bcf5e554 100644 --- a/lib/aws/rails/action_mailbox/rspec.rb +++ b/lib/aws/rails/action_mailbox/rspec.rb @@ -3,8 +3,8 @@ # This can be deleted in aws-sdk-rails ~> 5 require 'aws/action_mailbox/ses/rspec' -Aws::Rails::ActionMailbox::Rspec = Aws::ActionMailbox::SES::Rspec +Aws::Rails::ActionMailbox::RSpec = Aws::ActionMailbox::SES::RSpec -Kernel.warn('Aws::Rails::ActionMailbox::Rspec is deprecated in aws-sdk-rails ~> 5. ' \ - 'Use Aws::ActionMailbox::SES::Rspec instead.') +Kernel.warn('Aws::Rails::ActionMailbox::RSpec is deprecated in aws-sdk-rails ~> 5. ' \ + 'Use Aws::ActionMailbox::SES::RSpec instead.') Kernel.warn('Please require "aws/action_mailbox/ses/rspec" instead of "aws/rails/action_mailbox/rspec"') From a5039fcb2ddeb8c17fa98e01287d0987049f1de0 Mon Sep 17 00:00:00 2001 From: Matt Muller Date: Tue, 19 Nov 2024 14:08:55 -0500 Subject: [PATCH 5/5] Update warning --- lib/aws/rails/railtie.rb | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/aws/rails/railtie.rb b/lib/aws/rails/railtie.rb index 7f39e9ec..4664f1f6 100644 --- a/lib/aws/rails/railtie.rb +++ b/lib/aws/rails/railtie.rb @@ -16,12 +16,10 @@ class Railtie < ::Rails::Railtie if %i[ses sesv2].include?(::Rails.application.config.action_mailer.delivery_method) ::Rails.logger.warn(<<~MSG) ** Aws::Rails.add_action_mailer_delivery_method will be removed in aws-sdk-rails ~> 5. - If you are using this feature, please add your desired delivery methods in an initializer - (such as config/initializers/action_mailer.rb): + In `aws-actionmailer-ses ~> 1`, configuration will be set using config settings: - options = { ... SES client options ... } - ActionMailer::Base.add_delivery_method :ses, Aws::ActionMailer::SESMailer, **options - ActionMailer::Base.add_delivery_method :ses_v2, Aws::ActionMailer::SESV2Mailer, **options + config.action_mailer.delivery_method = :ses_v2 + config.action_mailer.ses_v2_settings = { region: 'us-west-2' } Existing Mailer classes have moved namespaces but will continue to work in this major version. ** MSG