Class: Geminabox::Proxy::Copier
Instance Attribute Summary
Attributes inherited from FileHandler
#file_name
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from FileHandler
#file_exists?, #initialize, #local_content, #local_file_exists?, #local_path, #proxy_file_exists?, #proxy_folder_name, #proxy_folder_path, #proxy_path, #remote_content, #remote_url, #root_path
Class Method Details
.copy(file_name) ⇒ Object
7
8
9
10
11
|
# File 'lib/geminabox/proxy/copier.rb', line 7
def self.copy(file_name)
copier = new(file_name)
copier.get_file
copier
end
|
Instance Method Details
#copy_local ⇒ Object
19
20
21
|
# File 'lib/geminabox/proxy/copier.rb', line 19
def copy_local
FileUtils.cp local_path, proxy_path
end
|
#get_file ⇒ Object
13
14
15
16
17
|
# File 'lib/geminabox/proxy/copier.rb', line 13
def get_file
return true if proxy_file_exists?
return copy_local if local_file_exists?
get_remote
end
|
#get_remote ⇒ Object
23
24
25
|
# File 'lib/geminabox/proxy/copier.rb', line 23
def get_remote
File.open(proxy_path, 'w'){|f| f.write(remote_content)}
end
|