Sha256: 25bde2e5a21fe5095455ff2d928cedd5c459c1a3500ecf0dcbdcc0a40eff50ee

Contents?: true

Size: 692 Bytes

Versions: 3

Compression:

Stored size: 692 Bytes

Contents

require 'frank/publish/base'
require 'net/ssh'
require 'net/sftp'


module Frank
  module Publish
    class SFTP < Base

      def initialize(options, &block)
        super(options)
        instance_eval(&block) if block_given?

        @port ||= 22
      end


      def connection
        Net::SFTP.start(hostname, username, :password => password) do |scp|
          yield scp
        end
      end

      def transfer!
        connection do |scp|
          old_name = ''
          scp.upload! local_path, remote_path do |ch, name|
            if old_name != name
              ok_message "Uploading #{name}", "    - "
            end
          end
        end
      end

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
frank-1.0.12 lib/frank/publish/sftp.rb
frank-1.0.11 lib/frank/publish/sftp.rb
frank-1.0.10 lib/frank/publish/sftp.rb