Sha256: 1e49d0a7b07c049b04e52608447e2d7cd316b67f49b666ab676c0f6e2c367555

Contents?: true

Size: 657 Bytes

Versions: 5

Compression:

Stored size: 657 Bytes

Contents

module Keyrack
  module Store
    class SSH
      def initialize(options)
        @host = options['host']
        @user = options['user']
        @path = options['path']
        @port = options['port'] || 22
      end

      def read
        begin
          result = nil
          Net::SSH.start(@host, @user, :port => @port) do |ssh|
            result = ssh.scp.download!(@path)
          end
          result
        rescue Net::SCP::Error
          nil
        end
      end

      def write(data)
        Net::SSH.start(@host, @user, :port => @port) do |ssh|
          ssh.scp.upload!(StringIO.new(data), @path)
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
keyrack-0.3.2 lib/keyrack/store/ssh.rb
keyrack-0.3.1 lib/keyrack/store/ssh.rb
keyrack-0.3.0 lib/keyrack/store/ssh.rb
keyrack-0.3.0.pre lib/keyrack/store/ssh.rb
keyrack-0.2.3 lib/keyrack/store/ssh.rb