Class: Kontena::Plugin::Cloud::Platform::UseCommand

Inherits:
Command
  • Object
show all
Includes:
Cli::Common, Organization::Common, Common
Defined in:
lib/kontena/plugin/cloud/platform/use_command.rb

Constant Summary

Constants included from CloudCommand

CloudCommand::PLATFORM_NOT_SELECTED_ERROR

Instance Method Summary collapse

Methods included from Organization::Common

#fetch_organizations, #prompt_organization

Methods included from Common

#cached_platforms, #current_organization, #current_platform, #fetch_platforms, #fetch_platforms_for_org, #find_platform_by_name, #login_to_platform, #parse_platform_name, #platform_config_exists?, #prompt_platform, #require_platform

Methods included from CloudCommand

#verify_current_grid, #verify_current_master, #verify_current_master_token

Instance Method Details

#executeObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/kontena/plugin/cloud/platform/use_command.rb', line 13

def execute
  if name && name.include?('/')
    platform = require_platform(name)
  else
    @current_organization = prompt_organization
    platform = prompt_platform
    require_platform(platform.to_path)
  end

  config.current_master = platform.to_path
  config.current_master.grid = platform.grid_id
  config.write
  puts "Using platform: #{pastel.cyan(platform.to_path)}"
end