Sha256: f770457776cd74bd032f0d1927cad079aefb4570f689a00cae80c39538988f86

Contents?: true

Size: 730 Bytes

Versions: 1

Compression:

Stored size: 730 Bytes

Contents

require 'forwardable'
require 'shellwords'

module Taketo
  module Commands

    class SSHCommand
      extend Forwardable
      include Shellwords

      def initialize(server, options = {})
        @server = server
      end

      def render(rendered_command)
        %Q[ssh -t #{port} #{identity_file} #{username}#{host} "#{rendered_command}"].squeeze(" ")
      end

      def host
        shellescape @server.host
      end

      def port
        %Q[-p #{@server.port}] if @server.port
      end

      def username
        %Q[#{shellescape @server.username}@] if @server.username
      end

      def identity_file
        %Q[-i #{shellescape @server.identity_file}] if @server.identity_file
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
taketo-0.2.0 lib/taketo/commands/ssh_command.rb