Sha256: d7fa66404f429274d7dcfe403dcfca283619a70e0024ff0e701c707f146c8a03

Contents?: true

Size: 688 Bytes

Versions: 2

Compression:

Stored size: 688 Bytes

Contents

require 'delegate'

# Aruba
module Aruba
  # Platforms
  module Platforms
    # This is a command which should be run
    #
    # This adds `cmd.exec` in front of commmand
    #
    # @private
    class WindowsCommandString < SimpleDelegator
      def initialize(cmd)
        __setobj__ format('%s /c "%s"', Aruba.platform.which('cmd.exe'), cmd)
      end

      # Convert to array
      def to_a
        Shellwords.split( __getobj__.gsub('\\', 'ARUBA_TMP_PATHSEPARATOR') ).
          map { |w| w.gsub('ARUBA_TMP_PATHSEPARATOR', '\\') }
      end

      if RUBY_VERSION < '1.9'
        def to_s
          __getobj__.to_s
        end
        alias inspect to_s
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
aruba-0.14.3 lib/aruba/platforms/windows_command_string.rb
aruba-win-fix-0.14.2 lib/aruba/platforms/windows_command_string.rb