Class: Inception::Cli

Constant Summary

Constants included from Inception::CliHelpers::Settings

Inception::CliHelpers::Settings::CONFIG_DIRECTORY

Instance Method Summary collapse

Methods included from Inception::CliHelpers::PrepareDeploySettings

#default_key_pair_name, #default_server_name, #private_key_path_for_inception, #provision_or_reuse_public_ip_address_for_inception, #recreate_key_pair_for_inception, #recreate_private_key_file_for_inception, #update_git_config, #validate_deploy_settings

Methods included from Inception::CliHelpers::Settings

#local_settings, #migrate_old_settings, #reload_settings!, #save_settings!, #settings, #settings_dir, #settings_path, #settings_ssh_dir

Methods included from Inception::CliHelpers::Provider

#fog_compute, #provider_client

Methods included from Inception::CliHelpers::Interactions

#bold, #clear, #cyan, #green, #hl, #red, #yellow

Methods included from Inception::CliHelpers::Display

#confirm, #error, #header

Instance Method Details

#deleteObject

method_option :“non-interactive”, aliases: [“-n”], type: :boolean, desc: “Don’t ask questions, just get crankin’”



40
41
42
43
# File 'lib/inception/cli.rb', line 40

def delete
  migrate_old_settings
  perform_delete(options[:"non-interactive"])
end

#deployObject



30
31
32
33
34
35
36
# File 'lib/inception/cli.rb', line 30

def deploy
  migrate_old_settings
  configure_provider
  prepare_deploy_settings
  perform_deploy
  converge_cookbooks
end

#share_ssh(name = settings.inception.name) ⇒ Object



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/inception/cli.rb', line 65

def share_ssh(name=settings.inception.name)
  user = settings.inception.provisioned.username
  host = settings.inception.provisioned.host
  private_key_path = "~/.ssh/#{name}"
  private_key = settings.inception.key_pair.private_key
  say "To access the inception server, add the following to your ~/.ssh/config\n\n  Host \#{name}\nUser \#{user}\nHostname \#{host}\nIdentityFile \#{private_key_path}\n\nCreate a file \#{private_key_path} with all the lines below:\n\n\#{private_key}\n\nChange the private key to be read-only to you:\n\n  $ chmod 700 ~/.ssh\n  $ chmod 600 \#{private_key_path}\n\nYou can now access the inception server running either:\n\n  $ ssh \#{name}\n  $ ssh \#{name} -t \"tmux attach || tmux new-session\"\n\n"
end

#ssh(cmd = nil) ⇒ Object



49
50
51
52
# File 'lib/inception/cli.rb', line 49

def ssh(cmd=nil)
  migrate_old_settings
  run_ssh_command_or_open_tunnel(cmd)
end

#tmuxObject



59
60
61
62
# File 'lib/inception/cli.rb', line 59

def tmux
  migrate_old_settings
  run_ssh_command_or_open_tunnel(["-t", "tmux attach || tmux new-session"])
end