Parent

Methods

Files

Class/Module Index [+]

Quicksearch

Fog::SCP::Real

Public Class Methods

new(address, username, options) click to toggle source
# File lib/fog/core/scp.rb, line 34
def initialize(address, username, options)
  require 'net/scp'

  key_manager = Net::SSH::Authentication::KeyManager.new(nil, options)

  unless options[:key_data] || options[:keys] || options[:password] || key_manager.agent
    raise ArgumentError.new(':key_data, :keys, :password or a loaded ssh-agent is required to initialize SSH')
  end

  @address  = address
  @username = username
  @options  = { :paranoid => false }.merge(options)
end

Public Instance Methods

upload(local_path, remote_path, upload_options = {} ) click to toggle source
# File lib/fog/core/scp.rb, line 48
def upload(local_path, remote_path, upload_options = {} )
  begin
    Net::SCP.start(@address, @username, @options) do |scp|
      scp.upload!(local_path, remote_path, upload_options ) do |ch, name, sent, total|
        # TODO: handle progress display?
      end
    end
  rescue Exception => error
    raise error
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.