job_queue 0.0.11 → 0.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.gitignore ADDED
@@ -0,0 +1 @@
1
+ pkg
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 Martyn Loughran
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/Rakefile ADDED
@@ -0,0 +1,38 @@
1
+ require 'rake'
2
+
3
+ begin
4
+ require 'jeweler'
5
+ Jeweler::Tasks.new do |s|
6
+ s.name = "job_queue"
7
+ s.summary = %Q{JobQueue means you don't have to worry about your queue any more!}
8
+ s.email = "me@mloughran.com"
9
+ s.homepage = "http://github.com/mloughran/job_queue"
10
+ s.description = "JobQueue means you don't have to worry about your queue any more!"
11
+ s.authors = ["Martyn Loughran"]
12
+ end
13
+ rescue LoadError
14
+ puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
15
+ end
16
+
17
+ require 'rake/rdoctask'
18
+ Rake::RDocTask.new do |rdoc|
19
+ rdoc.rdoc_dir = 'rdoc'
20
+ rdoc.title = 'job_queue'
21
+ rdoc.options << '--line-numbers' << '--inline-source'
22
+ rdoc.rdoc_files.include('README*')
23
+ rdoc.rdoc_files.include('lib/**/*.rb')
24
+ end
25
+
26
+ require 'spec/rake/spectask'
27
+ Spec::Rake::SpecTask.new(:spec) do |t|
28
+ t.libs << 'lib' << 'spec'
29
+ t.spec_files = FileList['spec/**/*_spec.rb']
30
+ end
31
+
32
+ Spec::Rake::SpecTask.new(:rcov) do |t|
33
+ t.libs << 'lib' << 'spec'
34
+ t.spec_files = FileList['spec/**/*_spec.rb']
35
+ t.rcov = true
36
+ end
37
+
38
+ task :default => :spec
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :minor: 0
3
- :patch: 11
3
+ :patch: 12
4
4
  :major: 0
data/job_queue.gemspec ADDED
@@ -0,0 +1,66 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{job_queue}
8
+ s.version = "0.0.12"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Martyn Loughran"]
12
+ s.date = %q{2009-10-21}
13
+ s.description = %q{JobQueue means you don't have to worry about your queue any more!}
14
+ s.email = %q{me@mloughran.com}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE",
17
+ "README.markdown"
18
+ ]
19
+ s.files = [
20
+ ".gitignore",
21
+ "LICENSE",
22
+ "README.markdown",
23
+ "Rakefile",
24
+ "VERSION.yml",
25
+ "job_queue.gemspec",
26
+ "lib/job_queue.rb",
27
+ "lib/job_queue/adapters/amqp_adapter.rb",
28
+ "lib/job_queue/adapters/beanstalk_adapter.rb",
29
+ "lib/job_queue/adapters/test_adapter.rb",
30
+ "lib/job_queue/adapters/verbose_adapter.rb",
31
+ "lib/job_queue/job_queue.rb",
32
+ "script/destroy",
33
+ "script/generate",
34
+ "spec/amqp_adapter_spec.rb",
35
+ "spec/beanstalk_adapter_spec.rb",
36
+ "spec/common_adapter_spec.rb",
37
+ "spec/job_queue_spec.rb",
38
+ "spec/spec_helper.rb",
39
+ "spec/test_adapter_spec.rb",
40
+ "spec/verbose_adapter_spec.rb"
41
+ ]
42
+ s.homepage = %q{http://github.com/mloughran/job_queue}
43
+ s.rdoc_options = ["--charset=UTF-8"]
44
+ s.require_paths = ["lib"]
45
+ s.rubygems_version = %q{1.3.5}
46
+ s.summary = %q{JobQueue means you don't have to worry about your queue any more!}
47
+ s.test_files = [
48
+ "spec/amqp_adapter_spec.rb",
49
+ "spec/beanstalk_adapter_spec.rb",
50
+ "spec/common_adapter_spec.rb",
51
+ "spec/job_queue_spec.rb",
52
+ "spec/spec_helper.rb",
53
+ "spec/test_adapter_spec.rb",
54
+ "spec/verbose_adapter_spec.rb"
55
+ ]
56
+
57
+ if s.respond_to? :specification_version then
58
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
59
+ s.specification_version = 3
60
+
61
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
62
+ else
63
+ end
64
+ else
65
+ end
66
+ end
@@ -95,16 +95,5 @@ class JobQueue::BeanstalkAdapter
95
95
  def job_stats(id)
96
96
  make_hash(send_to_all_conns(:job_stats, id))
97
97
  end
98
-
99
- private
100
-
101
- def call_wrap(c, *args)
102
- self.last_conn = c
103
- c.send(*args)
104
- rescue EOFError, Errno::ECONNRESET, Errno::EPIPE, Beanstalk::UnexpectedResponse => ex
105
- # puts "Beanstalk exception: #{ex.class}" # Useful for debugging
106
- self.remove(c) unless ex.class == Beanstalk::TimedOut
107
- raise ex
108
- end
109
98
  end
110
99
  end
data/script/destroy ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+ APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
+
4
+ begin
5
+ require 'rubigen'
6
+ rescue LoadError
7
+ require 'rubygems'
8
+ require 'rubigen'
9
+ end
10
+ require 'rubigen/scripts/destroy'
11
+
12
+ ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
+ RubiGen::Base.use_component_sources! [:newgem_simple, :test_unit]
14
+ RubiGen::Scripts::Destroy.new.run(ARGV)
data/script/generate ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+ APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
+
4
+ begin
5
+ require 'rubigen'
6
+ rescue LoadError
7
+ require 'rubygems'
8
+ require 'rubigen'
9
+ end
10
+ require 'rubigen/scripts/generate'
11
+
12
+ ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
+ RubiGen::Base.use_component_sources! [:newgem_simple, :test_unit]
14
+ RubiGen::Scripts::Generate.new.run(ARGV)
@@ -195,6 +195,20 @@ describe JobQueue::BeanstalkAdapter do
195
195
  # The number of connections should have been constant
196
196
  connections.uniq.size.should == 1
197
197
  end
198
+
199
+ it "should be possible to put inside a subscribe block" do
200
+ JobQueue.put('first_job')
201
+ JobQueue.subscribe do |job|
202
+ job.should == 'first_job'
203
+ JobQueue.put('inside_subscribe', :queue => "putter")
204
+ throw :stop
205
+ end
206
+
207
+ JobQueue.subscribe(:queue => "putter") do |job|
208
+ job.should == 'inside_subscribe'
209
+ throw :stop
210
+ end
211
+ end
198
212
  end
199
213
 
200
214
  describe "job_stats" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: job_queue
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11
4
+ version: 0.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martyn Loughran
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-09-02 00:00:00 +01:00
12
+ date: 2009-10-21 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -19,17 +19,24 @@ executables: []
19
19
 
20
20
  extensions: []
21
21
 
22
- extra_rdoc_files: []
23
-
22
+ extra_rdoc_files:
23
+ - LICENSE
24
+ - README.markdown
24
25
  files:
26
+ - .gitignore
27
+ - LICENSE
25
28
  - README.markdown
29
+ - Rakefile
26
30
  - VERSION.yml
31
+ - job_queue.gemspec
32
+ - lib/job_queue.rb
27
33
  - lib/job_queue/adapters/amqp_adapter.rb
28
34
  - lib/job_queue/adapters/beanstalk_adapter.rb
29
35
  - lib/job_queue/adapters/test_adapter.rb
30
36
  - lib/job_queue/adapters/verbose_adapter.rb
31
37
  - lib/job_queue/job_queue.rb
32
- - lib/job_queue.rb
38
+ - script/destroy
39
+ - script/generate
33
40
  - spec/amqp_adapter_spec.rb
34
41
  - spec/beanstalk_adapter_spec.rb
35
42
  - spec/common_adapter_spec.rb
@@ -43,7 +50,6 @@ licenses: []
43
50
 
44
51
  post_install_message:
45
52
  rdoc_options:
46
- - --inline-source
47
53
  - --charset=UTF-8
48
54
  require_paths:
49
55
  - lib
@@ -66,5 +72,11 @@ rubygems_version: 1.3.5
66
72
  signing_key:
67
73
  specification_version: 3
68
74
  summary: JobQueue means you don't have to worry about your queue any more!
69
- test_files: []
70
-
75
+ test_files:
76
+ - spec/amqp_adapter_spec.rb
77
+ - spec/beanstalk_adapter_spec.rb
78
+ - spec/common_adapter_spec.rb
79
+ - spec/job_queue_spec.rb
80
+ - spec/spec_helper.rb
81
+ - spec/test_adapter_spec.rb
82
+ - spec/verbose_adapter_spec.rb