Class: Warg::Command::Step
- Inherits:
-
Object
- Object
- Warg::Command::Step
- Defined in:
- lib/warg.rb
Defined Under Namespace
Classes: BlockProxy, Callback, CallbackFailedError
Instance Attribute Summary collapse
-
#command ⇒ Object
readonly
Returns the value of attribute command.
-
#hosts ⇒ Object
readonly
Returns the value of attribute hosts.
-
#next ⇒ Object
Returns the value of attribute next.
-
#previous ⇒ Object
Returns the value of attribute previous.
-
#result ⇒ Object
readonly
Returns the value of attribute result.
Class Method Summary collapse
Instance Method Summary collapse
- #and_then(order: :parallel, &block) ⇒ Object
- #banner ⇒ Object
-
#initialize(command, run_object, hosts, order, &setup) ⇒ Step
constructor
A new instance of Step.
- #run ⇒ Object
Constructor Details
#initialize(command, run_object, hosts, order, &setup) ⇒ Step
Returns a new instance of Step.
1908 1909 1910 1911 1912 1913 1914 |
# File 'lib/warg.rb', line 1908 def initialize(command, run_object, hosts, order, &setup) @command = command @run_object = run_object @hosts = hosts @order = order @setup = setup end |
Instance Attribute Details
#command ⇒ Object (readonly)
Returns the value of attribute command.
1902 1903 1904 |
# File 'lib/warg.rb', line 1902 def command @command end |
#hosts ⇒ Object (readonly)
Returns the value of attribute hosts.
1903 1904 1905 |
# File 'lib/warg.rb', line 1903 def hosts @hosts end |
#next ⇒ Object
Returns the value of attribute next.
1904 1905 1906 |
# File 'lib/warg.rb', line 1904 def next @next end |
#previous ⇒ Object
Returns the value of attribute previous.
1905 1906 1907 |
# File 'lib/warg.rb', line 1905 def previous @previous end |
#result ⇒ Object (readonly)
Returns the value of attribute result.
1906 1907 1908 |
# File 'lib/warg.rb', line 1906 def result @result end |
Class Method Details
.callback(command, last_step, order, block) ⇒ Object
1894 1895 1896 1897 1898 1899 1900 |
# File 'lib/warg.rb', line 1894 def self.callback(command, last_step, order, block) new \ command, Callback.new(last_step, block), last_step.hosts, order end |
.local(command, banner, block) ⇒ Object
1890 1891 1892 |
# File 'lib/warg.rb', line 1890 def self.local(command, , block) new(command, BlockProxy.new(, block), LOCALHOST, :serial) end |
Instance Method Details
#and_then(order: :parallel, &block) ⇒ Object
1920 1921 1922 |
# File 'lib/warg.rb', line 1920 def and_then(order: :parallel, &block) @command.and_then order: order, &block end |
#banner ⇒ Object
1916 1917 1918 |
# File 'lib/warg.rb', line 1916 def @run_object end |
#run ⇒ Object
1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 |
# File 'lib/warg.rb', line 1924 def run @result = case @run_object when String @hosts.run_command(@run_object, order: @order, &@setup) when Script @hosts.run_script(@run_object, order: @order, &@setup) when Callback @run_object.run(@order) when BlockProxy # NOTE: A `Proc` means `@hosts` is `LOCALHOST` Executor::Result.new.tap do |result| result.update LOCALHOST.run(&@run_object) end end end |