sponges 0.1.2 → 0.1.3

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/README.md CHANGED
@@ -6,8 +6,8 @@ control them, and, well, to kill them gracefully. Making them stressed and eager
6
6
  to work is your job. :)
7
7
 
8
8
  Basically, sponges is a ruby supervisor that forks processes and controls their
9
- execution and termination. For example the following will start a supervision
10
- daemon and 8 processes of "a_worker".
9
+ execution and termination. For example the following will start a supervision
10
+ daemon and 8 processes of "a_worker".
11
11
  ```bash
12
12
  ruby a_worker.rb start -d -s 8
13
13
  ```
@@ -66,7 +66,9 @@ Sponges.configure do |config|
66
66
  end
67
67
 
68
68
  # Register a pool named "worker_name".
69
- Sponges.start "worker_name" do
69
+ # Options are optionnal. Consider it as a default, options given by command have
70
+ # the precedence.
71
+ Sponges.start "worker_name", {size: 3, daemonize: true} do
70
72
  Worker.new({some: args}).run
71
73
  end
72
74
  ```
data/lib/sponges.rb CHANGED
@@ -18,10 +18,11 @@ module Sponges
18
18
  end
19
19
  module_function :configure
20
20
 
21
- def start(worker_name, options = ARGV, &block)
21
+ def start(worker_name, options = {}, argv = ARGV, &block)
22
22
  Sponges::Configuration.worker_name = worker_name
23
23
  Sponges::Configuration.worker = block
24
- Sponges::Cli.start(options)
24
+ Sponges::Configuration.options = options
25
+ Sponges::Cli.start(argv)
25
26
  end
26
27
  module_function :start
27
28
 
data/lib/sponges/cli.rb CHANGED
@@ -7,6 +7,7 @@ module Sponges
7
7
  option :size, type: :numeric
8
8
  desc "Start workers"
9
9
  def start(options = {})
10
+ options = Sponges::Configuration.options.merge(options)
10
11
  Sponges::Runner.new(Sponges::Configuration.worker_name, options,
11
12
  Sponges::Configuration.worker
12
13
  ).start
@@ -4,7 +4,7 @@ module Sponges
4
4
  #
5
5
  class Configuration
6
6
  class << self
7
- ACCESSOR = [:worker_name, :worker, :logger, :redis]
7
+ ACCESSOR = [:worker_name, :worker, :logger, :redis, :options]
8
8
  attr_accessor *ACCESSOR
9
9
 
10
10
  def configure
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
2
  module Sponges
3
- VERSION = "0.1.2"
3
+ VERSION = "0.1.3"
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sponges
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.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: 2012-11-05 00:00:00.000000000 Z
12
+ date: 2012-11-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: boson