Class: Jive::Runner
- Inherits:
-
Object
- Object
- Jive::Runner
- Defined in:
- lib/jive/runner.rb
Instance Attribute Summary collapse
-
#results ⇒ Object
readonly
Returns the value of attribute results.
Instance Method Summary collapse
- #all_stderr_empty? ⇒ Boolean
- #all_success? ⇒ Boolean
- #all_success_and_clean? ⇒ Boolean
- #failed_results ⇒ Object
-
#initialize ⇒ Runner
constructor
A new instance of Runner.
- #run(commands, &block) ⇒ Object
- #warned_results ⇒ Object
Constructor Details
#initialize ⇒ Runner
Returns a new instance of Runner.
7 8 9 |
# File 'lib/jive/runner.rb', line 7 def initialize @results = [] end |
Instance Attribute Details
#results ⇒ Object (readonly)
Returns the value of attribute results.
5 6 7 |
# File 'lib/jive/runner.rb', line 5 def results @results end |
Instance Method Details
#all_stderr_empty? ⇒ Boolean
29 30 31 |
# File 'lib/jive/runner.rb', line 29 def all_stderr_empty? results.all? { |result| result.stderr.empty? } end |
#all_success? ⇒ Boolean
25 26 27 |
# File 'lib/jive/runner.rb', line 25 def all_success? results.all? { |result| result.status.success? } end |
#all_success_and_clean? ⇒ Boolean
21 22 23 |
# File 'lib/jive/runner.rb', line 21 def all_success_and_clean? all_success? && all_stderr_empty? end |
#failed_results ⇒ Object
33 34 35 |
# File 'lib/jive/runner.rb', line 33 def failed_results results.reject { |result| result.status.success? } end |
#run(commands, &block) ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/jive/runner.rb', line 11 def run(commands, &block) commands.each do |command| block.call(command) do cmd_result = Popen.popen_with_detail(command) results << cmd_result cmd_result end end end |
#warned_results ⇒ Object
37 38 39 40 41 |
# File 'lib/jive/runner.rb', line 37 def warned_results results.select do |result| result.status.success? && !result.stderr.empty? end end |