Class: CF::Deploy::Commands
- Inherits:
-
Object
- Object
- CF::Deploy::Commands
- Defined in:
- lib/cf/deploy/commands.rb
Instance Method Summary collapse
- #live_color(host) ⇒ Object
- #login(config) ⇒ Object
- #map_route(route, app_name) ⇒ Object
- #push(manifest) ⇒ Object
- #scale_instances(app_name, instances) ⇒ Object
- #scale_memory(app_name, memory) ⇒ Object
- #stop(app_name) ⇒ Object
- #unmap_route(route, app_name) ⇒ Object
Instance Method Details
#live_color(host) ⇒ Object
38 39 40 41 42 43 44 |
# File 'lib/cf/deploy/commands.rb', line 38 def live_color(host) io = IO.popen("cf routes | grep '#{host}'") matches = /(blue|green)/.match(io.read) io.close return if matches.nil? matches[1].strip end |
#login(config) ⇒ Object
4 5 6 7 8 9 10 11 12 |
# File 'lib/cf/deploy/commands.rb', line 4 def login(config) login_cmd = ['cf login'] login_cmd << Config::VALID_CF_KEYS .reject { |key| config[key].nil? } .map { |key| "-#{key.to_s[0]} '#{config[key]}'" } Kernel.system(login_cmd.flatten.join(' ')) end |
#map_route(route, app_name) ⇒ Object
30 31 32 |
# File 'lib/cf/deploy/commands.rb', line 30 def map_route(route, app_name) Kernel.system(route_cmd(:map, route, app_name)) end |
#push(manifest) ⇒ Object
14 15 16 |
# File 'lib/cf/deploy/commands.rb', line 14 def push(manifest) Kernel.system("cf push -f #{manifest}") end |
#scale_instances(app_name, instances) ⇒ Object
26 27 28 |
# File 'lib/cf/deploy/commands.rb', line 26 def scale_instances(app_name, instances) Kernel.system("cf scale #{app_name} -i #{instances}") end |
#scale_memory(app_name, memory) ⇒ Object
22 23 24 |
# File 'lib/cf/deploy/commands.rb', line 22 def scale_memory(app_name, memory) Kernel.system("cf scale #{app_name} -f -m #{memory}") end |
#stop(app_name) ⇒ Object
18 19 20 |
# File 'lib/cf/deploy/commands.rb', line 18 def stop(app_name) Kernel.system("cf stop #{app_name}") end |
#unmap_route(route, app_name) ⇒ Object
34 35 36 |
# File 'lib/cf/deploy/commands.rb', line 34 def unmap_route(route, app_name) Kernel.system(route_cmd(:unmap, route, app_name)) end |