Class: Cute::TakTuk::Options Private

Inherits:
Hash
  • Object
show all
Defined in:
lib/cute/taktuk.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Validates taktuk options

Constant Summary collapse

TAKTUK_VALID =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

[
 'begin-group', 'connector', 'dynamic', 'end-group', 'machines-file',
 'login', 'machine', 'self-propagate', 'dont-self-propagate',
 'args-file', 'gateway', 'perl-interpreter', 'localhost',
 'send-files', 'taktuk-command', 'path-value', 'command-separator',
 'escape-character', 'option-separator', 'output-redirect',
 'worksteal-behavior', 'time-granularity', 'no-numbering', 'timeout',
 'cache-limit', 'window','window-adaptation','not-root','debug'
]
WRAPPER_VALID =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

user is an alias for login

[ 'streams', 'port', 'keys', 'user', 'config' ]

Instance Method Summary collapse

Instance Method Details

#check(optname) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Raises:

  • (ArgumentError)


212
213
214
215
216
# File 'lib/cute/taktuk.rb', line 212

def check(optname)
  ret = optname.to_s.gsub(/_/,'-').strip
  raise ArgumentError.new("Invalid TakTuk option '--#{ret}'") unless TAKTUK_VALID.include?(ret)
  ret
end

#to_cmdObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
# File 'lib/cute/taktuk.rb', line 218

def to_cmd

  self[:login] = self[:user] if keys.include?(:user)
  self.keys.inject([]) do |ret,opt|
    if not WRAPPER_VALID.include?(opt.to_s) then
      ret << "--#{check(opt)}"
      if self[opt]
        if self[opt].is_a?(String)
          ret << self[opt] unless self[opt].empty?
        else
          ret << self[opt].to_s
        end
      end
    end
    ret
  end
end