mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Add frozen_string_literal: true to match Rails codebase
This commit is contained in:
parent
af7d237002
commit
4412ca6dac
51 changed files with 102 additions and 0 deletions
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# The base class for all Active Mailbox ingress controllers.
|
||||
class ActionMailbox::BaseController < ActionController::Base
|
||||
skip_forgery_protection
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# Ingests inbound emails from Amazon's Simple Email Service (SES).
|
||||
#
|
||||
# Requires the full RFC 822 message in the +content+ parameter. Authenticates requests by validating their signatures.
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# Ingests inbound emails from Mailgun. Requires the following parameters:
|
||||
#
|
||||
# - +body-mime+: The full RFC 822 message
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# Ingests inbound emails from Mandrill.
|
||||
#
|
||||
# Requires a +mandrill_events+ parameter containing a JSON array of Mandrill inbound email event objects.
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# Ingests inbound emails relayed from Postfix.
|
||||
#
|
||||
# Authenticates requests using HTTP basic access authentication. The username is always +actionmailbox+, and the
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# Ingests inbound emails from SendGrid. Requires an +email+ parameter containing a full RFC 822 message.
|
||||
#
|
||||
# Authenticates requests using HTTP basic access authentication. The username is always +actionmailbox+, and the
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class Rails::Conductor::ActionMailbox::InboundEmailsController < Rails::Conductor::BaseController
|
||||
def index
|
||||
@inbound_emails = ActionMailbox::InboundEmail.order(created_at: :desc)
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# Rerouting will run routing and processing on an email that has already been, or attempted to be, processed.
|
||||
class Rails::Conductor::ActionMailbox::ReroutesController < Rails::Conductor::BaseController
|
||||
def create
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# TODO: Move this to Rails::Conductor gem
|
||||
class Rails::Conductor::BaseController < ActionController::Base
|
||||
layout "rails/conductor"
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# You can configure when this `IncinerationJob` will be run as a time-after-processing using the
|
||||
# `config.action_mailbox.incinerate_after` or `ActionMailbox.incinerate_after` setting.
|
||||
#
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# Routing a new InboundEmail is an asynchronous operation, which allows the ingress controllers to quickly
|
||||
# accept new incoming emails without being burdened to hang while they're actually being processed.
|
||||
class ActionMailbox::RoutingJob < ActiveJob::Base
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require "mail"
|
||||
|
||||
# The `InboundEmail` is an Active Record that keeps a reference to the raw email stored in Active Storage
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# Ensure that the `InboundEmail` is automatically scheduled for later incineration if the status has been
|
||||
# changed to `processed`. The later incineration will be invoked at the time specified by the
|
||||
# `ActionMailbox.incinerate_after` time using the `IncinerationJob`.
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# Command class for carrying out the actual incineration of the `InboundMail` that's been scheduled
|
||||
# for removal. Before the incineration – which really is just a call to `#destroy!` – is run, we verify
|
||||
# that it's both eligible (by virtue of having already been processed) and time to do so (that is,
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# The `Message-ID` as specified by rfc822 is supposed to be a unique identifier for that individual email.
|
||||
# That makes it an ideal tracking token for debugging and forensics, just like `X-Request-Id` does for
|
||||
# web request.
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# A newly received `InboundEmail` will not be routed synchronously as part of ingress controller's receival.
|
||||
# Instead, the routing will be done asynchronously, using a `RoutingJob`, to ensure maximum parallel capacity.
|
||||
#
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require "action_mailbox/engine"
|
||||
require "action_mailbox/mail_ext"
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require "active_support/rescuable"
|
||||
|
||||
require "action_mailbox/callbacks"
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require "active_support/callbacks"
|
||||
|
||||
module ActionMailbox
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require "rails/engine"
|
||||
|
||||
module ActionMailbox
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require "mail"
|
||||
|
||||
# The hope is to upstream most of these basic additions to the Mail gem's Mail object. But until then, here they lay!
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class Mail::Address
|
||||
def ==(other_address)
|
||||
other_address.is_a?(Mail::Address) && to_s == other_address.to_s
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class Mail::Address
|
||||
def self.wrap(address)
|
||||
address.is_a?(Mail::Address) ? address : Mail::Address.new(address)
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class Mail::Message
|
||||
def from_address
|
||||
header[:from]&.address_list&.addresses&.first
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module Mail
|
||||
def self.from_source(source)
|
||||
Mail.new Mail::Utilities.binary_unsafe_to_crlf(source.to_s)
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class Mail::Message
|
||||
def recipients
|
||||
Array(to) + Array(cc) + Array(bcc) + Array(header[:x_original_to]).map(&:to_s)
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# Encapsulates the routes that live on the ApplicationMailbox and performs the actual routing when
|
||||
# an inbound_email is received.
|
||||
class ActionMailbox::Router
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# Encapsulates a route, which can then be matched against an inbound_email and provide a lookup of the matching
|
||||
# mailbox class. See examples for the different route addresses and how to use them in the `ActionMailbox::Base`
|
||||
# documentation.
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module ActionMailbox
|
||||
# See `ActionMailbox::Base` for how to specify routing.
|
||||
module Routing
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require "action_mailbox/test_helper"
|
||||
require "active_support/test_case"
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require "mail"
|
||||
|
||||
module ActionMailbox
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module ActionMailbox
|
||||
VERSION = '0.1.0'
|
||||
end
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class ApplicationMailbox < ActionMailbox::Base
|
||||
# route /something/i => :somewhere
|
||||
end
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require "test_helper"
|
||||
|
||||
ActionMailbox::Ingresses::Amazon::InboundEmailsController.verifier =
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require "test_helper"
|
||||
|
||||
ENV["MAILGUN_INGRESS_API_KEY"] = "tbsy84uSV1Kt3ZJZELY2TmShPRs91E3yL4tzf96297vBCkDWgL"
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require "test_helper"
|
||||
|
||||
ENV["MANDRILL_INGRESS_API_KEY"] = "1l9Qf7lutEf7h73VXfBwhw"
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require "test_helper"
|
||||
|
||||
class ActionMailbox::Ingresses::Postfix::InboundEmailsControllerTest < ActionDispatch::IntegrationTest
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require "test_helper"
|
||||
|
||||
class ActionMailbox::Ingresses::Sendgrid::InboundEmailsControllerTest < ActionDispatch::IntegrationTest
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
ENV["RAILS_ENV"] = "test"
|
||||
ENV["RAILS_INBOUND_EMAIL_PASSWORD"] = "tbsy84uSV1Kt3ZJZELY2TmShPRs91E3yL4tzf96297vBCkDWgL"
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require_relative '../../test_helper'
|
||||
|
||||
class ActionMailbox::InboundEmail::IncinerationTest < ActiveSupport::TestCase
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require_relative '../../test_helper'
|
||||
|
||||
class ActionMailbox::InboundEmail::MessageIdTest < ActiveSupport::TestCase
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require_relative '../test_helper'
|
||||
|
||||
module ActionMailbox
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require_relative '../../test_helper'
|
||||
|
||||
module MailExt
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require_relative '../../test_helper'
|
||||
|
||||
module MailExt
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require_relative '../../test_helper'
|
||||
|
||||
module MailExt
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require_relative '../../test_helper'
|
||||
|
||||
class BouncingWithReplyMailbox < ActionMailbox::Base
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require_relative '../../test_helper'
|
||||
|
||||
class CallbackMailbox < ActionMailbox::Base
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require_relative '../../test_helper'
|
||||
|
||||
class ApplicationMailbox < ActionMailbox::Base
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require_relative '../../test_helper'
|
||||
|
||||
class SuccessfulMailbox < ActionMailbox::Base
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require_relative '../test_helper'
|
||||
|
||||
require 'action_mailbox/postfix_relayer'
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require_relative '../test_helper'
|
||||
|
||||
class RootMailbox < ActionMailbox::Base
|
||||
|
|
Loading…
Reference in a new issue