class Chake::Backend::Ssh

Public Instance Methods

command_runner() click to toggle source
# File lib/chake/backend/ssh.rb, line 23
def command_runner
  [ssh_prefix, 'ssh', ssh_config, ssh_options, ssh_target].flatten.compact
end
rsync() click to toggle source
# File lib/chake/backend/ssh.rb, line 15
def rsync
  [ssh_prefix, 'rsync', rsync_ssh].flatten.compact
end
rsync_dest() click to toggle source
# File lib/chake/backend/ssh.rb, line 19
def rsync_dest
  [ssh_target, node.path + '/'].join(':')
end
scp() click to toggle source
# File lib/chake/backend/ssh.rb, line 7
def scp
  ['scp', ssh_config, scp_options].flatten.compact
end
scp_dest() click to toggle source
# File lib/chake/backend/ssh.rb, line 11
def scp_dest
  ssh_target + ':'
end
shell_command() click to toggle source
# File lib/chake/backend/ssh.rb, line 27
def shell_command
  command_runner
end

Private Instance Methods

rsync_ssh() click to toggle source
# File lib/chake/backend/ssh.rb, line 33
def rsync_ssh
  @rsync_ssh ||=
    begin
      ssh_command = 'ssh'
      if File.exist?(ssh_config_file)
        ssh_command +=  ' -F ' + ssh_config_file
      end
      if node.port
        ssh_command += ' -p ' + node.port.to_s
      end
      if ssh_command == 'ssh'
        []
      else
        ['-e', ssh_command]
      end
    end
end
scp_options() click to toggle source
# File lib/chake/backend/ssh.rb, line 71
def scp_options
  node.port && ['-P', node.port.to_s] || []
end
ssh_config() click to toggle source
# File lib/chake/backend/ssh.rb, line 51
def ssh_config
  File.exist?(ssh_config_file) && ['-F', ssh_config_file] || []
end
ssh_config_file() click to toggle source
# File lib/chake/backend/ssh.rb, line 55
def ssh_config_file
  @ssh_config_file ||= ENV.fetch('CHAKE_SSH_CONFIG', '.ssh_config')
end
ssh_options() click to toggle source
# File lib/chake/backend/ssh.rb, line 67
def ssh_options
  node.port && ['-p', node.port.to_s] || []
end
ssh_prefix() click to toggle source
# File lib/chake/backend/ssh.rb, line 59
def ssh_prefix
  @ssh_prefix ||= ENV.fetch('CHAKE_SSH_PREFIX', '').split
end
ssh_target() click to toggle source
# File lib/chake/backend/ssh.rb, line 63
def ssh_target
  [node.remote_username, node.hostname].compact.join('@')
end