Class: Conjure::Service::RemoteFileSet
- Inherits:
-
Object
- Object
- Conjure::Service::RemoteFileSet
- Defined in:
- lib/conjure/service/remote_file_set.rb
Instance Method Summary collapse
-
#initialize(options) ⇒ RemoteFileSet
constructor
A new instance of RemoteFileSet.
- #remove ⇒ Object
- #upload ⇒ Object
Constructor Details
#initialize(options) ⇒ RemoteFileSet
Returns a new instance of RemoteFileSet.
6 7 8 9 |
# File 'lib/conjure/service/remote_file_set.rb', line 6 def initialize() @shell = [:shell] @files = [:files].to_a end |
Instance Method Details
#remove ⇒ Object
19 20 21 |
# File 'lib/conjure/service/remote_file_set.rb', line 19 def remove @files.each{|local_path, remote_path| @shell.run "rm -f #{remote_path}"} end |
#upload ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/conjure/service/remote_file_set.rb', line 11 def upload dir_names = @files.map{|local_path, remote_path| File.dirname remote_path}.uniq @shell.run "mkdir -p #{dir_names.join ' '}" if dir_names.any? @files.each do |local_path, remote_path| @shell.session.scp.upload! local_path, remote_path end end |