Sha256: 6aa6c868b52a52b4ac6beefc569e38251fabf8e9ab9a5a808136616e3a666303

Contents?: true

Size: 934 Bytes

Versions: 14

Compression:

Stored size: 934 Bytes

Contents

# == PlatformManager::Windows
#
# A PlatformManager driver for Windows systems.
class AutomateIt::PlatformManager::Windows < AutomateIt::PlatformManager::Struct
  def available?
    return RUBY_PLATFORM.match(/mswin/) ? true : false
  end

  def suitability(method, *args) # :nodoc:
    # Must be higher than PlatformManager::Struct
    return available? ? 3 : 0
  end

  def _prepare
    return if @struct[:release]
    @struct[:os] = "windows"
    @struct[:arch] = ENV["PROCESSOR_ARCHITECTURE"]
    @struct[:distro] = "microsoft"

    # VER values: http://www.ss64.com/nt/ver.html
    ver = `ver`.strip
    if match = ver.match(/Windows (\w+)/)
      @struct[:release] = match[1].downcase
    elsif match = ver.match(/Windows \[Version 6\.0\./)
      @struct[:release] = "vista"
    end

    @struct
  end
  private :_prepare

  def query(search)
    _prepare
    super(search)
  end

  def single_vendor?
    return true
  end
end

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
automate-it-0.9.2 lib/automateit/platform_manager/windows.rb
automate-it-0.9.1 lib/automateit/platform_manager/windows.rb
automate-it-0.9.0 lib/automateit/platform_manager/windows.rb
automateit-0.71220 lib/automateit/platform_manager/windows.rb
automateit-0.71221 lib/automateit/platform_manager/windows.rb
automateit-0.71104 lib/automateit/platform_manager/windows.rb
automateit-0.71112 lib/automateit/platform_manager/windows.rb
automateit-0.71219 lib/automateit/platform_manager/windows.rb
automateit-0.71111 lib/automateit/platform_manager/windows.rb
automateit-0.71226.1 lib/automateit/platform_manager/windows.rb
automateit-0.71226 lib/automateit/platform_manager/windows.rb
automateit-0.80116 lib/automateit/platform_manager/windows.rb
automateit-0.71230 lib/automateit/platform_manager/windows.rb
automateit-0.80624 lib/automateit/platform_manager/windows.rb