Class: Stackato::Commands
- Inherits:
-
Object
- Object
- Stackato::Commands
- Defined in:
- lib/conan/stackato.rb
Constant Summary collapse
- @@executable =
"stackato-3.1.1"
- @@token_file =
File.join(Dir.tmpdir(), "token_#{Time.now.to_i}")
Instance Method Summary collapse
- #delete(app_name) ⇒ Object
-
#initialize(target, dry_run = false) ⇒ Commands
constructor
A new instance of Commands.
- #login(username, password, space) ⇒ Object
- #map(app_name, url) ⇒ Object
- #push(manifest) ⇒ Object
- #shell_cmd(stackato_cmd, args) ⇒ Object
Constructor Details
#initialize(target, dry_run = false) ⇒ Commands
Returns a new instance of Commands.
10 11 12 13 |
# File 'lib/conan/stackato.rb', line 10 def initialize(target, dry_run=false) @target = target @dry_run = dry_run end |
Instance Method Details
#delete(app_name) ⇒ Object
35 36 37 |
# File 'lib/conan/stackato.rb', line 35 def delete(app_name) shell_cmd("delete", "--no-prompt #{app_name}") end |
#login(username, password, space) ⇒ Object
27 28 29 |
# File 'lib/conan/stackato.rb', line 27 def login(username, password, space) shell_cmd("login", "--space #{space} --password '#{password}' #{username}") end |
#map(app_name, url) ⇒ Object
39 40 41 |
# File 'lib/conan/stackato.rb', line 39 def map(app_name, url) shell_cmd("map", "#{app_name} #{url}") end |
#push(manifest) ⇒ Object
31 32 33 |
# File 'lib/conan/stackato.rb', line 31 def push(manifest) shell_cmd("push", "--manifest #{manifest} --no-prompt --reset") end |
#shell_cmd(stackato_cmd, args) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/conan/stackato.rb', line 15 def shell_cmd(stackato_cmd, args) base_args = "--target #{@target} --token-file #{@@token_file}" cmd = "#{@@executable} #{stackato_cmd} #{base_args} #{args}" if @dry_run puts "Dry-run, skipping execution of command: #{cmd}" else system(cmd) end end |