sneakers 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,5 @@
1
1
  workers 2
2
+ amqp "amqp://guest:guest@localhost:55672"
2
3
 
3
4
  before_fork do
4
5
  Sneakers::logger.info " ** im before-fork'en ** "
data/lib/sneakers.rb CHANGED
@@ -28,6 +28,7 @@ module Sneakers
28
28
  :workers => 4,
29
29
  :log => 'sneakers.log',
30
30
  :pid_path => 'sneakers.pid',
31
+ :amqp => 'amqp://guest:guest@localhost:55672',
31
32
 
32
33
  #workers
33
34
  :timeout_job_after => 5,
data/lib/sneakers/cli.rb CHANGED
@@ -26,6 +26,8 @@ module Sneakers
26
26
  method_option :debug
27
27
  method_option :front
28
28
  method_option :require
29
+ method_option :amqp
30
+
29
31
  desc "work FirstWorker,SecondWorker ... ,NthWorker", "Run workers"
30
32
  def work(workers)
31
33
  require_boot File.expand_path(options[:require]) if options[:require]
@@ -52,7 +54,8 @@ module Sneakers
52
54
 
53
55
  opts = {
54
56
  :daemonize => !options[:front],
55
- :log => options[:front] ? STDOUT : Sneakers::Config[:log]
57
+ :log => options[:front] ? STDOUT : Sneakers::Config[:log],
58
+ :amqp => options[:amqp]
56
59
  }
57
60
 
58
61
  Sneakers.configure(opts)
@@ -17,7 +17,7 @@ class Sneakers::Queue
17
17
  #
18
18
  def subscribe(worker)
19
19
  @bunny = Bunny.new(:heartbeat_interval => @opts[:heartbeat_interval])
20
- @bunny.start
20
+ @bunny.start(@opts[:amqp])
21
21
 
22
22
  @channel = @bunny.create_channel
23
23
  @channel.prefetch(@opts[:prefetch])
@@ -3,7 +3,7 @@ module Sneakers
3
3
  def method_missing(meth, *args, &block)
4
4
  if %w{ before_fork after_fork }.include? meth.to_s
5
5
  @conf[meth] = block
6
- elsif %w{ workers start_worker_delay }.include? meth.to_s
6
+ elsif %w{ workers start_worker_delay amqp }.include? meth.to_s
7
7
  @conf[meth] = args.first
8
8
  else
9
9
  super
@@ -1,3 +1,3 @@
1
1
  module Sneakers
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -22,7 +22,7 @@ describe Sneakers::Queue do
22
22
  mkex = Object.new
23
23
  mkqueue = Object.new
24
24
 
25
- mock(mkbunny).start {}
25
+ mock(mkbunny).start(anything) {}
26
26
  mock(mkbunny).create_channel{ mkchan }
27
27
  mock(Bunny).new(:heartbeat_interval => 2){ mkbunny }
28
28
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sneakers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-10-15 00:00:00.000000000 Z
12
+ date: 2013-10-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: serverengine
@@ -286,3 +286,4 @@ test_files:
286
286
  - spec/sneakers/queue_spec.rb
287
287
  - spec/sneakers/worker_spec.rb
288
288
  - spec/spec_helper.rb
289
+ has_rdoc: