Sha256: 0cba51ed6c68cb99175d2a2cc4e0b36c21ab97c1c950d4cd234f95b45ef1525e

Contents?: true

Size: 689 Bytes

Versions: 3

Compression:

Stored size: 689 Bytes

Contents

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


module Frank
  module Publish
    class SCP < Base

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

        @port ||= 22
      end


      def connection
        Net::SCP.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/scp.rb
frank-1.0.11 lib/frank/publish/scp.rb
frank-1.0.10 lib/frank/publish/scp.rb