Sha256: 6f1cae33426890d041cf06779bea8b097fd3d71dbdc2b4176d36449adb483709

Contents?: true

Size: 848 Bytes

Versions: 16

Compression:

Stored size: 848 Bytes

Contents

# frozen_string_literal: true

module Jive
  class Runner
    attr_reader :results

    def initialize
      @results = []
    end

    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

    def all_success_and_clean?
      all_success? && all_stderr_empty?
    end

    def all_success?
      results.all? { |result| result.status.success? }
    end

    def all_stderr_empty?
      results.all? { |result| result.stderr.empty? }
    end

    def failed_results
      results.reject { |result| result.status.success? }
    end

    def warned_results
      results.select do |result|
        result.status.success? && !result.stderr.empty?
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
jive-0.7.0 lib/jive/runner.rb
jive-0.6.0 lib/jive/runner.rb
jive-0.5.0 lib/jive/runner.rb
jive-0.4.4 lib/jive/runner.rb
jive-0.4.3 lib/jive/runner.rb
jive-0.4.2 lib/jive/runner.rb
jive-0.4.1 lib/jive/runner.rb
jive-0.4.0 lib/jive/runner.rb
jive-0.3.3 lib/jive/runner.rb
jive-0.3.2 lib/jive/runner.rb
jive-0.3.1 lib/jive/runner.rb
jive-0.3.0 lib/jive/runner.rb
jive-0.2.3 lib/jive/runner.rb
jive-0.2.2 lib/jive/runner.rb
jive-0.2.1 lib/jive/runner.rb
jive-0.2.0 lib/jive/runner.rb