class SimpleDeploySSH

Constants

VERSION

Public Class Methods

new(env_name, stack_name, instance_name) click to toggle source
# File lib/simple_deploy_ssh.rb, line 4
def initialize(env_name, stack_name, instance_name)
  @env_name      = env_name
  @stack_name    = stack_name
  @instance_name = instance_name
end

Public Instance Methods

connect!() click to toggle source
# File lib/simple_deploy_ssh.rb, line 10
def connect!
  Kernel.exec ssh_command
end

Private Instance Methods

full_stack_name() click to toggle source
# File lib/simple_deploy_ssh.rb, line 20
def full_stack_name
  fsn = list.find { |line| line.match /-\d-#@stack_name-\d-#@instance_name-\d/ }
  raise "instance not found" if fsn.nil?
  fsn
end
ip() click to toggle source
# File lib/simple_deploy_ssh.rb, line 26
def ip
  command = "simple_deploy instances -e #@env_name -n #{full_stack_name}"
  `#{command}`.split.first
end
list() click to toggle source
# File lib/simple_deploy_ssh.rb, line 15
def list
  command = "simple_deploy list -e #@env_name"
  `#{command}`.split
end
ssh_command() click to toggle source
# File lib/simple_deploy_ssh.rb, line 31
def ssh_command
  "ssh #{ip}"
end