Skip to content

Commit

Permalink
Move background jobs to the 'jobs' branch until fully baked. Not ship…
Browse files Browse the repository at this point in the history
…ping with Rails 4.0.
  • Loading branch information
jeremy committed Dec 22, 2012
1 parent 10c0a3b commit f9da785
Show file tree
Hide file tree
Showing 25 changed files with 4 additions and 724 deletions.
2 changes: 0 additions & 2 deletions actionmailer/CHANGELOG.md
Expand Up @@ -28,8 +28,6 @@

* Raise an `ActionView::MissingTemplate` exception when no implicit template could be found. *Damien Mathieu*

* Asynchronously send messages via the Rails Queue *Brian Cardarella*

* Allow callbacks to be defined in mailers similar to `ActionController::Base`. You can configure default
settings, headers, attachments, delivery settings or change delivery using
`before_filter`, `after_filter` etc. *Justin S. Leitgeb*
Expand Down
1 change: 0 additions & 1 deletion actionmailer/lib/action_mailer.rb
Expand Up @@ -44,5 +44,4 @@ module ActionMailer
autoload :MailHelper
autoload :TestCase
autoload :TestHelper
autoload :QueuedMessage
end
11 changes: 2 additions & 9 deletions actionmailer/lib/action_mailer/base.rb
@@ -1,10 +1,8 @@
require 'mail'
require 'action_mailer/queued_message'
require 'action_mailer/collector'
require 'active_support/core_ext/string/inflections'
require 'active_support/core_ext/hash/except'
require 'active_support/core_ext/module/anonymous'
require 'active_support/queueing'
require 'action_mailer/log_subscriber'

module ActionMailer
Expand Down Expand Up @@ -361,8 +359,6 @@ module ActionMailer
#
# * <tt>deliveries</tt> - Keeps an array of all the emails sent out through the Action Mailer with
# <tt>delivery_method :test</tt>. Most useful for unit and functional testing.
#
# * <tt>queue</> - The queue that will be used to deliver the mail. The queue should expect a job that responds to <tt>run</tt>.
class Base < AbstractController::Base
include DeliveryMethods
abstract!
Expand All @@ -389,9 +385,6 @@ class Base < AbstractController::Base
parts_order: [ "text/plain", "text/enriched", "text/html" ]
}.freeze

class_attribute :queue
self.queue = ActiveSupport::SynchronousQueue.new

class << self
# Register one or more Observers which will be notified when mail is delivered.
def register_observers(*observers)
Expand Down Expand Up @@ -483,8 +476,8 @@ def set_payload_for_mail(payload, mail) #:nodoc:
end

def method_missing(method_name, *args)
if action_methods.include?(method_name.to_s)
QueuedMessage.new(queue, self, method_name, *args)
if respond_to?(method_name)
new(method_name, *args).message
else
super
end
Expand Down
37 changes: 0 additions & 37 deletions actionmailer/lib/action_mailer/queued_message.rb

This file was deleted.

2 changes: 0 additions & 2 deletions actionmailer/lib/action_mailer/railtie.rb
Expand Up @@ -19,8 +19,6 @@ class Railtie < Rails::Railtie # :nodoc:
options.javascripts_dir ||= paths["public/javascripts"].first
options.stylesheets_dir ||= paths["public/stylesheets"].first

options.queue ||= app.queue

# make sure readers methods get compiled
options.asset_host ||= app.config.asset_host
options.relative_url_root ||= app.config.relative_url_root
Expand Down
1 change: 0 additions & 1 deletion actionmailer/test/abstract_unit.rb
Expand Up @@ -11,7 +11,6 @@
require 'minitest/autorun'
require 'action_mailer'
require 'action_mailer/test_case'
require 'active_support/queueing'

silence_warnings do
# These external dependencies have warnings :/
Expand Down
13 changes: 0 additions & 13 deletions actionmailer/test/base_test.rb
Expand Up @@ -3,13 +3,11 @@
require 'set'

require 'action_dispatch'
require 'active_support/queueing'
require 'active_support/time'

require 'mailers/base_mailer'
require 'mailers/proc_mailer'
require 'mailers/asset_mailer'
require 'mailers/async_mailer'

class BaseTest < ActiveSupport::TestCase
def teardown
Expand Down Expand Up @@ -422,17 +420,6 @@ def teardown
assert_equal(1, BaseMailer.deliveries.length)
end

test "delivering message asynchronously" do
AsyncMailer.delivery_method = :test
AsyncMailer.deliveries.clear

AsyncMailer.welcome.deliver
assert_equal 0, AsyncMailer.deliveries.length

AsyncMailer.queue.drain
assert_equal 1, AsyncMailer.deliveries.length
end

test "calling deliver, ActionMailer should yield back to mail to let it call :do_delivery on itself" do
mail = Mail::Message.new
mail.expects(:do_delivery).once
Expand Down
3 changes: 0 additions & 3 deletions actionmailer/test/mailers/async_mailer.rb

This file was deleted.

10 changes: 0 additions & 10 deletions actionpack/test/controller/assert_select_test.rb
Expand Up @@ -10,16 +10,6 @@
require 'action_mailer'
ActionMailer::Base.view_paths = FIXTURE_LOAD_PATH

class SynchronousQueue < Queue
def push(job)
job.run
end
alias << push
alias enq push
end

ActionMailer::Base.queue = SynchronousQueue.new

class AssertSelectTest < ActionController::TestCase
Assertion = ActiveSupport::TestCase::Assertion

Expand Down
105 changes: 0 additions & 105 deletions activesupport/lib/active_support/queueing.rb

This file was deleted.

27 changes: 0 additions & 27 deletions activesupport/test/queueing/synchronous_queue_test.rb

This file was deleted.

0 comments on commit f9da785

Please sign in to comment.