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)


269
270
271
272
273
# File 'lib/cute/taktuk.rb', line 269

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.



275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
# File 'lib/cute/taktuk.rb', line 275

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