Class: Sponges::Cli
- Inherits:
-
Boson::Runner
- Object
- Boson::Runner
- Sponges::Cli
- Defined in:
- lib/sponges/cli.rb
Overview
This class concern is to expose a nice CLI interface.
Instance Method Summary collapse
- #decrement(options = {}) ⇒ Object
- #increment(options = {}) ⇒ Object
- #kill(options = {}) ⇒ Object
- #restart(options = {}) ⇒ Object
- #start(options = {}) ⇒ Object
- #stop(options = {}) ⇒ Object
Instance Method Details
#decrement(options = {}) ⇒ Object
53 54 55 56 |
# File 'lib/sponges/cli.rb', line 53 def decrement( = {}) Sponges::Commander.new(Sponges::Configuration.worker_name, ). decrement end |
#increment(options = {}) ⇒ Object
47 48 49 50 |
# File 'lib/sponges/cli.rb', line 47 def increment( = {}) Sponges::Commander.new(Sponges::Configuration.worker_name, ). increment end |
#kill(options = {}) ⇒ Object
31 32 33 |
# File 'lib/sponges/cli.rb', line 31 def kill( = {}) Sponges::Commander.new(Sponges::Configuration.worker_name, ).kill end |
#restart(options = {}) ⇒ Object
40 41 42 43 44 |
# File 'lib/sponges/cli.rb', line 40 def restart( = {}) stop() sleep 1 start() end |
#start(options = {}) ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/sponges/cli.rb', line 9 def start( = {}) = { size: Sponges::Configuration.size, daemonize: Sponges::Configuration.daemonize }.reject{|k, v| v.nil?}.merge() Sponges::Runner.new(Sponges::Configuration.worker_name, , Sponges::Configuration.worker ).start end |
#stop(options = {}) ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/sponges/cli.rb', line 22 def stop( = {}) = { timeout: Sponges::Configuration.timeout, gracefully: Sponges::Configuration.gracefully }.reject{|k, v| v.nil?}.merge() Sponges::Commander.new(Sponges::Configuration.worker_name, ).stop end |