Class: SshShort::Connection

Inherits:
Object
  • Object
show all
Defined in:
lib/ssh_short/connection.rb

Class Method Summary collapse

Class Method Details

.connect(ip_address, username, key_path) ⇒ Object



5
6
7
8
9
# File 'lib/ssh_short/connection.rb', line 5

def self.connect(ip_address, username, key_path)
  key_name = File.basename key_path
  puts "Connecting as #{username} to #{ip_address} using #{key_name}"
  system "ssh -i #{key_path} #{username}@#{ip_address}"
end

.pull(ip_address, username, key_path, source, target) ⇒ Object



17
18
19
20
21
# File 'lib/ssh_short/connection.rb', line 17

def self.pull(ip_address, username, key_path, source, target)
  key_name = File.basename key_path
  puts "Pulling #{source} from #{ip_address} as #{username} to #{target} using #{key_name}"
  system "scp -r -i #{key_path} #{username}@#{ip_address}:#{source} #{target}"
end

.push(ip_address, username, key_path, source, target) ⇒ Object



11
12
13
14
15
# File 'lib/ssh_short/connection.rb', line 11

def self.push(ip_address, username, key_path, source, target)
  key_name = File.basename key_path
  puts "Pushing #{source} to #{ip_address} at #{target} as #{username} using #{key_name}"
  system "scp -r -i #{key_path} #{source} #{username}@#{ip_address}:#{target}"
end