Class: Rsh::Drivers::Local
Instance Attribute Summary
Attributes inherited from Abstract
#options
Instance Method Summary
collapse
Methods inherited from Abstract
#generate_tmp_dir_name, #initialize
Instance Method Details
#create_directory(path) ⇒ Object
23
24
25
|
# File 'lib/rsh/drivers/local.rb', line 23
def create_directory path
Dir.mkdir path
end
|
#download_directory(from_remote_path, to_local_path) ⇒ Object
35
36
37
|
# File 'lib/rsh/drivers/local.rb', line 35
def download_directory from_remote_path, to_local_path
FileUtils.cp_r from_remote_path, to_local_path
end
|
#download_file(from_remote_path, to_local_path) ⇒ Object
8
9
10
|
# File 'lib/rsh/drivers/local.rb', line 8
def download_file from_remote_path, to_local_path
FileUtils.copy from_remote_path, to_local_path
end
|
#exec(command) ⇒ Object
39
40
41
42
43
44
45
|
# File 'lib/rsh/drivers/local.rb', line 39
def exec command
code, stdout, stderr = Open3.popen3 command do |stdin, stdout, stderr, waitth|
[waitth.value.to_i, stdout.read, stderr.read]
end
return code, stdout, stderr
end
|
#exist?(remote_file_path) ⇒ Boolean
Also known as:
directory_exist?, file_exist?
12
13
14
|
# File 'lib/rsh/drivers/local.rb', line 12
def exist? remote_file_path
File.exist? remote_file_path
end
|
#remove_directory(path) ⇒ Object
27
28
29
|
# File 'lib/rsh/drivers/local.rb', line 27
def remove_directory path
FileUtils.rm_r path
end
|
#remove_file(remote_file_path) ⇒ Object
19
20
21
|
# File 'lib/rsh/drivers/local.rb', line 19
def remove_file remote_file_path
File.delete remote_file_path
end
|
#upload_directory(from_local_path, to_remote_path) ⇒ Object
31
32
33
|
# File 'lib/rsh/drivers/local.rb', line 31
def upload_directory from_local_path, to_remote_path
FileUtils.cp_r from_local_path, to_remote_path
end
|
#upload_file(from_local_path, to_remote_path) ⇒ Object
4
5
6
|
# File 'lib/rsh/drivers/local.rb', line 4
def upload_file from_local_path, to_remote_path
FileUtils.copy from_local_path, to_remote_path
end
|