module Warg::Command::BehaviorWithoutRegistration
Attributes
argv[R]
context[R]
hosts[R]
operations[R]
parser[R]
steps[R]
Public Class Methods
included(klass)
click to toggle source
# File lib/warg.rb, line 1907 def self.included(klass) klass.extend(ClassMethods) end
new(context)
click to toggle source
# File lib/warg.rb, line 1930 def initialize(context) @context = context @parser = @context.parser @hosts = @context.hosts @argv = @context.argv.dup configure_parser! @context.queue!(self) @steps = [] end
Public Instance Methods
SGR(text)
click to toggle source
# File lib/warg.rb, line 1982 def SGR(text) Console::SGR(text) end
call()
click to toggle source
# File lib/warg.rb, line 1947 def call setup self end
chain(*others)
click to toggle source
# File lib/warg.rb, line 1972 def chain(*others) others.inject(self) do |execution, command| execution | command end end
command_name()
click to toggle source
# File lib/warg.rb, line 1964 def command_name self.class.command_name end
name()
click to toggle source
# File lib/warg.rb, line 1943 def name command_name.cli end
on_failure(execution_result)
click to toggle source
# File lib/warg.rb, line 1978 def on_failure(execution_result) exit 1 end
run()
click to toggle source
# File lib/warg.rb, line 1955 def run Warg.console.puts Console::SGR(command_name.console).with(text_color: :blue, effect: :bold) @steps.each do |deferred| Warg.console.puts Console::SGR(" -> #{deferred.banner}").with(text_color: :magenta) deferred.run end end
setup()
click to toggle source
# File lib/warg.rb, line 1952 def setup end
|(other)
click to toggle source
# File lib/warg.rb, line 1968 def |(other) other.(context) end
Private Instance Methods
append(deferred)
click to toggle source
# File lib/warg.rb, line 2007 def append(deferred) @steps << deferred deferred end
configure_parser!()
click to toggle source
# File lib/warg.rb, line 1988 def configure_parser! end
on_localhost(banner, &block)
click to toggle source
# File lib/warg.rb, line 2002 def on_localhost(banner, &block) append LOCALHOST.defer(self, banner, &block) end
Also aliased as: locally
run_command(command, on: hosts, order: :parallel, &setup)
click to toggle source
# File lib/warg.rb, line 1998 def run_command(command, on: hosts, order: :parallel, &setup) append Executor::Deferred.new(self, command, on, order, &setup) end
run_script(script_name = nil, on: hosts, order: :parallel, &setup)
click to toggle source
# File lib/warg.rb, line 1991 def run_script(script_name = nil, on: hosts, order: :parallel, &setup) script_name ||= command_name.script script = Script.new(script_name, context) append Executor::Deferred.new(self, script, on, order, &setup) end