Sha256: 7bdb465ca16d64370c49b62536f70ba0641ab043066b59407b069edfbe24362b

Contents?: true

Size: 591 Bytes

Versions: 14

Compression:

Stored size: 591 Bytes

Contents

require 'English'

module Thegarage
  module Gitx
    class Runner
      attr_accessor :shell, :options

      def initialize(shell, options = {})
        @shell = shell
        @options = options
      end

      # execute a shell command and raise an error if non-zero exit code is returned
      # return the string output from the command
      def run_cmd(cmd, options = {})
        shell.say "$ #{cmd}"
        output = `#{cmd}`
        success = $CHILD_STATUS.to_i == 0
        fail "#{cmd} failed" unless success || options[:allow_failure]
        output
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
thegarage-gitx-2.2.2 lib/thegarage/gitx/runner.rb
thegarage-gitx-2.2.1 lib/thegarage/gitx/runner.rb
thegarage-gitx-2.2.0 lib/thegarage/gitx/runner.rb
thegarage-gitx-2.1.1 lib/thegarage/gitx/runner.rb
thegarage-gitx-2.1.0 lib/thegarage/gitx/runner.rb
thegarage-gitx-2.0.5 lib/thegarage/gitx/runner.rb
thegarage-gitx-2.0.4 lib/thegarage/gitx/runner.rb
thegarage-gitx-2.0.3 lib/thegarage/gitx/runner.rb
thegarage-gitx-2.0.2 lib/thegarage/gitx/runner.rb
thegarage-gitx-2.0.1 lib/thegarage/gitx/runner.rb
thegarage-gitx-2.0.0 lib/thegarage/gitx/runner.rb
thegarage-gitx-2.0.0.pre2 lib/thegarage/gitx/runner.rb
thegarage-gitx-2.0.0.pre1 lib/thegarage/gitx/runner.rb
thegarage-gitx-1.5.5.pre1 lib/thegarage/gitx/runner.rb