Class: Captivate::RemoteDir
- Inherits:
-
Object
- Object
- Captivate::RemoteDir
- Defined in:
- lib/captivate.rb
Instance Method Summary collapse
-
#initialize(options) ⇒ RemoteDir
constructor
A new instance of RemoteDir.
- #new_subdir(dirname) ⇒ Object
- #upload(file_path, dest_filename = file_path) ⇒ Object
Constructor Details
#initialize(options) ⇒ RemoteDir
Returns a new instance of RemoteDir.
131 132 133 134 |
# File 'lib/captivate.rb', line 131 def initialize() @host, @path = [:host], [:path] SystemCall.new("ssh #{@host} mkdir #{@path}") end |
Instance Method Details
#new_subdir(dirname) ⇒ Object
145 146 147 |
# File 'lib/captivate.rb', line 145 def new_subdir(dirname) self.class.new(:host => @host, :path => "#{@path}/#{dirname}") end |
#upload(file_path, dest_filename = file_path) ⇒ Object
136 137 138 139 140 141 142 143 |
# File 'lib/captivate.rb', line 136 def upload(file_path, dest_filename = file_path) raise(Errno::ENOENT, file_path) unless File.exists?(file_path) if File.directory?(file_path) SystemCall.new("scp -r #{file_path} #{@host}:#{@path}/#{File.basename(dest_filename)}") else SystemCall.new("scp #{file_path} #{@host}:#{@path}/#{File.basename(dest_filename)}") end end |