Sha256: 2b40b68bb9450c7237b3240098c3e8d8b0753f6d55fd0b999e3150fa9e4a25c0
Contents?: true
Size: 1.46 KB
Versions: 6
Compression:
Stored size: 1.46 KB
Contents
module Fog module SCP def self.new(address, username, options = {}) if Fog.mocking? Fog::SCP::Mock.new(address, username, options) else Fog::SCP::Real.new(address, username, options) end end class Mock def self.data @data ||= Hash.new do |hash, key| hash[key] = {} end end def initialize(address, username, options) @address = address @username = username @options = options end def upload(local_path, remote_path) Fog::Mock.not_implemented end end class Real 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 def upload(local_path, remote_path) begin Net::SCP.start(@address, @username, @options) do |scp| scp.upload!(local_path, remote_path) do |ch, name, sent, total| # TODO: handle progress display? end end rescue Exception => error raise error end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems
Version | Path |
---|---|
fog-0.8.2 | lib/fog/core/scp.rb |
fog-0.8.1 | lib/fog/core/scp.rb |
fog-0.8.0 | lib/fog/core/scp.rb |
fog-0.7.2 | lib/fog/core/scp.rb |
fog-0.7.1 | lib/fog/core/scp.rb |
fog-0.7.0 | lib/fog/core/scp.rb |