lib/fig/protocol/ssh.rb
# Returns whether the file was not downloaded because the file already
# exists and is already up-to-date.
Returns whether the file was not downloaded because the file already
exists and is already up-to-date.
Returns whether the file was not downloaded because the file already exists and is already up - to - date .
def download(uri, path, prompt_for_login)
    unescaped_path = CGI.unescape uri.path
    exists = remote_path_exists(uri.host, unescaped_path) {
      |error_message|
      raise Fig::NetworkError.new(
        "Unable to determine whether #{uri} exists: #{error_message}",
      )
    }
    if not exists
      raise Fig::FileNotFoundError.new "#{uri} doesn't exist.", uri
    end
    scp("#{uri.host}:#{unescaped_path}", path) {
      |error_message|
      raise Fig::NetworkError.new(
        "Unable to copy remote file to #{path}: #{error_message}",
      )
    }
    return true
  end
def download ( uri , path , prompt_for_login ) unescaped_path = CGI . unescape uri . path exists = remote_path_exists ( uri . host , unescaped_path ) { | error_message | raise Fig :: NetworkError . new ( "Unable to determine whether #{uri} exists: #{error_message}" , ) } if not exists raise Fig :: FileNotFoundError . new "#{uri} doesn't exist." , uri end scp ( "#{uri.host}:#{unescaped_path}" , path ) { | error_message | raise Fig :: NetworkError . new ( "Unable to copy remote file to #{path}: #{error_message}" , ) } return true end
Returns whether the file was not downloaded because the file already
exists and is already up-to-date.
Returns whether the file was not downloaded because the file already exists and is already up - to - date .
uri
path
prompt_for_login