minion 0.1.10 → 0.1.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (6) hide show
  1. data/Rakefile +24 -0
  2. data/VERSION +1 -1
  3. data/lib/minion.rb +4 -1
  4. data/spec/base.rb +21 -0
  5. data/spec/enqueue_spec.rb +10 -0
  6. metadata +12 -10
@@ -0,0 +1,24 @@
1
+ require 'jeweler'
2
+
3
+ Jeweler::Tasks.new do |s|
4
+ s.name = "minion"
5
+ s.description = "Super simple job queue over AMQP"
6
+ s.summary = s.description
7
+ s.author = "Orion Henry"
8
+ s.email = "orion@heroku.com"
9
+ s.homepage = "http://github.com/orionz/minion"
10
+ s.rubyforge_project = "minion"
11
+ s.files = FileList["[A-Z]*", "{bin,lib,spec}/**/*"]
12
+ s.add_dependency "amqp", ">= 0.6.6"
13
+ s.add_dependency "bunny", ">= 0.6.0"
14
+ s.add_dependency "json", ">= 1.2.0"
15
+ end
16
+
17
+ Jeweler::RubyforgeTasks.new
18
+
19
+ desc 'Run specs'
20
+ task :spec do
21
+ sh 'bacon -s spec/*_spec.rb'
22
+ end
23
+
24
+ task :default => :spec
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.10
1
+ 0.1.11
@@ -8,6 +8,9 @@ module Minion
8
8
  extend self
9
9
 
10
10
  def enqueue(jobs, data = {})
11
+ raise "cannot enqueue a nil job" if jobs.nil?
12
+ raise "cannot enqueue an empty job" if jobs.empty?
13
+
11
14
  ## jobs can be one or more jobs
12
15
  if jobs.respond_to? :shift
13
16
  queue = jobs.shift
@@ -122,7 +125,7 @@ module Minion
122
125
 
123
126
  def next_job(args, response)
124
127
  queue = args.delete("next_job")
125
- enqueue(queue,args.merge(response)) if queue
128
+ enqueue(queue,args.merge(response)) unless queue.empty?
126
129
  end
127
130
 
128
131
  def error_handler
@@ -0,0 +1,21 @@
1
+ require File.dirname(__FILE__) + '/../lib/minion'
2
+
3
+ require 'bacon'
4
+ require 'mocha/standalone'
5
+ require 'mocha/object'
6
+
7
+ class Bacon::Context
8
+ include Mocha::API
9
+
10
+ def initialize(name, &block)
11
+ @name = name
12
+ @before, @after = [
13
+ [lambda { mocha_setup }],
14
+ [lambda { mocha_verify ; mocha_teardown }]
15
+ ]
16
+ @block = block
17
+ end
18
+
19
+ def xit(desc, &bk)
20
+ end
21
+ end
@@ -0,0 +1,10 @@
1
+ require File.dirname(__FILE__) + '/base'
2
+
3
+ describe Minion do
4
+ it "should throw an exception when passed a nil queue" do
5
+ lambda { Minion.enqueue(nil, {}) }.should.raise(RuntimeError)
6
+ end
7
+ it "should throw an exception when passed an empty queue" do
8
+ lambda { Minion.enqueue([], {}) }.should.raise(RuntimeError)
9
+ end
10
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minion
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.10
4
+ version: 0.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Orion Henry
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-10-19 00:00:00 -04:00
12
+ date: 2010-01-21 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -20,27 +20,27 @@ dependencies:
20
20
  requirements:
21
21
  - - ">="
22
22
  - !ruby/object:Gem::Version
23
- version: 0.6.0
23
+ version: 0.6.6
24
24
  version:
25
25
  - !ruby/object:Gem::Dependency
26
- name: json
26
+ name: bunny
27
27
  type: :runtime
28
28
  version_requirement:
29
29
  version_requirements: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 1.1.7
33
+ version: 0.6.0
34
34
  version:
35
35
  - !ruby/object:Gem::Dependency
36
- name: bunny
36
+ name: json
37
37
  type: :runtime
38
38
  version_requirement:
39
39
  version_requirements: !ruby/object:Gem::Requirement
40
40
  requirements:
41
41
  - - ">="
42
42
  - !ruby/object:Gem::Version
43
- version: 0.5.2
43
+ version: 1.2.0
44
44
  version:
45
45
  description: Super simple job queue over AMQP
46
46
  email: orion@heroku.com
@@ -52,12 +52,12 @@ extra_rdoc_files:
52
52
  - README.rdoc
53
53
  files:
54
54
  - README.rdoc
55
+ - Rakefile
55
56
  - VERSION
56
- - examples/math.rb
57
- - examples/sandwich.rb
58
- - examples/when.rb
59
57
  - lib/minion.rb
60
58
  - lib/minion/handler.rb
59
+ - spec/base.rb
60
+ - spec/enqueue_spec.rb
61
61
  has_rdoc: true
62
62
  homepage: http://github.com/orionz/minion
63
63
  licenses: []
@@ -87,6 +87,8 @@ signing_key:
87
87
  specification_version: 3
88
88
  summary: Super simple job queue over AMQP
89
89
  test_files:
90
+ - spec/base.rb
91
+ - spec/enqueue_spec.rb
90
92
  - examples/math.rb
91
93
  - examples/sandwich.rb
92
94
  - examples/when.rb