adzap-ar_mailer 2.1.2 → 2.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,10 @@
1
+ = 2.1.3
2
+
3
+ * Tests now pass on gem install
4
+ * Removed deprecated ActionMailer::ARMailer class
5
+ * Bugs fixed
6
+ * Fixed issue with pre-loading ActionMailer. No use ActionMailer::Base.email_class directly rather than store in ARSendmail instance var so no need to pre-load ActionMailer.
7
+
1
8
  = 2.1.2
2
9
 
3
10
  * Bugs fixed
data/Rakefile CHANGED
@@ -16,8 +16,8 @@ ar_mailer_gemspec = Gem::Specification.new do |s|
16
16
  s.description = %q{Even delivering email to the local machine may take too long when you have to send hundreds of messages. ar_mailer allows you to store messages into the database for later delivery by a separate process, ar_sendmail.}
17
17
  s.email = %q{adam.meehan@gmail.com}
18
18
  s.executables = ["ar_sendmail"]
19
- s.extra_rdoc_files = ["History.txt", "LICENSE.txt", "Manifest.txt", "README.rdoc"]
20
- s.files = ["History.txt", "LICENSE.txt", "Manifest.txt", "README.rdoc", "Rakefile", "bin/ar_sendmail", "generators/ar_mailer/ar_mailer_generator.rb", "generators/ar_mailer/templates/migration.rb", "generators/ar_mailer/templates/model.rb", "lib/action_mailer/ar_mailer.rb", "lib/action_mailer/ar_sendmail.rb", "lib/smtp_tls.rb", "share/bsd/ar_sendmail", "share/linux/ar_sendmail", "share/linux/ar_sendmail.conf", "test/resources/action_mailer.rb", "test/test_armailer.rb", "test/test_arsendmail.rb", "test/test_helper.rb"]
19
+ s.extra_rdoc_files = ["History.txt", "LICENSE.txt", "README.rdoc"]
20
+ s.files = ["History.txt", "LICENSE.txt", "README.rdoc", "Rakefile", "bin/ar_sendmail", "generators/ar_mailer/ar_mailer_generator.rb", "generators/ar_mailer/templates/migration.rb", "generators/ar_mailer/templates/model.rb", "lib/action_mailer/ar_mailer.rb", "lib/action_mailer/ar_sendmail.rb", "lib/smtp_tls.rb", "share/bsd/ar_sendmail", "share/linux/ar_sendmail", "share/linux/ar_sendmail.conf", "test/resources/action_mailer.rb", "test/test_armailer.rb", "test/test_arsendmail.rb", "test/test_helper.rb"]
21
21
  s.has_rdoc = true
22
22
  s.homepage = %q{http://github.com/adzap/ar_mailer}
23
23
  s.rdoc_options = ["--main", "README.rdoc"]
@@ -31,20 +31,16 @@ Rake::GemPackageTask.new(ar_mailer_gemspec) do |pkg|
31
31
  pkg.gem_spec = ar_mailer_gemspec
32
32
  end
33
33
 
34
- namespace :gem do
35
- namespace :spec do
36
- desc "Update ar_mailer.gemspec"
37
- task :generate do
38
- File.open("ar_mailer.gemspec", "w") do |f|
39
- f.puts(ar_mailer_gemspec.to_ruby)
40
- end
41
- end
34
+ desc "Update ar_mailer.gemspec"
35
+ task :make_spec do
36
+ File.open("ar_mailer.gemspec", "w") do |f|
37
+ f.puts(ar_mailer_gemspec.to_ruby)
42
38
  end
43
39
  end
44
40
 
45
41
  desc "Build packages and install"
46
42
  task :install => :package do
47
- sh %{sudo gem install --local pkg/ar_mailer-#{ActionMailer::ARSendmail::VERSION}}
43
+ sh %{sudo gem install --local --test pkg/ar_mailer-#{ActionMailer::ARSendmail::VERSION}}
48
44
  end
49
45
 
50
46
  desc 'Default: run unit tests.'
@@ -1,18 +1,8 @@
1
- require 'action_mailer'
2
-
3
1
  ##
4
2
  # Adds sending email through an ActiveRecord table as a delivery method for
5
3
  # ActionMailer.
6
4
  #
7
5
 
8
- class ActionMailer::ARMailer < ActionMailer::Base
9
-
10
- def self.inherited(sub)
11
- logger.warn('The ActionMailer::ARMailer class has been deprecated. Will be removed in version 2.1. Just use ActionMailer::Base.')
12
- end
13
-
14
- end
15
-
16
6
  class ActionMailer::Base
17
7
 
18
8
  ##
@@ -2,8 +2,6 @@ require 'optparse'
2
2
  require 'net/smtp'
3
3
  require 'smtp_tls' unless Net::SMTP.instance_methods.include?("enable_starttls_auto")
4
4
  require 'rubygems'
5
- require 'action_mailer'
6
- require 'action_mailer/ar_mailer'
7
5
 
8
6
  ##
9
7
  # Hack in RSET
@@ -38,12 +36,14 @@ end
38
36
  # * --daemon
39
37
  # * --mailq
40
38
 
39
+ module ActionMailer; end
40
+
41
41
  class ActionMailer::ARSendmail
42
42
 
43
43
  ##
44
44
  # The version of ActionMailer::ARSendmail you are running.
45
45
 
46
- VERSION = '2.1.2'
46
+ VERSION = '2.1.3'
47
47
 
48
48
  ##
49
49
  # Maximum number of times authentication will be consecutively retried
@@ -70,10 +70,6 @@ class ActionMailer::ARSendmail
70
70
 
71
71
  attr_accessor :verbose
72
72
 
73
- ##
74
- # ActiveRecord class that holds emails
75
-
76
- attr_reader :email_class
77
73
 
78
74
  ##
79
75
  # True if only one delivery attempt will be made per call to run
@@ -337,7 +333,6 @@ class ActionMailer::ARSendmail
337
333
 
338
334
  @batch_size = options[:BatchSize]
339
335
  @delay = options[:Delay]
340
- @email_class = ActionMailer::Base.email_class
341
336
  @once = options[:Once]
342
337
  @verbose = options[:Verbose]
343
338
  @max_age = options[:MaxAge]
@@ -353,7 +348,7 @@ class ActionMailer::ARSendmail
353
348
  return if @max_age == 0
354
349
  timeout = Time.now - @max_age
355
350
  conditions = ['last_send_attempt > 0 and created_on < ?', timeout]
356
- mail = @email_class.destroy_all conditions
351
+ mail = ActionMailer::Base.email_class.destroy_all conditions
357
352
 
358
353
  log "expired #{mail.length} emails from the queue"
359
354
  end
@@ -432,7 +427,7 @@ class ActionMailer::ARSendmail
432
427
  def find_emails
433
428
  options = { :conditions => ['last_send_attempt < ?', Time.now.to_i - 300] }
434
429
  options[:limit] = batch_size unless batch_size.nil?
435
- mail = @email_class.find :all, options
430
+ mail = ActionMailer::Base.email_class.find :all, options
436
431
 
437
432
  log "found #{mail.length} emails to send"
438
433
  mail
@@ -73,7 +73,6 @@ Last send attempt: Thu Aug 10 11:40:05 %s 2006
73
73
  @sm = ActionMailer::ARSendmail.new
74
74
 
75
75
  assert_equal 60, @sm.delay
76
- assert_equal Email, @sm.email_class
77
76
  assert_equal nil, @sm.once
78
77
  assert_equal nil, @sm.verbose
79
78
  assert_equal nil, @sm.batch_size
@@ -82,19 +81,9 @@ Last send attempt: Thu Aug 10 11:40:05 %s 2006
82
81
  :Once => true, :BatchSize => 1000
83
82
 
84
83
  assert_equal 75, @sm.delay
85
- assert_equal Email, @sm.email_class
86
84
  assert_equal true, @sm.once
87
85
  assert_equal true, @sm.verbose
88
86
  assert_equal 1000, @sm.batch_size
89
-
90
- ActionMailer::Base.email_class = Newsletter
91
- @sm = ActionMailer::ARSendmail.new
92
-
93
- assert_equal 60, @sm.delay
94
- assert_equal Newsletter, @sm.email_class
95
- assert_equal nil, @sm.once
96
- assert_equal nil, @sm.verbose
97
- assert_equal nil, @sm.batch_size
98
87
  end
99
88
 
100
89
  def test_class_parse_args_batch_size
data/test/test_helper.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  require 'test/unit'
2
2
  require 'rubygems'
3
3
  require 'active_support'
4
- require 'resources/action_mailer'
4
+ require 'test/resources/action_mailer'
5
5
  require 'minitest/autorun'
6
6
  require 'mocha'
7
7
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: adzap-ar_mailer
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.2
4
+ version: 2.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Hodel
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2009-06-30 00:00:00 -07:00
13
+ date: 2009-07-06 00:00:00 -07:00
14
14
  default_executable: ar_sendmail
15
15
  dependencies: []
16
16
 
@@ -23,12 +23,10 @@ extensions: []
23
23
  extra_rdoc_files:
24
24
  - History.txt
25
25
  - LICENSE.txt
26
- - Manifest.txt
27
26
  - README.rdoc
28
27
  files:
29
28
  - History.txt
30
29
  - LICENSE.txt
31
- - Manifest.txt
32
30
  - README.rdoc
33
31
  - Rakefile
34
32
  - bin/ar_sendmail
data/Manifest.txt DELETED
@@ -1,15 +0,0 @@
1
- History.txt
2
- LICENSE.txt
3
- Manifest.txt
4
- README.txt
5
- Rakefile
6
- bin/ar_sendmail
7
- lib/action_mailer/ar_mailer.rb
8
- lib/action_mailer/ar_sendmail.rb
9
- lib/smtp_tls.rb
10
- share/bsd/ar_sendmail
11
- share/linux/ar_sendmail
12
- share/linux/ar_sendmail.conf
13
- test/action_mailer.rb
14
- test/test_armailer.rb
15
- test/test_arsendmail.rb