Class: Tpkg::OS::Windows

Inherits:
Tpkg::OS show all
Defined in:
lib/tpkg/os/windows.rb

Overview

tpkg package management system License: MIT (www.opensource.org/licenses/mit-license.php)

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Tpkg::OS

#arch, #available_native_packages, create, #cron_dot_d_directory, #fqdn, #init_links, #initialize, #install_native_package, #native_pkg_to_install_string, #os, #os_name, register_implementation, #remove_native_stub_pkg, #stub_native_pkg, #sys_v_init_links, #upgrade_native_package

Constructor Details

This class inherits a constructor from Tpkg::OS

Class Method Details

.supported?Boolean

Returns:

  • (Boolean)


5
6
7
8
# File 'lib/tpkg/os/windows.rb', line 5

def self.supported?
  Facter.loadfacts
  Facter['operatingsystem'].value == 'windows'
end

Instance Method Details

#os_versionObject



11
12
13
14
15
16
17
18
19
20
# File 'lib/tpkg/os/windows.rb', line 11

def os_version
  if !@os_version
    # Extract 6.1 from 6.1.7601, for example
    # That seems like the right level to split at
    # based on http://en.wikipedia.org/wiki/Ver_(command)
    winver = Facter['operatingsystemrelease'].value
    @os_version = winver.split('.')[0,2].join('.')
  end
  super
end

#sudo_default?Boolean

Returns:

  • (Boolean)


22
23
24
25
# File 'lib/tpkg/os/windows.rb', line 22

def sudo_default?
  # Neither of the common Windows environments for running Ruby have sudo
  return false
end