Skip to content

Commit

Permalink
Relocate ActionMailbox (#162)
Browse files Browse the repository at this point in the history
  • Loading branch information
mullermp authored Nov 14, 2024
1 parent 06b4bd1 commit 122eb2a
Show file tree
Hide file tree
Showing 52 changed files with 262 additions and 1,012 deletions.
17 changes: 12 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,30 @@ jobs:
fail-fast: false
matrix:
ruby: [2.7, '3.0', 3.1, 3.2, 3.3, jruby-9.4]
rails: [7.1, 7.2, main]
rails: [7.1, 7.2, '8.0', main]

exclude:
# Rails 7.2 dropped support for older rubygems
# Rails 7.2 is Ruby >= 3.1
- rails: 7.2
ruby: 2.7
- rails: 7.2
ruby: 3.0
# Rails 8.0 is Ruby >= 3.2
- rails: '8.0'
ruby: 2.7
- rails: '8.0'
ruby: 3.0
- rails: '8.0'
ruby: 3.1
- rails: '8.0'
ruby: jruby-9.4
# Rails main is Ruby >= 3.2
- rails: main
ruby: 2.7
- rails: main
ruby: 3.0
- rails: main
ruby: 3.1
# JDBC adapters don't support the latest Rails
- rails: 7.2
ruby: jruby-9.4
- rails: main
ruby: jruby-9.4

Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ Unreleased Changes

* Issue - Add deprecation warning to `Aws::Rails.add_action_mailer_delivery_method` to instead use `ActionMailer::Base.add_delivery_method`. This method will be removed in the next major version.

* Feature - ActionMailbox SES ingress now lives in the `aws-actionmailbox-ses` gem.

* Issue - The `Aws::Rails::ActionMailbox::RSpec` module has been moved to `Aws::ActionMailbox::SES::RSpec` and will be removed in aws-sdk-rails ~> 5.

4.1.0 (2024-09-27)
------------------

Expand Down
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ 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'

group :development, :test do
Expand Down
47 changes: 24 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,30 @@ In your environment configuration, set the delivery method to
config.action_mailer.delivery_method = :ses # or :ses_v2
```

## Amazon Simple Email Service (SES) as an ActionMailbox Method
### Using ARNs with SES

This gem uses [\`Aws::SES::Client#send_raw_email\`](https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/SES/Client.html#send_raw_email-instance_method)
and [\`Aws::SESV2::Client#send_email\`](https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/SESV2/Client.html#send_email-instance_method)
to send emails. This operation allows you to specify a cross-account identity
for the email's Source, From, and Return-Path. To set these ARNs, use any of the
following headers on your `Mail::Message` object returned by your Mailer class:

* X-SES-SOURCE-ARN

* X-SES-FROM-ARN

* X-SES-RETURN-PATH-ARN

Example:

```
# in your Rails controller
message = MyMailer.send_email(options)
message['X-SES-FROM-ARN'] = 'arn:aws:ses:us-west-2:012345678910:identity/[email protected]'
message.deliver
```

## Amazon Simple Email Service (SES) as an ActionMailbox Ingress

### Configuration

Expand Down Expand Up @@ -307,28 +330,6 @@ You may also pass the following keyword arguments to both helpers:
* `topic`: The _SNS_ topic used for each notification (default: `topic:arn:default`).
* `authentic`: The `Aws::SNS::MessageVerifier` class is stubbed by these helpers; set `authentic` to `true` or `false` to define how it will verify incoming notifications (default: `true`).

### Using ARNs with SES

This gem uses [\`Aws::SES::Client#send_raw_email\`](https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/SES/Client.html#send_raw_email-instance_method)
and [\`Aws::SESV2::Client#send_email\`](https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/SESV2/Client.html#send_email-instance_method)
to send emails. This operation allows you to specify a cross-account identity
for the email's Source, From, and Return-Path. To set these ARNs, use any of the
following headers on your `Mail::Message` object returned by your Mailer class:

* X-SES-SOURCE-ARN

* X-SES-FROM-ARN

* X-SES-RETURN-PATH-ARN

Example:

```
# in your Rails controller
message = MyMailer.send_email(options)
message['X-SES-FROM-ARN'] = 'arn:aws:ses:us-west-2:012345678910:identity/[email protected]'
message.deliver
```

## Active Support Notifications for AWS SDK calls

Expand Down
13 changes: 1 addition & 12 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ require 'rspec/core/rake_task'
require 'rake/testtask'
require 'rubocop/rake_task'

$REPO_ROOT = File.dirname(__FILE__)
$VERSION = ENV['VERSION'] || File.read(File.join($REPO_ROOT, 'VERSION')).strip

Dir.glob('**/*.rake').each do |task_file|
load task_file
end
Expand All @@ -24,14 +21,6 @@ Rake::TestTask.new('test:rails') do |t|
t.warning = false
end

task :db_migrate do
Dir.chdir('spec/dummy') do
version = ENV.delete('VERSION') # ActiveRecord uses this
`RAILS_ENV=test rake -I ../../lib db:migrate`
ENV['VERSION'] = version
end
end

task test: [:db_migrate, :spec, 'test:rails']
task test: [:spec, 'test:rails']
task default: :test
task 'release:test' => :test

This file was deleted.

6 changes: 2 additions & 4 deletions aws-sdk-rails.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,18 @@ Gem::Specification.new do |spec|
spec.description = 'Integrates the AWS SDK for Ruby with Ruby on Rails'
spec.homepage = 'https://github.com/aws/aws-sdk-rails'
spec.license = 'Apache-2.0'
spec.files = Dir['LICENSE.txt', 'CHANGELOG.md', 'VERSION', 'lib/**/*', 'bin/*', 'app/**/*', 'config/*']
spec.files = Dir['LICENSE.txt', 'CHANGELOG.md', 'VERSION', 'lib/**/*', 'bin/*']
spec.executables = ['aws_sqs_active_job']

# These will be removed in aws-sdk-rails ~> 5
spec.add_dependency('aws-actiondispatch-dynamodb', '~> 0')
spec.add_dependency('aws-actionmailbox-ses', '~> 0')
spec.add_dependency('aws-actionmailer-ses', '~> 0')
spec.add_dependency('aws-record', '~> 2') # for Aws::Record integration

# Require these versions for user_agent_framework configs
spec.add_dependency('aws-sdk-s3', '~> 1', '>= 1.123.0')
spec.add_dependency('aws-sdk-sns', '~> 1', '>= 1.61.0') # for ActionMailbox
spec.add_dependency('aws-sdk-sqs', '~> 1', '>= 1.56.0') # for ActiveJob

spec.add_dependency('actionmailbox', '>= 7.1.0') # for SES ActionMailbox
spec.add_dependency('concurrent-ruby', '~> 1.3', '>= 1.3.1') # Utilities for concurrent processing
spec.add_dependency('railties', '>= 7.1.0') # Minimum supported Rails version

Expand Down
8 changes: 0 additions & 8 deletions config/routes.rb

This file was deleted.

16 changes: 0 additions & 16 deletions gemfiles/rails-7.1.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,3 @@
eval_gemfile '../Gemfile'

gem 'rails', '~> 7.1.0'

group :test do
# JDBC versions track Rails versions
gem 'activerecord-jdbc-adapter', '~> 71.0',
platform: :jruby,
# this is not published for some reason
git: 'https://github.com/jruby/activerecord-jdbc-adapter',
glob: 'activerecord-jdbc-adapter.gemspec'
gem 'activerecord-jdbcsqlite3-adapter', '~> 71.0',
platform: :jruby,
# this is not published for some reason
git: 'https://github.com/jruby/activerecord-jdbc-adapter',
glob: 'activerecord-jdbcsqlite3-adapter/activerecord-jdbcsqlite3-adapter.gemspec'
# last supported version of sqlite3 for minimum ruby
gem 'sqlite3', '~> 1.6.0', platform: :ruby
end
16 changes: 0 additions & 16 deletions gemfiles/rails-7.2.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,3 @@
eval_gemfile '../Gemfile'

gem 'rails', '~> 7.2.0'

group :test do
# JDBC versions track Rails versions
gem 'activerecord-jdbc-adapter', '~> 71.0',
platform: :jruby,
# this is not published for some reason
git: 'https://github.com/jruby/activerecord-jdbc-adapter',
glob: 'activerecord-jdbc-adapter.gemspec'
gem 'activerecord-jdbcsqlite3-adapter', '~> 71.0',
platform: :jruby,
# this is not published for some reason
git: 'https://github.com/jruby/activerecord-jdbc-adapter',
glob: 'activerecord-jdbcsqlite3-adapter/activerecord-jdbcsqlite3-adapter.gemspec'
# last supported version of sqlite3 for minimum ruby
gem 'sqlite3', '~> 1.6.0', platform: :ruby
end
5 changes: 5 additions & 0 deletions gemfiles/rails-8.0.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# frozen_string_literal: true

eval_gemfile '../Gemfile'

gem 'rails', '~> 8.0.0'
15 changes: 0 additions & 15 deletions gemfiles/rails-main.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,3 @@
eval_gemfile '../Gemfile'

gem 'rails', github: 'rails/rails'

group :test do
# JDBC versions track Rails versions
gem 'activerecord-jdbc-adapter', '~> 71.0',
platform: :jruby,
# this is not published for some reason
git: 'https://github.com/jruby/activerecord-jdbc-adapter',
glob: 'activerecord-jdbc-adapter.gemspec'
gem 'activerecord-jdbcsqlite3-adapter', '~> 71.0',
platform: :jruby,
# this is not published for some reason
git: 'https://github.com/jruby/activerecord-jdbc-adapter',
glob: 'activerecord-jdbcsqlite3-adapter/activerecord-jdbcsqlite3-adapter.gemspec'
gem 'sqlite3', platform: :ruby
end
2 changes: 1 addition & 1 deletion lib/aws-sdk-rails.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# frozen_string_literal: true

require_relative 'aws/rails/railtie'
require_relative 'aws/rails/action_mailbox/engine'
require_relative 'aws/rails/notifications'
require_relative 'aws/rails/sqs_active_job'
require_relative 'aws/rails/middleware/ebs_sqs_active_job_middleware'

# remove this in aws-sdk-rails 5
require 'aws-actiondispatch-dynamodb'
require 'aws-actionmailbox-ses' if defined?(ActionMailbox::Engine)
require 'aws-actionmailer-ses'

module Aws
Expand Down
21 changes: 0 additions & 21 deletions lib/aws/rails/action_mailbox/engine.rb

This file was deleted.

Loading

0 comments on commit 122eb2a

Please sign in to comment.