Class: Qtc::Cli::Mar::Stack

Inherits:
Base
  • Object
show all
Defined in:
lib/qtc/cli/mar/stack.rb

Instance Attribute Summary

Attributes included from Common

#datacenter_id

Instance Method Summary collapse

Methods included from Common

#client, #current_cloud_dc, #current_cloud_id, #current_cloud_token, #extract_app_in_dir, #ini_filename, #inifile, #instance_info, #platform_base_url, #platform_client

Instance Method Details

#show(options) ⇒ Object



18
19
20
21
22
23
24
25
26
# File 'lib/qtc/cli/mar/stack.rb', line 18

def show(options)
  instance_id = resolve_instance_id(options)
  instance_data = instance_info(instance_id)
  if instance_data
    env_vars = client.get("/apps/#{instance_id}/env_vars", {}, {'Authorization' => "Bearer #{current_cloud_token}"})
    puts "App is using stack: #{env_vars['STACK']}"
    puts ""
  end
end

#update(name, options) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/qtc/cli/mar/stack.rb', line 7

def update(name, options)
  instance_id = resolve_instance_id(options)
  instance_data = instance_info(instance_id)
  if instance_data
    client.put("/apps/#{instance_id}", {stack: name}, nil, {'Authorization' => "Bearer #{current_cloud_token}"})
    puts "Stack is now set to: #{name}"
    puts "Next release on #{instance_data['name']} will use #{name} stack."
    puts "Use `git push <remote> master` to create new release on #{name}"
  end
end