Sha256: 7cf9d0b603010be802db54624747089b138fcb092274bdf109cee6539680f9c0

Contents?: true

Size: 769 Bytes

Versions: 1

Compression:

Stored size: 769 Bytes

Contents

require 'net/scp'

module Astrovan
  module Transfer
    # Write to a file on the remote servers.
    #
    # Options:
    # * +to+ - the path to the new file
    def put(data, options = {})
      upload StringIO.new(data), options
    end

    # Upload a file to the remote servers.
    #
    # Options:
    # * +to+ - the path to the new file
    def upload(from, options = {})
      raise ArgumentError, "You must provide a target using the :to option" unless to = options.delete(:to)
      session = session_for(options.delete(:on))
      begin
        session.server_list.each do |server|
          server.session(true).scp.upload(from, to)
        end
        session.loop
      ensure
        session.close if session != self.session
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sbfaulkner-astrovan-0.5.8 lib/astrovan/transfer.rb