Class: Circus::CLI
- Inherits:
-
Thor
- Object
- Thor
- Circus::CLI
- Defined in:
- lib/circus/cli.rb
Constant Summary collapse
- LOGGER =
StdoutLogger.new
Instance Method Summary collapse
- #admit(name = nil, *apps) ⇒ Object
- #alias(name, target) ⇒ Object
- #assemble ⇒ Object
- #configure(target, name, config) ⇒ Object
-
#connect(name, booth) ⇒ Object
method_option :jid, :required => true, :desc => ‘The deployer jid to connect as’ method_option :host, :required => true, :desc => ‘The XMPP host to connect to’ method_option :port, :type => :numeric, :default => 5222, :desc => ‘The XMPP port to connect to’ method_option :password, :required => true, :desc => ‘The XMPP user password’.
-
#deploy(target, name, act) ⇒ Object
method_option :actstore, :required => true, :desc => ‘The store to retrieve the act from’ method_option :jid, :required => true, :desc => ‘The deployer jid to connect as’ method_option :host, :required => true, :desc => ‘The XMPP host to connect to’ method_option :port, :type => :numeric, :default => 5222, :desc => ‘The XMPP port to connect to’ method_option :password, :required => true, :desc => ‘The XMPP user password’.
-
#exec(target, act_name, *cmd_parts) ⇒ Object
method_option :jid, :required => true, :desc => ‘The deployer jid to connect as’ method_option :host, :required => true, :desc => ‘The XMPP host to connect to’ method_option :port, :type => :numeric, :default => 5222, :desc => ‘The XMPP port to connect to’ method_option :password, :required => true, :desc => ‘The XMPP user password’.
- #get_booth_key(booth) ⇒ Object
- #go ⇒ Object
-
#undeploy(target, name) ⇒ Object
method_option :jid, :required => true, :desc => ‘The deployer jid to connect as’ method_option :host, :required => true, :desc => ‘The XMPP host to connect to’ method_option :port, :type => :numeric, :default => 5222, :desc => ‘The XMPP port to connect to’ method_option :password, :required => true, :desc => ‘The XMPP user password’.
- #upload(fn) ⇒ Object
Instance Method Details
#admit(name = nil, *apps) ⇒ Object
83 84 85 86 |
# File 'lib/circus/cli.rb', line 83 def admit(name = nil, *apps) tool = BoothTool.new(LOGGER, LocalConfig.new) tool.admit(name, apps, ) end |
#alias(name, target) ⇒ Object
136 137 138 139 140 |
# File 'lib/circus/cli.rb', line 136 def alias(name, target) local_config = LocalConfig.new local_config.aliases[name] = target local_config.save! end |
#assemble ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/circus/cli.rb', line 34 def assemble load! output_path = File.([:output]) dev = [:dev] @app.assemble!(output_path, LOGGER, dev) if [:actstore] store = ActStoreClient.new([:actstore], LOGGER) @app.upload(output_path, store) end end |
#configure(target, name, config) ⇒ Object
128 129 130 131 132 133 |
# File 'lib/circus/cli.rb', line 128 def configure(target, name, config) connection = ConnectionBuilder.new().build(target) client = ClownClient.new(connection, LOGGER) client.configure(target, name, config).result end |
#connect(name, booth) ⇒ Object
method_option :jid, :required => true, :desc => ‘The deployer jid to connect as’ method_option :host, :required => true, :desc => ‘The XMPP host to connect to’ method_option :port, :type => :numeric, :default => 5222, :desc => ‘The XMPP port to connect to’ method_option :password, :required => true, :desc => ‘The XMPP user password’
74 75 76 77 78 79 |
# File 'lib/circus/cli.rb', line 74 def connect(name, booth) config = LocalConfig.new tool = BoothTool.new(LOGGER, config) tool.connect(name, booth, ) config.save! end |
#deploy(target, name, act) ⇒ Object
method_option :actstore, :required => true, :desc => ‘The store to retrieve the act from’ method_option :jid, :required => true, :desc => ‘The deployer jid to connect as’ method_option :host, :required => true, :desc => ‘The XMPP host to connect to’ method_option :port, :type => :numeric, :default => 5222, :desc => ‘The XMPP port to connect to’ method_option :password, :required => true, :desc => ‘The XMPP user password’
108 109 110 111 112 113 |
# File 'lib/circus/cli.rb', line 108 def deploy(target, name, act) connection = ConnectionBuilder.new().build(target) client = ClownClient.new(connection, LOGGER) client.deploy(target, name, act, [:config]).result end |
#exec(target, act_name, *cmd_parts) ⇒ Object
method_option :jid, :required => true, :desc => ‘The deployer jid to connect as’ method_option :host, :required => true, :desc => ‘The XMPP host to connect to’ method_option :port, :type => :numeric, :default => 5222, :desc => ‘The XMPP port to connect to’ method_option :password, :required => true, :desc => ‘The XMPP user password’
93 94 95 96 97 98 99 |
# File 'lib/circus/cli.rb', line 93 def exec(target, act_name, *cmd_parts) cmd = cmd_parts.join(' ') connection = ConnectionBuilder.new().build(target) client = ClownClient.new(connection, LOGGER) client.exec(target, act_name, cmd).result end |
#get_booth_key(booth) ⇒ Object
55 56 57 58 59 60 61 62 |
# File 'lib/circus/cli.rb', line 55 def get_booth_key(booth) connection = ConnectionBuilder.new().build(booth) client = BoothClient.new(connection, LOGGER) key = client.get_ssh_key(booth).result puts "SSH key for: #{booth}" puts " #{key}" end |
#go ⇒ Object
25 26 27 28 |
# File 'lib/circus/cli.rb', line 25 def go load! @app.go!(LOGGER) end |
#undeploy(target, name) ⇒ Object
method_option :jid, :required => true, :desc => ‘The deployer jid to connect as’ method_option :host, :required => true, :desc => ‘The XMPP host to connect to’ method_option :port, :type => :numeric, :default => 5222, :desc => ‘The XMPP port to connect to’ method_option :password, :required => true, :desc => ‘The XMPP user password’
120 121 122 123 124 125 |
# File 'lib/circus/cli.rb', line 120 def undeploy(target, name) connection = ConnectionBuilder.new().build(target) client = ClownClient.new(connection, LOGGER) client.undeploy(target, name).result end |
#upload(fn) ⇒ Object
49 50 51 52 |
# File 'lib/circus/cli.rb', line 49 def upload(fn) store = ActStoreClient.new([:actstore], LOGGER) store.upload_act(fn) end |