Class: Grifork::Config::SSH

Inherits:
Object
  • Object
show all
Defined in:
lib/grifork/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ SSH

Returns a new instance of SSH.



55
56
57
# File 'lib/grifork/config.rb', line 55

def initialize(opts = {})
  @options = opts
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



54
55
56
# File 'lib/grifork/config.rb', line 54

def options
  @options
end

Instance Method Details

#command_for_rsyncString

Build ssh command with options

Returns:

  • (String)

    ssh command with options



61
62
63
64
65
66
67
68
69
# File 'lib/grifork/config.rb', line 61

def command_for_rsync
  args = []
  args << "-l #{@options[:user]}" if @options[:user]
  args << "-p #{@options[:port]}" if @options[:port]
  if @options[:keys]
    @options[:keys].each { |key| args << "-i #{key}" }
  end
  "ssh #{args.join(' ')}"
end