module Fig::Protocol
File
transfers.
Public Instance Methods
download(uri, path)
click to toggle source
Returns whether the file was not downloaded because the file already exists and is already up-to-date.
# File lib/fig/protocol.rb, line 23 def download(uri, path) Fig::Logging.fatal "Protocol not supported: #{uri}" raise Fig::NetworkError.new "Protocol not supported: #{uri}" end
download_list(uri)
click to toggle source
# File lib/fig/protocol.rb, line 10 def download_list(uri) Fig::Logging.fatal "Protocol not supported: #{uri}" raise Fig::NetworkError.new "Protocol not supported: #{uri}" end
path_up_to_date?(uri, path)
click to toggle source
Determine whether we need to update something. Returns nil to indicate “don't know”.
# File lib/fig/protocol.rb, line 17 def path_up_to_date?(uri, path) return nil # Not implemented end
upload(local_file, uri)
click to toggle source
# File lib/fig/protocol.rb, line 28 def upload(local_file, uri) Fig::Logging.fatal "Protocol not supported: #{uri}" raise Fig::NetworkError.new "Protocol not supported: #{uri}" end
Private Instance Methods
log_download(uri, path)
click to toggle source
# File lib/fig/protocol.rb, line 46 def log_download(uri, path) Fig::Logging.debug "Downloading #{uri} to #{path}." end
strip_paths_for_list(ls_output, packages, path)
click to toggle source
# File lib/fig/protocol.rb, line 35 def strip_paths_for_list(ls_output, packages, path) if not ls_output.nil? ls_output = ls_output.gsub(path + '/', '').gsub(path, '').split("\n") ls_output.each do |line| parts = line.gsub(/\\/, '/').sub(/^\.\//, '').sub(/:$/, '').chomp().split('/') packages << parts.join('/') if parts.size == 2 end end end