Class: ScpUtils
- Inherits:
-
Object
- Object
- ScpUtils
- Defined in:
- lib/commons.rb
Class Method Summary collapse
Class Method Details
.local(*candidates) ⇒ Object
159 160 161 162 163 164 165 |
# File 'lib/commons.rb', line 159 def self.local(*candidates) candidates.each do |c| return c if c end return "." end |
.remote(local, file) ⇒ Object
145 146 147 148 149 150 151 152 153 154 155 156 157 |
# 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) ⇒ Object
167 168 169 170 171 172 |
# 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 |