Sha256: 53a4cf0c30189c13fd4667f69c3ef85efc0da8387121b99840807b1ce951326e

Contents?: true

Size: 947 Bytes

Versions: 2

Compression:

Stored size: 947 Bytes

Contents

require 'hashie/dash'
require 'thor'
require 'polytrix/core/manifest_section'

module Polytrix
  module Runners
    autoload :BuffShellOutExecutor, 'polytrix/runners/buff_shellout_executor'
    autoload :MixlibShellOutExecutor, 'polytrix/runners/mixlib_shellout_executor'

    class ExecutionResult < Polytrix::ManifestSection
      property :exitstatus, require: true
      property :stdout, required: true
      property :stderr, required: true
    end

    module Executor
      attr_writer :executor
      attr_accessor :env

      def executor
        @executor ||= if RUBY_PLATFORM == 'java'
                        Polytrix::Runners::BuffShellOutExecutor.new
                      else
                        Polytrix::Runners::MixlibShellOutExecutor.new
                      end
      end

      def execute(command, opts = {})
        opts[:env] = env unless env.nil?
        executor.execute(command, opts)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
polytrix-0.1.2 lib/polytrix/runners/executor.rb
polytrix-0.1.1 lib/polytrix/runners/executor.rb