mloughran-job_queue 0.0.3 → 0.0.4

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/Rakefile CHANGED
@@ -1,57 +1,38 @@
1
- require 'rubygems'
2
- require 'rake/gempackagetask'
3
- require 'rubygems/specification'
4
- require 'date'
5
- require 'spec/rake/spectask'
6
-
7
- GEM = "job_queue"
8
- GEM_VERSION = "0.0.3"
9
- AUTHOR = "Martyn Loughran"
10
- EMAIL = "me@mloughran.com"
11
- HOMEPAGE = "http://github.com/mloughran/job_queue/"
12
- SUMMARY = "JobQueue means you don't have to worry about your queue any more!"
13
-
14
- spec = Gem::Specification.new do |s|
15
- s.name = GEM
16
- s.version = GEM_VERSION
17
- s.platform = Gem::Platform::RUBY
18
- s.has_rdoc = true
19
- s.extra_rdoc_files = ["README.markdown", "LICENSE"]
20
- s.summary = SUMMARY
21
- s.description = s.summary
22
- s.author = AUTHOR
23
- s.email = EMAIL
24
- s.homepage = HOMEPAGE
25
-
26
- # Uncomment this to add a dependency
27
- # s.add_dependency "foo"
28
-
29
- s.require_path = 'lib'
30
- s.autorequire = GEM
31
- s.files = %w(LICENSE README.markdown Rakefile) + Dir.glob("{lib,spec}/**/*")
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"
32
15
  end
33
16
 
34
- task :default => :spec
35
-
36
- desc "Run specs"
37
- Spec::Rake::SpecTask.new do |t|
38
- t.spec_files = FileList['spec/**/*_spec.rb']
39
- t.spec_opts = %w(-fs --color)
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')
40
24
  end
41
25
 
42
-
43
- Rake::GemPackageTask.new(spec) do |pkg|
44
- pkg.gem_spec = spec
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']
45
30
  end
46
31
 
47
- desc "install the gem locally"
48
- task :install => [:package] do
49
- sh %{sudo gem install pkg/#{GEM}-#{GEM_VERSION}}
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
50
36
  end
51
37
 
52
- desc "create a gemspec file"
53
- task :make_spec do
54
- File.open("#{GEM}.gemspec", "w") do |file|
55
- file.puts spec.to_ruby
56
- end
57
- end
38
+ task :default => :spec
data/VERSION.yml ADDED
@@ -0,0 +1,4 @@
1
+ ---
2
+ :patch: 4
3
+ :major: 0
4
+ :minor: 0
@@ -1,7 +1,7 @@
1
1
  require 'mq'
2
2
 
3
3
  class JobQueue::AMQPAdapter
4
- def initialize
4
+ def initialize(options = {})
5
5
  amq = MQ.new
6
6
  @exchange = amq.direct('photo', :durable => true)
7
7
  @queue = amq.queue('photo_worker', :durable => true)
@@ -1,8 +1,10 @@
1
1
  require 'beanstalk-client'
2
2
 
3
3
  class JobQueue::BeanstalkAdapter
4
- def initialize
5
- @beanstalk = Beanstalk::Pool.new(['localhost:11300'])
4
+ def initialize(options = {})
5
+ host = options[:host] || 'localhost'
6
+ port = options[:port] || 11300
7
+ @beanstalk = Beanstalk::Pool.new(["#{host}:#{port}"])
6
8
  end
7
9
 
8
10
  def put(string)
@@ -1,5 +1,5 @@
1
1
  class JobQueue::TestAdapter
2
- def initialize
2
+ def initialize(options = {})
3
3
  @queue = []
4
4
  end
5
5
 
@@ -3,7 +3,7 @@
3
3
  # It might be useful for testing.
4
4
  #
5
5
  class JobQueue::VerboseAdapter
6
- def initialize
6
+ def initialize(options = {})
7
7
 
8
8
  end
9
9
 
@@ -4,7 +4,19 @@ describe JobQueue::BeanstalkAdapter do
4
4
  before :all do
5
5
  JobQueue.adapter = JobQueue::BeanstalkAdapter.new
6
6
  end
7
-
7
+
8
+ describe '#new' do
9
+ it "should default to localhost:11300" do
10
+ Beanstalk::Pool.should_receive(:new).with(['localhost:11300'])
11
+ JobQueue::BeanstalkAdapter.new
12
+ end
13
+
14
+ it "should use options provided" do
15
+ Beanstalk::Pool.should_receive(:new).with(['12.34.56.78:12345'])
16
+ JobQueue::BeanstalkAdapter.new(:host => '12.34.56.78', :port => 12345)
17
+ end
18
+ end
19
+
8
20
  it "should write onto queue and fetch stuff back off" do
9
21
  JobQueue.put("hello")
10
22
 
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mloughran-job_queue
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martyn Loughran
8
- autorequire: job_queue
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-02-05 00:00:00 -08:00
12
+ date: 2009-04-16 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -20,20 +20,19 @@ executables: []
20
20
  extensions: []
21
21
 
22
22
  extra_rdoc_files:
23
- - README.markdown
24
23
  - LICENSE
24
+ - README.markdown
25
25
  files:
26
26
  - LICENSE
27
27
  - README.markdown
28
28
  - Rakefile
29
- - lib/job_queue
30
- - lib/job_queue/adapters
29
+ - VERSION.yml
30
+ - lib/job_queue.rb
31
31
  - lib/job_queue/adapters/amqp_adapter.rb
32
32
  - lib/job_queue/adapters/beanstalk_adapter.rb
33
33
  - lib/job_queue/adapters/test_adapter.rb
34
34
  - lib/job_queue/adapters/verbose_adapter.rb
35
35
  - lib/job_queue/job_queue.rb
36
- - lib/job_queue.rb
37
36
  - spec/amqp_adapter_spec.rb
38
37
  - spec/beanstalk_adapter_spec.rb
39
38
  - spec/job_queue_spec.rb
@@ -41,10 +40,10 @@ files:
41
40
  - spec/test_adapter_spec.rb
42
41
  - spec/verbose_adapter_spec.rb
43
42
  has_rdoc: true
44
- homepage: http://github.com/mloughran/job_queue/
43
+ homepage: http://github.com/mloughran/job_queue
45
44
  post_install_message:
46
- rdoc_options: []
47
-
45
+ rdoc_options:
46
+ - --charset=UTF-8
48
47
  require_paths:
49
48
  - lib
50
49
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -66,5 +65,10 @@ rubygems_version: 1.2.0
66
65
  signing_key:
67
66
  specification_version: 2
68
67
  summary: JobQueue means you don't have to worry about your queue any more!
69
- test_files: []
70
-
68
+ test_files:
69
+ - spec/amqp_adapter_spec.rb
70
+ - spec/beanstalk_adapter_spec.rb
71
+ - spec/job_queue_spec.rb
72
+ - spec/spec_helper.rb
73
+ - spec/test_adapter_spec.rb
74
+ - spec/verbose_adapter_spec.rb