class ScpUtils

Public Class Methods

local(*candidates) click to toggle source
# File lib/commons.rb, line 159
def self.local(*candidates)
    candidates.each do |c|
        return c if c
    end
    
    return "."
end
remote(local, file) click to toggle source
# File lib/commons.rb, line 145
def self.remote(local, file)
    user = file.user
    port = file.port
    host = file.host
    path = file.path
    
    userstring = user ? user + "@" : ""
    
    remotepath = path
    remotepath = File.join(remotepath, local) if local && local != "."
    
    result = "#{userstring}#{host}:#{remotepath}"
end
scp(from, to, dir, port=nil) click to toggle source
# File lib/commons.rb, line 167
def self.scp(from, to, dir, port=nil)
    dirstring = dir ? "-r" : ""
    portstring = port ? "-P " + port : ""
    
    return "scp #{portstring} #{dirstring} \"#{from}\" \"#{to}\""
end