Class: Fulmar::Infrastructure::Service::CopyService
- Inherits:
-
Object
- Object
- Fulmar::Infrastructure::Service::CopyService
- Defined in:
- lib/fulmar/infrastructure/service/copy_service.rb
Overview
Provides access to composer
Class Method Summary collapse
-
.download(shell, remote_host, remote_file, local_dir = '.') ⇒ Object
Downloads a file from a remote server.
-
.upload(shell, local_file, remote_host, remote_dir) ⇒ Object
Copies a file to a remote server.
Class Method Details
.download(shell, remote_host, remote_file, local_dir = '.') ⇒ Object
Downloads a file from a remote server
22 23 24 25 26 |
# File 'lib/fulmar/infrastructure/service/copy_service.rb', line 22 def self.download(shell, remote_host, remote_file, local_dir = '.') if shell.run "scp -Cr #{remote_host}:#{remote_file} #{local_dir.chomp('/')}/" "#{local_dir.chomp('/')}/#{File.basename(remote_file)}" end end |
.upload(shell, local_file, remote_host, remote_dir) ⇒ Object
Copies a file to a remote server
11 12 13 14 15 |
# File 'lib/fulmar/infrastructure/service/copy_service.rb', line 11 def self.upload(shell, local_file, remote_host, remote_dir) if shell.run "scp -Cr #{local_file} #{remote_host}:#{remote_dir.chomp('/')}/" "#{remote_dir.chomp('/')}/#{File.basename(local_file)}" end end |