ar_mailer_aws 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 82b61c67d1d1f4cfe28d311a36f55e82bb346e78
4
- data.tar.gz: 4aa5150e3f1ec039dc2fee41d023267c36d810ff
3
+ metadata.gz: 3e5ef5bbb9f48e6714ba614f7b1dc4a9c0a44945
4
+ data.tar.gz: f36e2db8f3607aba94ad5ce1ce26eb803a4bee8a
5
5
  SHA512:
6
- metadata.gz: e7f857364b01171113bdb0766bf0b77f9299c9725da0b0703267a839d4b56cd40a6e999503060c91ff586a423aac0f0820a7aef01a284ddd7b81f5a796b51c93
7
- data.tar.gz: 1dc6fc917b265effc0e3f404e510857f37fac5da6f7e521396b8d1178d0d926b1079aba4a50f2c46db4ad0f866e087e3dce6c02becb091382a0d7dee3dd8ba9d
6
+ metadata.gz: 2508486000bc5233f392c44405e4a06f94b560f72342703d793ce2a1250a1c6fe805f130b05e61790b2b66a9ab7bf6f431e4cd094c3729fac41cfdb56762db43
7
+ data.tar.gz: b1626ae04aa537e21165abcdaa29e4a64d5e3b00dcab89873ceea9b9cbbab04d9b5dfcd4900dff702c246df244958e361aaf5880eee80d62d5277d14edb5c2f1
data/.travis.yml CHANGED
@@ -1,5 +1,4 @@
1
1
  language: ruby
2
2
 
3
3
  rvm:
4
- - 1.9.3
5
4
  - 2.0.0
data/README.md CHANGED
@@ -1,7 +1,10 @@
1
1
  # ArMailerAWS
2
2
 
3
- Daemon for sending butches of emails via Amazon Simple Email Service (Amazon SES) using ActiveRecord for storing messages
3
+ Daemon for sending butches of emails via Amazon Simple Email Service (Amazon SES) using ActiveRecord for storing messages.
4
+ ArMailerAWS handles daily quotas, maximum number of emails send per second (max send rate),
5
+ batch email sending, expiring undelivered emails.
4
6
 
7
+ [![Build Status](https://travis-ci.org/leschenko/ar_mailer_aws.png?branch=master)](https://travis-ci.org/leschenko/ar_mailer_aws)
5
8
 
6
9
  ## Installation
7
10
 
@@ -13,10 +16,6 @@ And then execute:
13
16
 
14
17
  $ bundle
15
18
 
16
- Or install it yourself as:
17
-
18
- $ gem install ar_mailer_aws
19
-
20
19
  Run generator:
21
20
 
22
21
  $ rails g ar_mailer_aws BatchEmail
@@ -25,23 +24,31 @@ Run migrations:
25
24
 
26
25
  $ rake db:migrate
27
26
 
27
+ Or install it yourself as:
28
+
29
+ $ gem install ar_mailer_aws
30
+
28
31
  ## Usage
29
32
 
30
- Edit config/initializer/ar_mailer_aws.rb and uncomment below line to use ar_mailer as default delivery method:
33
+ To use `ar_mailer_aws` as default delivery method edit `config/initializer/ar_mailer_aws.rb` and uncomment below line:
31
34
 
35
+ ```ruby
32
36
  ActionMailer::Base.delivery_method = :ar_mailer_aws
37
+ ```
33
38
 
34
- Or if you need to, you can set each mailer class delivery method individually:
39
+ If you need `ar_mailer_aws` delivery method in particular mailer:
35
40
 
41
+ ```ruby
36
42
  class MyMailer < ActionMailer::Base
37
43
  self.delivery_method = :ar_mailer_aws
38
44
  end
45
+ ```
39
46
 
40
47
  Run delivery daemon:
41
48
 
42
49
  $ bundle exec ar_mailer_aws start
43
50
 
44
- To list available options:
51
+ List available options:
45
52
 
46
53
  $ bundle exec ar_mailer_aws --help
47
54
 
@@ -8,7 +8,7 @@ Gem::Specification.new do |spec|
8
8
  spec.version = ArMailerAWS::VERSION
9
9
  spec.authors = ['Alex Leschenko']
10
10
  spec.email = %w(leschenko.al@gmail.com)
11
- spec.description = %q{Daemon for sending butches of emails via Amazon Simple Email Service (Amazon SES) using ActiveRecord for storing messages}
11
+ spec.description = %q{Daemon for sending butches of emails via Amazon SES using ActiveRecord for storing messages. Handles daily quotas, max send rate.}
12
12
  spec.summary = %q{Send butches of emails via Amazon SES}
13
13
  spec.homepage = 'https://github.com/leschenko/ar_mailer_aws'
14
14
  spec.license = 'MIT'
data/bin/ar_mailer_aws CHANGED
@@ -23,7 +23,8 @@ unless name == 'rspec'
23
23
  end
24
24
 
25
25
  options = ArMailerAWS.parse_options(ARGV)
26
- Daemons.run_proc('ar_mailer_aws') do
26
+ daemon_options = options.pid_dir ? {dir_mode: :normal, dir: options.pid_dir} : {}
27
+ Daemons.run_proc('ar_mailer_aws', daemon_options) do
27
28
  if defined? Rails
28
29
  ActiveRecord::Base.establish_connection
29
30
  Rails.logger = ActiveRecord::Base.logger = ActionMailer::Base.logger = ActiveSupport::BufferedLogger.new(Rails.root.join("log/#{Rails.env}.log"))
data/lib/ar_mailer_aws.rb CHANGED
@@ -95,6 +95,11 @@ module ArMailerAWS
95
95
  options.max_age = max_age
96
96
  end
97
97
 
98
+ opts.on('-p', '--pid-dir DIRECTORY', 'Directory for storing pid file',
99
+ 'Default: Stored in current directory (named `ar_mailer_aws.pid`)') do |pid_dir|
100
+ options.pid_dir = pid_dir
101
+ end
102
+
98
103
  opts.on('-v', '--[no-]verbose', 'Run verbosely') do |v|
99
104
  options.verbose = v
100
105
  end
@@ -1,5 +1,3 @@
1
- require 'aws-sdk'
2
-
3
1
  module ArMailerAWS
4
2
  class Sender
5
3
  attr_reader :options, :model, :ses
@@ -1,3 +1,3 @@
1
1
  module ArMailerAWS
2
- VERSION = '0.0.1'
2
+ VERSION = '0.0.2'
3
3
  end
@@ -17,7 +17,7 @@ describe ArMailerAWS do
17
17
  it 'run sender' do
18
18
  @sender.should_receive(:send_batch).twice
19
19
  begin
20
- Timeout::timeout(2) do
20
+ Timeout::timeout(1.5) do
21
21
  ArMailerAWS.run({})
22
22
  end
23
23
  rescue Timeout::Error
@@ -9,7 +9,7 @@ describe ArMailerAWS::Mailer do
9
9
 
10
10
  context 'delivering' do
11
11
  before do
12
- @mail = stub('Mail')
12
+ @mail = double('Mail')
13
13
  @mail.stub(:return_path).and_return('from@example.com')
14
14
  @mail.stub(:destinations).and_return(['to@example.com'])
15
15
  @mail.stub(:encoded).and_return('email content')
@@ -33,4 +33,8 @@ describe 'command line options parsing' do
33
33
  it 'verbose' do
34
34
  ArMailerAWS.parse_options(%w(-v)).verbose.should be_true
35
35
  end
36
+
37
+ it 'pid_dir' do
38
+ ArMailerAWS.parse_options(%w(-p tmp/pids)).pid_dir.should == 'tmp/pids'
39
+ end
36
40
  end
data/spec/spec_helper.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require 'active_record'
2
2
  require 'active_support/core_ext'
3
+ require 'aws-sdk'
3
4
  require 'ar_mailer_aws'
4
5
  require 'forgery'
5
6
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ar_mailer_aws
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Leschenko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-03 00:00:00.000000000 Z
11
+ date: 2013-11-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: daemons
@@ -136,8 +136,8 @@ dependencies:
136
136
  - - '>='
137
137
  - !ruby/object:Gem::Version
138
138
  version: '3.0'
139
- description: Daemon for sending butches of emails via Amazon Simple Email Service
140
- (Amazon SES) using ActiveRecord for storing messages
139
+ description: Daemon for sending butches of emails via Amazon SES using ActiveRecord
140
+ for storing messages. Handles daily quotas, max send rate.
141
141
  email:
142
142
  - leschenko.al@gmail.com
143
143
  executables:
@@ -187,7 +187,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
187
187
  version: '0'
188
188
  requirements: []
189
189
  rubyforge_project:
190
- rubygems_version: 2.0.3
190
+ rubygems_version: 2.0.2
191
191
  signing_key:
192
192
  specification_version: 4
193
193
  summary: Send butches of emails via Amazon SES