mq 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,5 @@
1
+ README.rdoc
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
@@ -0,0 +1,21 @@
1
+ ## MAC OS
2
+ .DS_Store
3
+
4
+ ## TEXTMATE
5
+ *.tmproj
6
+ tmtags
7
+
8
+ ## EMACS
9
+ *~
10
+ \#*
11
+ .\#*
12
+
13
+ ## VIM
14
+ *.swp
15
+
16
+ ## PROJECT::GENERAL
17
+ coverage
18
+ rdoc
19
+ pkg
20
+
21
+ ## PROJECT::SPECIFIC
@@ -1,4 +1,4 @@
1
- Copyright (c) 2009 [name of plugin creator]
1
+ Copyright (c) 2009 Matt Darby
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
@@ -0,0 +1,18 @@
1
+ = mq
2
+
3
+ Description goes here.
4
+
5
+ == Note on Patches/Pull Requests
6
+
7
+ * Fork the project.
8
+ * Make your feature addition or bug fix.
9
+ * Add tests for it. This is important so I don't break it in a
10
+ future version unintentionally.
11
+ * Commit, do not mess with rakefile, version, or history.
12
+ (if you want to have your own version, that is fine but
13
+ bump version in a commit by itself I can ignore when I pull)
14
+ * Send me a pull request. Bonus points for topic branches.
15
+
16
+ == Copyright
17
+
18
+ Copyright (c) 2009 Matt Darby. See LICENSE for details.
data/Rakefile CHANGED
@@ -1,23 +1,63 @@
1
+ require 'rubygems'
1
2
  require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = "mq"
8
+ gem.summary = %Q{An email queue that actually works}
9
+ gem.description = %Q{A Rails gem that generates an MVC stack that does email queuing}
10
+ gem.email = "matt@matt-darby.com"
11
+ gem.homepage = "http://github.com/mdarby/mq"
12
+ gem.authors = ["Matt Darby"]
13
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
14
+ end
15
+ Jeweler::GemcutterTasks.new
16
+ rescue LoadError
17
+ puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
18
+ end
19
+
2
20
  require 'rake/testtask'
3
- require 'rake/rdoctask'
21
+ Rake::TestTask.new(:test) do |test|
22
+ test.libs << 'lib' << 'test'
23
+ test.pattern = 'test/**/test_*.rb'
24
+ test.verbose = true
25
+ end
4
26
 
5
- desc 'Default: run unit tests.'
6
- task :default => :test
27
+ begin
28
+ require 'rcov/rcovtask'
29
+ Rcov::RcovTask.new do |test|
30
+ test.libs << 'test'
31
+ test.pattern = 'test/**/test_*.rb'
32
+ test.verbose = true
33
+ end
34
+ rescue LoadError
35
+ task :rcov do
36
+ abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
37
+ end
38
+ end
7
39
 
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
40
+ task :test => :check_dependencies
41
+
42
+ begin
43
+ require 'cucumber/rake/task'
44
+ Cucumber::Rake::Task.new(:features)
45
+
46
+ task :features => :check_dependencies
47
+ rescue LoadError
48
+ task :features do
49
+ abort "Cucumber is not available. In order to run features, you must: sudo gem install cucumber"
50
+ end
14
51
  end
15
52
 
16
- desc 'Generate documentation for the mq plugin.'
17
- Rake::RDocTask.new(:rdoc) do |rdoc|
53
+ task :default => :test
54
+
55
+ require 'rake/rdoctask'
56
+ Rake::RDocTask.new do |rdoc|
57
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
58
+
18
59
  rdoc.rdoc_dir = 'rdoc'
19
- rdoc.title = 'Mq'
20
- rdoc.options << '--line-numbers' << '--inline-source'
21
- rdoc.rdoc_files.include('README')
60
+ rdoc.title = "mq #{version}"
61
+ rdoc.rdoc_files.include('README*')
22
62
  rdoc.rdoc_files.include('lib/**/*.rb')
23
63
  end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.3
@@ -0,0 +1,130 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ module <%= class_name %>Attributes
4
+ def valid_attributes
5
+ {
6
+ :mailer_method => "send_some_<%= object_name %>",
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 %>sController do
16
+
17
+ include <%= class_name %>Attributes
18
+
19
+ before do
20
+ @<%= object_name %> = <%= class_name %>.create!(valid_attributes)
21
+ @<%= object_name %>.stub!(:deliver => true)
22
+
23
+ <%= class_name %>.stub!({
24
+ :find => @<%= object_name %>,
25
+ :all => [@<%= object_name %>],
26
+ :deliver_all => true,
27
+ :destroy_all => true
28
+ })
29
+
30
+ request.env["HTTP_REFERER"] = "/somewhere"
31
+ @back = "http://test.host/somewhere"
32
+ end
33
+
34
+ describe "GET :index" do
35
+ def do_get
36
+ get :index
37
+ end
38
+
39
+ it "should find all <%= object_name %>s" do
40
+ <%= class_name %>.should_receive(:all)
41
+ do_get
42
+ end
43
+
44
+ it "should assign @<%= object_name %>s for the view" do
45
+ do_get
46
+ assigns[:<%= object_name %>s].should == [@<%= object_name %>]
47
+ end
48
+
49
+ end
50
+
51
+ describe "GET :deliver" do
52
+ before do
53
+ <%= class_name %>.stub!(:find).with("1").and_return(@<%= object_name %>)
54
+ end
55
+
56
+ def do_get
57
+ get :deliver, :id => "1"
58
+ end
59
+
60
+ it "should find the <%= object_name %> in question" do
61
+ <%= class_name %>.should_receive(:find).with("1").and_return(@<%= object_name %>)
62
+ do_get
63
+ end
64
+
65
+ it "should deliver the <%= object_name %>" do
66
+ @<%= object_name %>.should_receive(:deliver)
67
+ do_get
68
+ end
69
+
70
+ it "should redirect back" do
71
+ do_get
72
+ response.should redirect_to(@back)
73
+ end
74
+
75
+ end
76
+
77
+ describe "GET :deliver_all" do
78
+ def do_get
79
+ get :deliver_all
80
+ end
81
+
82
+ it "should deliver all <%= object_name %>s" do
83
+ <%= class_name %>.should_receive(:deliver_all)
84
+ do_get
85
+ end
86
+
87
+ it "should redirect back" do
88
+ do_get
89
+ response.should redirect_to(@back)
90
+ end
91
+
92
+ end
93
+
94
+ describe "DELETE :destroy" do
95
+
96
+ def do_destroy
97
+ delete :destroy, :id => "1"
98
+ end
99
+
100
+ it "should destroy the <%= object_name %>" do
101
+ @<%= object_name %>.should_receive(:destroy)
102
+ do_destroy
103
+ end
104
+
105
+ it "should redirect back" do
106
+ do_destroy
107
+ response.should redirect_to(@back)
108
+ end
109
+
110
+ end
111
+
112
+ describe "DELETE :destroy_all" do
113
+
114
+ def do_destroy
115
+ delete :destroy_all
116
+ end
117
+
118
+ it "should destroy all <%= object_name %>" do
119
+ <%= class_name %>.should_receive(:destroy_all)
120
+ do_destroy
121
+ end
122
+
123
+ it "should redirect back" do
124
+ do_destroy
125
+ response.should redirect_to(@back)
126
+ end
127
+
128
+ end
129
+
130
+ end
@@ -1,28 +1,24 @@
1
1
  require File.dirname(__FILE__) + '/../spec_helper'
2
2
 
3
- describe EmailsController do
3
+ describe <%= class_name %>sController do
4
4
  describe "route generation" do
5
5
 
6
6
  it "should map { :controller => '<%= object_name %>s', :action => 'index' } to /<%= object_name %>s" do
7
7
  route_for(:controller => "<%= object_name %>s", :action => "index").should == "/<%= object_name %>s"
8
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
-
9
+
14
10
  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"
11
+ route_for(:controller => "<%= object_name %>s", :action => "destroy", :id => '1').should == {:path => "/<%= object_name %>s/1", :method => :delete}
16
12
  end
17
-
13
+
18
14
  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"
15
+ route_for(:controller => "<%= object_name %>s", :action => "deliver", :id => '1').should == "/<%= object_name %>s/1/deliver"
20
16
  end
21
-
17
+
22
18
  it "should map { :controller => '<%= object_name %>s', :action => 'deliver_all'} to /<%= object_name %>s/deliver_all" do
23
19
  route_for(:controller => "<%= object_name %>s", :action => "deliver_all").should == "/<%= object_name %>s/deliver_all"
24
20
  end
25
-
21
+
26
22
  it "should map { :controller => '<%= object_name %>s', :action => 'destroy_all'} to /<%= object_name %>s/destroy_all" do
27
23
  route_for(:controller => "<%= object_name %>s", :action => "destroy_all").should == "/<%= object_name %>s/destroy_all"
28
24
  end
@@ -33,19 +29,19 @@ describe EmailsController do
33
29
  it "should generate params { :controller => '<%= object_name %>s', action => 'index' } from GET /<%= object_name %>s" do
34
30
  params_from(:get, "/<%= object_name %>s").should == {:controller => "<%= object_name %>s", :action => "index"}
35
31
  end
36
-
32
+
37
33
  it "should generate params { :controller => '<%= object_name %>s', action => 'destroy', id => '1' } from DELETE /<%= object_name %>s/1" do
38
34
  params_from(:delete, "/<%= object_name %>s/1").should == {:controller => "<%= object_name %>s", :action => "destroy", :id => "1"}
39
35
  end
40
-
36
+
41
37
  it "should generate params { :controller => '<%= object_name %>s', action => 'deliver', id => '1' } from GET /<%= object_name %>s/1/deliver" do
42
38
  params_from(:get, "/<%= object_name %>s/1/deliver").should == {:controller => "<%= object_name %>s", :action => "deliver", :id => "1"}
43
39
  end
44
-
40
+
45
41
  it "should generate params { :controller => '<%= object_name %>s', action => 'deliver_all' } from GET /<%= object_name %>s/deliver_all" do
46
42
  params_from(:get, "/<%= object_name %>s/deliver_all").should == {:controller => "<%= object_name %>s", :action => "deliver_all"}
47
43
  end
48
-
44
+
49
45
  it "should generate params { :controller => '<%= object_name %>s', action => 'destroy_all' } from GET /<%= object_name %>s/destroy_all" do
50
46
  params_from(:get, "/<%= object_name %>s/destroy_all").should == {:controller => "<%= object_name %>s", :action => "destroy_all"}
51
47
  end
data/mq.gemspec CHANGED
@@ -1,32 +1,63 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
1
6
  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"
7
+ s.name = %q{mq}
8
+ s.version = "0.1.3"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Matt Darby"]
12
+ s.date = %q{2009-12-16}
13
+ s.description = %q{A Rails gem that generates an MVC stack that does email queuing}
14
+ s.email = %q{matt@matt-darby.com}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE",
17
+ "README.rdoc",
18
+ "README.textile"
30
19
  ]
31
-
32
- end
20
+ s.files = [
21
+ ".document",
22
+ ".gitignore",
23
+ "LICENSE",
24
+ "README.rdoc",
25
+ "README.textile",
26
+ "Rakefile",
27
+ "VERSION",
28
+ "generators/mq/USAGE",
29
+ "generators/mq/mq_generator.rb",
30
+ "generators/mq/templates/create_email_table.rb",
31
+ "generators/mq/templates/email.rb",
32
+ "generators/mq/templates/emails_controller.rb",
33
+ "generators/mq/templates/spec/email_spec.rb",
34
+ "generators/mq/templates/spec/emails_controller_spec.rb",
35
+ "generators/mq/templates/spec/emails_routing_spec.rb",
36
+ "generators/mq/templates/views/_email.html.erb",
37
+ "generators/mq/templates/views/index.html.erb",
38
+ "lib/mq.rb",
39
+ "mq.gemspec",
40
+ "test/helper.rb",
41
+ "test/test_mq.rb"
42
+ ]
43
+ s.homepage = %q{http://github.com/mdarby/mq}
44
+ s.rdoc_options = ["--charset=UTF-8"]
45
+ s.require_paths = ["lib"]
46
+ s.rubygems_version = %q{1.3.5}
47
+ s.summary = %q{An email queue that actually works}
48
+ s.test_files = [
49
+ "test/helper.rb",
50
+ "test/test_mq.rb"
51
+ ]
52
+
53
+ if s.respond_to? :specification_version then
54
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
55
+ s.specification_version = 3
56
+
57
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
58
+ else
59
+ end
60
+ else
61
+ end
62
+ end
63
+
@@ -0,0 +1,10 @@
1
+ require 'rubygems'
2
+ require 'test/unit'
3
+ require 'shoulda'
4
+
5
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
6
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
7
+ require 'mq'
8
+
9
+ class Test::Unit::TestCase
10
+ end
@@ -0,0 +1,7 @@
1
+ require 'helper'
2
+
3
+ class TestMq < Test::Unit::TestCase
4
+ should "probably rename this file and start testing for real" do
5
+ flunk "hey buddy, you should probably rename this file and start testing for real"
6
+ end
7
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mq
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Darby
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-07-11 00:00:00 -04:00
12
+ date: 2009-12-16 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -19,34 +19,39 @@ executables: []
19
19
 
20
20
  extensions: []
21
21
 
22
- extra_rdoc_files: []
23
-
22
+ extra_rdoc_files:
23
+ - LICENSE
24
+ - README.rdoc
25
+ - README.textile
24
26
  files:
25
- - MIT-LICENSE
27
+ - .document
28
+ - .gitignore
29
+ - LICENSE
30
+ - README.rdoc
26
31
  - README.textile
27
32
  - Rakefile
33
+ - VERSION
34
+ - generators/mq/USAGE
28
35
  - generators/mq/mq_generator.rb
29
36
  - generators/mq/templates/create_email_table.rb
30
37
  - generators/mq/templates/email.rb
31
38
  - generators/mq/templates/emails_controller.rb
32
- - generators/mq/templates/spec/emails_routing_spec.rb
33
39
  - generators/mq/templates/spec/email_spec.rb
34
40
  - generators/mq/templates/spec/emails_controller_spec.rb
41
+ - generators/mq/templates/spec/emails_routing_spec.rb
35
42
  - generators/mq/templates/views/_email.html.erb
36
43
  - generators/mq/templates/views/index.html.erb
37
- - generators/mq/USAGE
38
- - init.rb
39
- - install.rb
40
44
  - lib/mq.rb
41
45
  - mq.gemspec
42
- - uninstall.rb
46
+ - test/helper.rb
47
+ - test/test_mq.rb
43
48
  has_rdoc: true
44
49
  homepage: http://github.com/mdarby/mq
45
50
  licenses: []
46
51
 
47
52
  post_install_message:
48
- rdoc_options: []
49
-
53
+ rdoc_options:
54
+ - --charset=UTF-8
50
55
  require_paths:
51
56
  - lib
52
57
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -68,5 +73,6 @@ rubygems_version: 1.3.5
68
73
  signing_key:
69
74
  specification_version: 3
70
75
  summary: An email queue that actually works
71
- test_files: []
72
-
76
+ test_files:
77
+ - test/helper.rb
78
+ - test/test_mq.rb
data/init.rb DELETED
@@ -1 +0,0 @@
1
- # Include hook code here
data/install.rb DELETED
@@ -1 +0,0 @@
1
- # Install hook code here
@@ -1 +0,0 @@
1
- # Uninstall hook code here