Class: Machines::Upload
Instance Attribute Summary collapse
-
#local ⇒ Object
Returns the value of attribute local.
-
#remote ⇒ Object
Returns the value of attribute remote.
Attributes inherited from Command
Instance Method Summary collapse
- #info ⇒ Object
-
#initialize(local, remote, check) ⇒ Upload
constructor
A new instance of Upload.
- #run ⇒ Object
Methods inherited from Command
scp, scp=, ssh, ssh=, #use_sudo
Constructor Details
#initialize(local, remote, check) ⇒ Upload
Returns a new instance of Upload.
5 6 7 8 |
# File 'lib/machines/upload.rb', line 5 def initialize(local, remote, check) super(nil, check) @local, @remote = local, remote end |
Instance Attribute Details
#local ⇒ Object
Returns the value of attribute local.
3 4 5 |
# File 'lib/machines/upload.rb', line 3 def local @local end |
#remote ⇒ Object
Returns the value of attribute remote.
3 4 5 |
# File 'lib/machines/upload.rb', line 3 def remote @remote end |
Instance Method Details
#info ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/machines/upload.rb', line 16 def info name = local if local.is_a?(NamedBuffer) if local.name name = "buffer from #{local.name}" else name = "unnamed buffer" end end "UPLOAD #{name} to #{remote}" end |
#run ⇒ Object
10 11 12 13 14 |
# File 'lib/machines/upload.rb', line 10 def run process do @@scp.upload!(local, remote, {:recursive => local.is_a?(String) && File.directory?(local)}) end end |