class Warg::Context

Attributes

argv[R]
parser[R]

Public Class Methods

new(argv) click to toggle source
Calls superclass method Warg::Config::new
# File lib/warg.rb, line 1381
def initialize(argv)
  @argv = argv
  @parser = OptionParser.new
  @playlist = Playlist.new

  @parser.on("-t", "--target HOSTS", Array, "hosts to use") do |hosts_data|
    hosts_data.each { |host_data| hosts.add(host_data) }
  end

  super()
end

Public Instance Methods

copy(config) click to toggle source
# File lib/warg.rb, line 1407
def copy(config)
  config.hosts.each do |host|
    hosts.add(host)
  end

  config.variables_sets.each do |variables_name|
    variables(variables_name) do |variables_object|
      variables_object.copy config.instance_variable_get("@#{variables_name}")
    end
  end
end
parse_options!() click to toggle source
# File lib/warg.rb, line 1393
def parse_options!
  @parser.parse(@argv)
end
queue!(command) click to toggle source
# File lib/warg.rb, line 1397
def queue!(command)
  @playlist.queue(command)
end
run!() click to toggle source
# File lib/warg.rb, line 1401
def run!
  Console.hostname_width = hosts.map { |host| host.address.length }.max

  @playlist.start
end