mq 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +20 -0
- data/README.textile +54 -0
- data/Rakefile +23 -0
- data/generators/mq/USAGE +0 -0
- data/generators/mq/mq_generator.rb +86 -0
- data/generators/mq/templates/create_email_table.rb +16 -0
- data/generators/mq/templates/email.rb +42 -0
- data/generators/mq/templates/emails_controller.rb +34 -0
- data/generators/mq/templates/spec/email_spec.rb +114 -0
- data/generators/mq/templates/spec/emails_controller_spec.rb +0 -0
- data/generators/mq/templates/spec/emails_routing_spec.rb +53 -0
- data/generators/mq/templates/views/_email.html.erb +15 -0
- data/generators/mq/templates/views/index.html.erb +22 -0
- data/init.rb +1 -0
- data/install.rb +1 -0
- data/lib/mq.rb +1 -0
- data/mq.gemspec +32 -0
- data/uninstall.rb +1 -0
- metadata +72 -0
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009 [name of plugin creator]
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.textile
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
h2. mq
|
2
|
+
|
3
|
+
A Rails gem that generates an MVC stack that does email queuing
|
4
|
+
|
5
|
+
h3. What it does
|
6
|
+
|
7
|
+
mq is a generator that generates an MVC stack for queuing emails. It has a UI too.
|
8
|
+
I got tired of dealing with crappy email queuing systems in Rails, so I wrote my own.
|
9
|
+
|
10
|
+
h3. Requirements
|
11
|
+
|
12
|
+
None.
|
13
|
+
|
14
|
+
h3. How to Install
|
15
|
+
|
16
|
+
<pre>sudo gem install mq -s http://gemcutter.com</pre>
|
17
|
+
|
18
|
+
h3. How to Use
|
19
|
+
|
20
|
+
Assuming you'd like to name your mq table @Email@, and your Mailer model is named @Notifier@
|
21
|
+
|
22
|
+
Generate the files necessary for your app:
|
23
|
+
<pre>./script/generate mq Email Notifier</pre>
|
24
|
+
|
25
|
+
mq requires your Mailer methods accept an email address as its first parameter, so a Mailer method should look like:
|
26
|
+
<pre>Notifier.send_email_method(email_address)</pre>
|
27
|
+
|
28
|
+
Of course, you can pass as many parameters as you'd like:
|
29
|
+
<pre>Notifier.send_email_method(email_address, some_object, some_other_object, ...)</pre>
|
30
|
+
|
31
|
+
Queue an email by calling @Email.queue@ with the name of your Notifier method as the first parameter, and the recipient email address as the second parameter, followed by anything else you'd like to pass.
|
32
|
+
<pre>Email.queue(:send_email_method, "matt@matt-darby.com")</pre>
|
33
|
+
|
34
|
+
You can pass multiple email addresses to the @Email.queue@ method and mq will automatically generate individual emails for the recipients.
|
35
|
+
<pre>Email.queue(:send_email_method, ["matt@matt-darby.com", "foo@bar.com"], ...)</pre>
|
36
|
+
|
37
|
+
h3. Delivery of queued email
|
38
|
+
|
39
|
+
You can create a cronjob (this on runs every five minutes)
|
40
|
+
<pre>*/5 * * * * cd /path/to/your/app && ./script/runner/Email.deliver_all</pre>
|
41
|
+
|
42
|
+
h3. How to Test
|
43
|
+
|
44
|
+
Complete Rspec specs are included automatically. Well, complete aside from view specs as you'll just change the damned things anyway.
|
45
|
+
|
46
|
+
h3. Help
|
47
|
+
|
48
|
+
Add a ticket to "MQ's Lighthouse Account":http://mdarby.lighthouseapp.com/projects/28699-mq/overview
|
49
|
+
|
50
|
+
h3. About the Author
|
51
|
+
|
52
|
+
My name is Matt Darby. I'm the Lead Web Developer and IT Manager at "Dynamix Engineering":http://dynamix-ltd.com and hold a Master's Degree in Computer Science from "Franklin University":http://franklin.edu in Columbus, OH.
|
53
|
+
|
54
|
+
Feel free to check out my "blog":http://blog.matt-darby.com or to "recommend me":http://www.workingwithrails.com/recommendation/new/person/10908-matt-darby
|
data/Rakefile
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'rake'
|
2
|
+
require 'rake/testtask'
|
3
|
+
require 'rake/rdoctask'
|
4
|
+
|
5
|
+
desc 'Default: run unit tests.'
|
6
|
+
task :default => :test
|
7
|
+
|
8
|
+
desc 'Test the mq plugin.'
|
9
|
+
Rake::TestTask.new(:test) do |t|
|
10
|
+
t.libs << 'lib'
|
11
|
+
t.libs << 'test'
|
12
|
+
t.pattern = 'test/**/*_test.rb'
|
13
|
+
t.verbose = true
|
14
|
+
end
|
15
|
+
|
16
|
+
desc 'Generate documentation for the mq plugin.'
|
17
|
+
Rake::RDocTask.new(:rdoc) do |rdoc|
|
18
|
+
rdoc.rdoc_dir = 'rdoc'
|
19
|
+
rdoc.title = 'Mq'
|
20
|
+
rdoc.options << '--line-numbers' << '--inline-source'
|
21
|
+
rdoc.rdoc_files.include('README')
|
22
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
23
|
+
end
|
data/generators/mq/USAGE
ADDED
File without changes
|
@@ -0,0 +1,86 @@
|
|
1
|
+
class MqGenerator < Rails::Generator::NamedBase
|
2
|
+
|
3
|
+
@@mailer_name = nil
|
4
|
+
|
5
|
+
def initialize(*runtime_args)
|
6
|
+
super(*runtime_args) if @@mailer_name = runtime_args[0][1]
|
7
|
+
end
|
8
|
+
|
9
|
+
def manifest
|
10
|
+
record do |m|
|
11
|
+
install_routes(m)
|
12
|
+
|
13
|
+
m.directory(File.join('app/models'))
|
14
|
+
m.directory(File.join('app/controllers'))
|
15
|
+
m.directory(File.join('app/helpers'))
|
16
|
+
m.directory(File.join('app/views'))
|
17
|
+
m.directory(File.join("app/views/#{table_name}"))
|
18
|
+
m.directory(File.join('db/migrate'))
|
19
|
+
|
20
|
+
if has_rspec?
|
21
|
+
m.directory(File.join('spec/controllers'))
|
22
|
+
m.directory(File.join('spec/models'))
|
23
|
+
m.directory(File.join('spec/helpers'))
|
24
|
+
m.directory(File.join('spec/views'))
|
25
|
+
m.directory(File.join("spec/views/#{table_name}"))
|
26
|
+
|
27
|
+
# Controllers
|
28
|
+
m.template "spec/emails_controller_spec.rb", File.join('spec/controllers', "#{table_name}_controller_spec.rb")
|
29
|
+
m.template "spec/emails_routing_spec.rb", File.join('spec/controllers', "#{table_name}_routing_spec.rb")
|
30
|
+
|
31
|
+
# Models
|
32
|
+
m.template "spec/email_spec.rb", File.join('spec/models', "#{table_name.singularize}_spec.rb")
|
33
|
+
end
|
34
|
+
|
35
|
+
# Controllers
|
36
|
+
m.template "emails_controller.rb", File.join('app/controllers', "#{table_name}_controller.rb")
|
37
|
+
|
38
|
+
# Models
|
39
|
+
m.template "email.rb", File.join('app/models', "#{table_name.singularize}.rb")
|
40
|
+
|
41
|
+
# Migrations
|
42
|
+
m.migration_template "create_email_table.rb", "db/migrate", :migration_file_name => "create_#{object_name}_table"
|
43
|
+
|
44
|
+
# Views
|
45
|
+
m.template "views/index.html.erb", File.join("app/views/#{table_name}", "index.html.erb")
|
46
|
+
m.template "views/_email.html.erb", File.join("app/views/#{table_name}", "_#{object_name}.html.erb")
|
47
|
+
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def mailer_name
|
52
|
+
@@mailer_name
|
53
|
+
end
|
54
|
+
|
55
|
+
def table_name
|
56
|
+
class_name.tableize
|
57
|
+
end
|
58
|
+
|
59
|
+
def model_name
|
60
|
+
class_name.demodulize
|
61
|
+
end
|
62
|
+
|
63
|
+
def object_name
|
64
|
+
table_name.singularize
|
65
|
+
end
|
66
|
+
|
67
|
+
def install_routes(m)
|
68
|
+
route_string = ":#{table_name}, :member => {:deliver => :get}, :collection => {:deliver_all => :get, :destroy_all => :get}"
|
69
|
+
def route_string.to_sym; to_s; end
|
70
|
+
def route_string.inspect; to_s; end
|
71
|
+
m.route_resources route_string
|
72
|
+
end
|
73
|
+
|
74
|
+
def has_rspec?
|
75
|
+
spec_dir = File.join(RAILS_ROOT, 'spec')
|
76
|
+
options[:rspec] ||= (File.exist?(spec_dir) && File.directory?(spec_dir)) unless (options[:rspec] == false)
|
77
|
+
end
|
78
|
+
|
79
|
+
|
80
|
+
protected
|
81
|
+
|
82
|
+
def banner
|
83
|
+
"Usage: #{$0} #{spec.name} ModelName MailerModelName"
|
84
|
+
end
|
85
|
+
|
86
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class CreateEmailTable < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :<%= table_name %> do |t|
|
4
|
+
t.text :tmail
|
5
|
+
t.string :mailer_method
|
6
|
+
t.integer :attempts, :default => 0
|
7
|
+
t.datetime :last_attempt_at
|
8
|
+
|
9
|
+
t.timestamps
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.down
|
14
|
+
drop_table :<%= table_name %>
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
class <%= class_name %> < ActiveRecord::Base
|
2
|
+
|
3
|
+
serialize :tmail
|
4
|
+
|
5
|
+
def self.queue(method, to, *args)
|
6
|
+
method = method.to_s if method.is_a?(Symbol)
|
7
|
+
[*to].each{|address| self.generate_mail(method, address, args)}
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.deliver_all
|
11
|
+
all.each{|m| m.deliver}
|
12
|
+
end
|
13
|
+
|
14
|
+
def to
|
15
|
+
to = tmail.to.to_s
|
16
|
+
to.blank? ? bcc : to
|
17
|
+
end
|
18
|
+
|
19
|
+
def bcc
|
20
|
+
tmail.bcc.to_s
|
21
|
+
end
|
22
|
+
|
23
|
+
def from
|
24
|
+
tmail.from.to_s
|
25
|
+
end
|
26
|
+
|
27
|
+
def deliver
|
28
|
+
if <%= mailer_name %>.deliver(tmail)
|
29
|
+
self.destroy
|
30
|
+
else
|
31
|
+
self.update_attributes({:attempts => self.attempts += 1, :last_attempt_at => Time.now})
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
def self.generate_mail(method, address, args)
|
39
|
+
create!(:mailer_method => method, :tmail => <%= mailer_name %>.send("create_#{method}".to_sym, address, *args))
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
class <%= class_name %>sController < ApplicationController
|
2
|
+
|
3
|
+
before_filter :load_items
|
4
|
+
|
5
|
+
|
6
|
+
def load_items
|
7
|
+
@<%= object_name %> = <%= class_name %>.find(params[:id]) if params[:id]
|
8
|
+
end
|
9
|
+
|
10
|
+
def index
|
11
|
+
@<%= object_name %>s = <%= class_name %>.all(:order => "created_at")
|
12
|
+
end
|
13
|
+
|
14
|
+
def deliver
|
15
|
+
@<%= object_name %>.deliver
|
16
|
+
redirect_to :back
|
17
|
+
end
|
18
|
+
|
19
|
+
def deliver_all
|
20
|
+
<%= class_name %>.deliver_all
|
21
|
+
redirect_to :back
|
22
|
+
end
|
23
|
+
|
24
|
+
def destroy
|
25
|
+
@<%= object_name %>.destroy
|
26
|
+
redirect_to :back
|
27
|
+
end
|
28
|
+
|
29
|
+
def destroy_all
|
30
|
+
<%= class_name %>.destroy_all
|
31
|
+
redirect_to :back
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
@@ -0,0 +1,114 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
2
|
+
|
3
|
+
module <%= class_name %>Attributes
|
4
|
+
def valid_attributes
|
5
|
+
{
|
6
|
+
:mailer_method => "send_some_email",
|
7
|
+
:attempts => 0,
|
8
|
+
:last_attempt_at => nil,
|
9
|
+
:created_at => Date.parse("2009-02-11"),
|
10
|
+
:updated_at => Date.parse("2009-02-11")
|
11
|
+
}
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
describe <%= class_name %> do
|
16
|
+
|
17
|
+
include <%= class_name %>Attributes
|
18
|
+
|
19
|
+
before do
|
20
|
+
@<%= object_name %> = <%= class_name %>.create!(valid_attributes)
|
21
|
+
@tmail = mock_model(TMail)
|
22
|
+
@<%= object_name %>.stub!(:tmail => @tmail)
|
23
|
+
|
24
|
+
@obj = mock("something")
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should be valid" do
|
28
|
+
@<%= object_name %>.should be_valid
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should know how to queue an <%= object_name %> with a singular recipient" do
|
32
|
+
<%= class_name %>.should_receive(:generate_mail).with("send_some_<%= object_name %>", "foo@bar.com", [@obj])
|
33
|
+
<%= class_name %>.queue("send_some_<%= object_name %>", "foo@bar.com", @obj)
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should know how to queue an <%= object_name %> with a multiple recipients" do
|
37
|
+
<%= class_name %>.should_receive(:generate_mail).with("send_some_<%= object_name %>", "foo@bar.com", [@obj])
|
38
|
+
<%= class_name %>.should_receive(:generate_mail).with("send_some_<%= object_name %>", "bar@foo.com", [@obj])
|
39
|
+
<%= class_name %>.queue("send_some_<%= object_name %>", ["foo@bar.com", "bar@foo.com"], @obj)
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should convert the method parameter to a String if its a Symbol" do
|
43
|
+
<%= class_name %>.should_receive(:generate_mail).with("send_some_<%= object_name %>", "foo@bar.com", [@obj])
|
44
|
+
<%= class_name %>.queue(:send_some_<%= object_name %>, "foo@bar.com", @obj)
|
45
|
+
end
|
46
|
+
|
47
|
+
it "should be able to deliver all queued <%= object_name %>s" do
|
48
|
+
<%= class_name %>.stub!(:all => [@<%= object_name %>])
|
49
|
+
@<%= object_name %>.should_receive(:deliver)
|
50
|
+
|
51
|
+
<%= class_name %>.deliver_all
|
52
|
+
end
|
53
|
+
|
54
|
+
it "should tell us who the <%= object_name %> is for" do
|
55
|
+
@tmail.stub!(:to => "foo@bar.com")
|
56
|
+
@<%= object_name %>.to.should == "foo@bar.com"
|
57
|
+
end
|
58
|
+
|
59
|
+
it "should tell us who the <%= object_name %> is for (via the BCC field)" do
|
60
|
+
@tmail.stub!(:to => "", :bcc => "foo@bar.com")
|
61
|
+
@<%= object_name %>.to.should == "foo@bar.com"
|
62
|
+
end
|
63
|
+
|
64
|
+
it "should tell us who the <%= object_name %> is from" do
|
65
|
+
@tmail.stub!(:from => "foo@bar.com")
|
66
|
+
@<%= object_name %>.from.should == "foo@bar.com"
|
67
|
+
end
|
68
|
+
|
69
|
+
it "should be able to deliver its self" do
|
70
|
+
@<%= object_name %>.should respond_to(:deliver)
|
71
|
+
<%= mailer_name %>.should_receive(:deliver).with(@tmail).and_return(true)
|
72
|
+
@<%= object_name %>.deliver
|
73
|
+
end
|
74
|
+
|
75
|
+
|
76
|
+
describe " when it is successfully delivered" do
|
77
|
+
before do
|
78
|
+
<%= mailer_name %>.stub!(:deliver => true)
|
79
|
+
end
|
80
|
+
|
81
|
+
it "should commit suicide" do
|
82
|
+
@<%= object_name %>.should_receive(:destroy)
|
83
|
+
@<%= object_name %>.deliver
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
describe " when it is not successfully delivered" do
|
88
|
+
before do
|
89
|
+
<%= mailer_name %>.stub!(:deliver => false)
|
90
|
+
end
|
91
|
+
|
92
|
+
it "should increment the attempts attribute" do
|
93
|
+
@<%= object_name %>.deliver
|
94
|
+
@<%= object_name %>.attempts.should == 1
|
95
|
+
end
|
96
|
+
|
97
|
+
it "should set the #last_attempt_at attribute" do
|
98
|
+
now = Time.now
|
99
|
+
Time.stub!(:now => now)
|
100
|
+
@<%= object_name %>.deliver
|
101
|
+
@<%= object_name %>.last_attempt_at.should == now
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
describe " the #generate_mail method" do
|
106
|
+
it "should create a new <%= class_name %> object" do
|
107
|
+
<%= mailer_name %>.should_receive("create_send_some_<%= object_name %>").with("foo@bar.com", @obj).and_return(@tmail)
|
108
|
+
<%= class_name %>.should_receive(:create!).with(:mailer_method => "send_some_<%= object_name %>", :tmail => @tmail)
|
109
|
+
|
110
|
+
<%= class_name %>.queue("send_some_<%= object_name %>", "foo@bar.com", @obj)
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
end
|
File without changes
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
2
|
+
|
3
|
+
describe EmailsController do
|
4
|
+
describe "route generation" do
|
5
|
+
|
6
|
+
it "should map { :controller => '<%= object_name %>s', :action => 'index' } to /<%= object_name %>s" do
|
7
|
+
route_for(:controller => "<%= object_name %>s", :action => "index").should == "/<%= object_name %>s"
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should map { :controller => '<%= object_name %>s', :action => 'destroy', :id => 1} to /<%= object_name %>s/1" do
|
11
|
+
route_for(:controller => "<%= object_name %>s", :action => "destroy", :id => 1).should == "/<%= object_name %>s/1"
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should map { :controller => '<%= object_name %>s', :action => 'destroy', :id => 1} to /<%= object_name %>s/1" do
|
15
|
+
route_for(:controller => "<%= object_name %>s", :action => "destroy", :id => 1).should == "/<%= object_name %>s/1"
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should map { :controller => '<%= object_name %>s', :action => 'deliver', :id => 1} to /<%= object_name %>s/1/deliver" do
|
19
|
+
route_for(:controller => "<%= object_name %>s", :action => "deliver", :id => 1).should == "/<%= object_name %>s/1/deliver"
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should map { :controller => '<%= object_name %>s', :action => 'deliver_all'} to /<%= object_name %>s/deliver_all" do
|
23
|
+
route_for(:controller => "<%= object_name %>s", :action => "deliver_all").should == "/<%= object_name %>s/deliver_all"
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should map { :controller => '<%= object_name %>s', :action => 'destroy_all'} to /<%= object_name %>s/destroy_all" do
|
27
|
+
route_for(:controller => "<%= object_name %>s", :action => "destroy_all").should == "/<%= object_name %>s/destroy_all"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
describe "route recognition" do
|
32
|
+
|
33
|
+
it "should generate params { :controller => '<%= object_name %>s', action => 'index' } from GET /<%= object_name %>s" do
|
34
|
+
params_from(:get, "/<%= object_name %>s").should == {:controller => "<%= object_name %>s", :action => "index"}
|
35
|
+
end
|
36
|
+
|
37
|
+
it "should generate params { :controller => '<%= object_name %>s', action => 'destroy', id => '1' } from DELETE /<%= object_name %>s/1" do
|
38
|
+
params_from(:delete, "/<%= object_name %>s/1").should == {:controller => "<%= object_name %>s", :action => "destroy", :id => "1"}
|
39
|
+
end
|
40
|
+
|
41
|
+
it "should generate params { :controller => '<%= object_name %>s', action => 'deliver', id => '1' } from GET /<%= object_name %>s/1/deliver" do
|
42
|
+
params_from(:get, "/<%= object_name %>s/1/deliver").should == {:controller => "<%= object_name %>s", :action => "deliver", :id => "1"}
|
43
|
+
end
|
44
|
+
|
45
|
+
it "should generate params { :controller => '<%= object_name %>s', action => 'deliver_all' } from GET /<%= object_name %>s/deliver_all" do
|
46
|
+
params_from(:get, "/<%= object_name %>s/deliver_all").should == {:controller => "<%= object_name %>s", :action => "deliver_all"}
|
47
|
+
end
|
48
|
+
|
49
|
+
it "should generate params { :controller => '<%= object_name %>s', action => 'destroy_all' } from GET /<%= object_name %>s/destroy_all" do
|
50
|
+
params_from(:get, "/<%= object_name %>s/destroy_all").should == {:controller => "<%= object_name %>s", :action => "destroy_all"}
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<tr id="<%%= dom_id(<%= object_name %>) %>">
|
2
|
+
<td><%%=<%= object_name %>.to %></td>
|
3
|
+
<td><%%=<%= object_name %>.mailer_method %></td>
|
4
|
+
<td><%%= time_ago_in_words(<%= object_name %>.created_at) %> ago</td>
|
5
|
+
|
6
|
+
<%% if <%= object_name %>.attempts > 0 %>
|
7
|
+
<td><%%=<%= object_name %>.attempts %></td>
|
8
|
+
<td><%%= time_ago_in_words(<%= object_name %>.last_attempt_at) %> ago</td>
|
9
|
+
<%% else %>
|
10
|
+
<td> </td>
|
11
|
+
<td> </td>
|
12
|
+
<%% end %>
|
13
|
+
|
14
|
+
<td><%%= link_to "Deliver", deliver_<%= object_name %>_path(<%= object_name %>), :method => :get %></td>
|
15
|
+
<td><%%= link_to 'Delete', <%= object_name %>_path(<%= object_name %>), :method => :delete %></td>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<h1>Queued Emails</h1>
|
2
|
+
|
3
|
+
<%% if <%= class_name %>.count > 0 %>
|
4
|
+
<%%= link_to "Deliver All", deliver_all_<%= object_name %>s_path %>
|
5
|
+
<%%= link_to "Destroy All", destroy_all_<%= object_name %>s_path, :confirm => "Are you really sure?" %>
|
6
|
+
<%% end %>
|
7
|
+
|
8
|
+
<table>
|
9
|
+
<thead>
|
10
|
+
<tr>
|
11
|
+
<th>To</th>
|
12
|
+
<th>Method</th>
|
13
|
+
<th>Created</th>
|
14
|
+
<th>Attempts</th>
|
15
|
+
<th>Last Attempt</th>
|
16
|
+
</tr>
|
17
|
+
</thead>
|
18
|
+
|
19
|
+
<tbody>
|
20
|
+
<%%= render :partial => "<%= object_name %>", :collection => @<%= object_name %>s %>
|
21
|
+
</tbody>
|
22
|
+
</table>
|
data/init.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
# Include hook code here
|
data/install.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
# Install hook code here
|
data/lib/mq.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
# Mq
|
data/mq.gemspec
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = "mq"
|
3
|
+
s.version = "0.1.2"
|
4
|
+
s.date = "2009-07-11"
|
5
|
+
s.summary = "An email queue that actually works"
|
6
|
+
s.email = "matt@matt-darby.com"
|
7
|
+
s.homepage = "http://github.com/mdarby/mq"
|
8
|
+
s.description = "A Rails gem that generates an MVC stack that does email queuing"
|
9
|
+
s.has_rdoc = false
|
10
|
+
s.authors = ["Matt Darby"]
|
11
|
+
s.files = [
|
12
|
+
"MIT-LICENSE",
|
13
|
+
"README.textile",
|
14
|
+
"Rakefile",
|
15
|
+
"generators/mq/mq_generator.rb",
|
16
|
+
"generators/mq/templates/create_email_table.rb",
|
17
|
+
"generators/mq/templates/email.rb",
|
18
|
+
"generators/mq/templates/emails_controller.rb",
|
19
|
+
"generators/mq/templates/spec/emails_routing_spec.rb",
|
20
|
+
"generators/mq/templates/spec/email_spec.rb",
|
21
|
+
"generators/mq/templates/spec/emails_controller_spec.rb",
|
22
|
+
"generators/mq/templates/views/_email.html.erb",
|
23
|
+
"generators/mq/templates/views/index.html.erb",
|
24
|
+
"generators/mq/USAGE",
|
25
|
+
"init.rb",
|
26
|
+
"install.rb",
|
27
|
+
"lib/mq.rb",
|
28
|
+
"mq.gemspec",
|
29
|
+
"uninstall.rb"
|
30
|
+
]
|
31
|
+
|
32
|
+
end
|
data/uninstall.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
# Uninstall hook code here
|
metadata
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mq
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Matt Darby
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-07-11 00:00:00 -04:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: A Rails gem that generates an MVC stack that does email queuing
|
17
|
+
email: matt@matt-darby.com
|
18
|
+
executables: []
|
19
|
+
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files: []
|
23
|
+
|
24
|
+
files:
|
25
|
+
- MIT-LICENSE
|
26
|
+
- README.textile
|
27
|
+
- Rakefile
|
28
|
+
- generators/mq/mq_generator.rb
|
29
|
+
- generators/mq/templates/create_email_table.rb
|
30
|
+
- generators/mq/templates/email.rb
|
31
|
+
- generators/mq/templates/emails_controller.rb
|
32
|
+
- generators/mq/templates/spec/emails_routing_spec.rb
|
33
|
+
- generators/mq/templates/spec/email_spec.rb
|
34
|
+
- generators/mq/templates/spec/emails_controller_spec.rb
|
35
|
+
- generators/mq/templates/views/_email.html.erb
|
36
|
+
- generators/mq/templates/views/index.html.erb
|
37
|
+
- generators/mq/USAGE
|
38
|
+
- init.rb
|
39
|
+
- install.rb
|
40
|
+
- lib/mq.rb
|
41
|
+
- mq.gemspec
|
42
|
+
- uninstall.rb
|
43
|
+
has_rdoc: true
|
44
|
+
homepage: http://github.com/mdarby/mq
|
45
|
+
licenses: []
|
46
|
+
|
47
|
+
post_install_message:
|
48
|
+
rdoc_options: []
|
49
|
+
|
50
|
+
require_paths:
|
51
|
+
- lib
|
52
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: "0"
|
57
|
+
version:
|
58
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: "0"
|
63
|
+
version:
|
64
|
+
requirements: []
|
65
|
+
|
66
|
+
rubyforge_project:
|
67
|
+
rubygems_version: 1.3.5
|
68
|
+
signing_key:
|
69
|
+
specification_version: 3
|
70
|
+
summary: An email queue that actually works
|
71
|
+
test_files: []
|
72
|
+
|