class Beaker::Platform

all String methods while adding several platform-specific use cases.
This class create a Platform object inheriting from String. It supports

def initialize(name)

* archlinux
* netscaler
* f5
* cumulus
* el
* aix
* solaris
* windows
* ubuntu
* sles
* opensuse
* scientific
* redhatfips
* redhat
* oracle
* debian
* fedora
* centos
* osx
* openbsd
* freebsd
* cisco_ios_xr
* cisco_nexus
* huaweios
* amazon
the format /^OSFAMILY-VERSION-ARCH.*$/ where OSFAMILY is one of:
provided meets the platform formatting rules. Platforms name must be of
Creates the Platform object. Checks to ensure that the platform String
def initialize(name)
  raise ArgumentError, "Unsupported platform name #{name}" if !PLATFORMS.match?(name)
  super
  @variant, version, @arch = self.split('-', 3)
  codename_version_hash = PLATFORM_VERSION_CODES[@variant.to_sym]
  @version = version
  @codename = nil
  return unless codename_version_hash
  if codename_version_hash[version]
    @codename = version
    @version = codename_version_hash[version]
  else
    version = version.delete('.')
    version_codename_hash = codename_version_hash.invert
    @codename = version_codename_hash[version]
  end
end

def to_array

variables in DSL and test case methods.
Returns array of attributes to allow single line assignment to local
def to_array
  return @variant, @version, @arch, @codename
end

def with_version_codename

Returns:
  • (String) - the platform string with the platform version represented as a codename

Other tags:
    Example: Platform.new('debian-7-xxx').with_version_codename == 'debian-wheezy-xxx' -
def with_version_codename
  [@variant, @codename || @version, @arch].join('-')
end

def with_version_number

Returns:
  • (String) - the platform string with the platform version represented as a number

Other tags:
    Example: Platform.new('debian-wheezy-xxx').with_version_number == 'debian-7-xxx' -
def with_version_number
  [@variant, @version, @arch].join('-')
end