class Fleetctl::Command

Attributes

command[RW]

Public Class Methods

new(*cmd) { |runner| ... } click to toggle source
# File lib/fleetctl/command.rb, line 12
def initialize(*cmd)
  @command = cmd
  yield(runner) if block_given?
end
run(*cmd, &blk) click to toggle source
# File lib/fleetctl/command.rb, line 6
def run(*cmd, &blk)
  obj = new(*cmd, &blk)
  obj.run
end

Public Instance Methods

run(*args) click to toggle source
# File lib/fleetctl/command.rb, line 17
def run(*args)
  runner.run(*args)
  runner
end
runner() click to toggle source
# File lib/fleetctl/command.rb, line 22
def runner
  klass = "Fleetctl::Runner::#{Fleetctl.options.runner_class}".constantize
  @runner ||= klass.new(expression)
end

Private Instance Methods

executable() click to toggle source
# File lib/fleetctl/command.rb, line 37
def executable
  Fleetctl.options.executable
end
expression() click to toggle source
# File lib/fleetctl/command.rb, line 41
def expression
  [prefix, executable, global_options, command].flatten.compact.join(' ')
end
global_options() click to toggle source
# File lib/fleetctl/command.rb, line 29
def global_options
  Fleetctl.options.global.map { |k,v| "--#{k.to_s.gsub('_','-')}=#{v}" }
end
prefix() click to toggle source
# File lib/fleetctl/command.rb, line 33
def prefix
  Fleetctl.options.command_prefix
end