Class: Babushka::SystemDefinition

Inherits:
Object
  • Object
show all
Defined in:
lib/babushka/system_definition.rb

Constant Summary collapse

CODENAMES =
{
  :osx => {
    :osx => {
      '10.3' => :panther,
      '10.4' => :tiger,
      '10.5' => :leopard,
      '10.6' => :snow_leopard,
      '10.7' => :lion,
      '10.8' => :mountain_lion,
      '10.9' => :mavericks,
      '10.10' => :yosemite,
    }
  },
  :linux => {
    :ubuntu => {
      '4.10'  => :warty,
      '5.04'  => :hoary,
      '5.10'  => :breezy,
      '6.06'  => :dapper,
      '6.10'  => :edgy,
      '7.04'  => :feisty,
      '7.10'  => :gutsy,
      '8.04'  => :hardy,
      '8.10'  => :intrepid,
      '9.04'  => :jaunty,
      '9.10'  => :karmic,
      '10.04' => :lucid,
      '10.10' => :maverick,
      '11.04' => :natty,
      '11.10' => :oneiric,
      '12.04' => :precise,
      '12.10' => :quantal,
      '13.04' => :raring,
      '13.10' => :saucy,
      '14.04' => :trusty,
      '14.10' => :utopic,
      '15.04' => :vivid,
      '15.10' => :wily,
      '16.04' => :xenial,
    },
    :debian => {
      '4' => :etch,
      '5' => :lenny,
      '6' => :squeeze,
      '7' => :wheezy,
      '8' => :jessie,
      '9' => :stretch,
      '10' => :buster,
    },
    :redhat => {
      '3' => :taroon,
      '4' => :nahant,
      '5' => :tikanga,
      '6' => :santiago,
    },
    :fedora => {
      '14' => :laughlin,
      '15' => :lovelock,
      '16' => :verne,
      '17' => :beefy,
      '18' => :spherical,
      '19' => :schrodinger,
    },
    :opensuse => {
      '13.1' => :bottle,
      '13.2' => :harlequin,
    },
    :arch => {},
  },
  :bsd => {
    :dragonfly => {},
    :freebsd => {},
  },
}
DESCRIPTIONS =
{
  :osx => {
    :osx => {
      '10.3' => 'Panther',
      '10.4' => 'Tiger',
      '10.5' => 'Leopard',
      '10.6' => 'Snow Leopard',
      '10.7' => 'Lion',
      '10.8' => 'Mountain Lion',
      '10.9' => 'Mavericks',
    }
  },
  :linux => {
    :ubuntu => {
      '4.10'  => 'Warty Warthog',
      '5.04'  => 'Hoary Hedgehog',
      '5.10'  => 'Breezy Badger',
      '6.06'  => 'Dapper Drake',
      '6.10'  => 'Edgy Eft',
      '7.04'  => 'Feisty Fawn',
      '7.10'  => 'Gutsy Gibbon',
      '8.04'  => 'Hardy Heron',
      '8.10'  => 'Intrepid Ibex',
      '9.04'  => 'Jaunty Jackalope',
      '9.10'  => 'Karmic Koala',
      '10.04' => 'Lucid Lynx',
      '10.10' => 'Maverick Meerkat',
      '11.04' => 'Natty Narwhal',
      '11.10' => 'Oneiric Ocelot',
      '12.04' => 'Precise Pangolin',
      '12.10' => 'Quantal Quetzal',
      '13.04' => 'Raring Ringtail',
      '13.10' => 'Saucy Salamander',
      '14.04' => 'Trusty Tahr',
      '14.10' => 'Utopic Unicorn',
      '15.04' => 'Vivid Vervet',
      '15.10' => 'Wily Werewolf',
      '16.04' => 'Xenial Xerus',
    },
    :redhat => {
      '3' => 'Taroon',
      '4' => 'Nahant',
      '5' => 'Tikanga',
      '6' => 'Santiago',
    },
    :fedora => {
      '14' => 'Laughlin',
      '15' => 'Lovelock',
      '16' => 'Verne',
      '17' => 'Beefy Miracle',
      '18' => 'Spherical Cow',
      '19' => "Schrödinger's Cat",
    },
    :opensuse => {
      '13.1' => 'Bottle',
      '13.2' => 'Harlequin',
    },
  },
  :bsd => {
    :dragonfly => {},
    :freebsd => {},
  },
}

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(system, flavour, release) ⇒ SystemDefinition

Returns a new instance of SystemDefinition.


24
25
26
# File 'lib/babushka/system_definition.rb', line 24

def initialize system, flavour, release
  @system, @flavour, @release = system, flavour, release
end

Instance Attribute Details

#flavourObject (readonly)

Returns the value of attribute flavour


22
23
24
# File 'lib/babushka/system_definition.rb', line 22

def flavour
  @flavour
end

#releaseObject (readonly)

Returns the value of attribute release


22
23
24
# File 'lib/babushka/system_definition.rb', line 22

def release
  @release
end

#systemObject (readonly)

Returns the value of attribute system


22
23
24
# File 'lib/babushka/system_definition.rb', line 22

def system
  @system
end

Class Method Details

.all_flavoursObject


10
11
12
# File 'lib/babushka/system_definition.rb', line 10

def self.all_flavours
  CODENAMES.values.map(&:keys).flatten
end

.all_namesObject


14
15
16
# File 'lib/babushka/system_definition.rb', line 14

def self.all_names
  CODENAMES.values.map(&:values).map {|s| s.map(&:values) }.flatten
end

.all_systemsObject


6
7
8
# File 'lib/babushka/system_definition.rb', line 6

def self.all_systems
  CODENAMES.keys
end

.all_tokensObject


18
19
20
# File 'lib/babushka/system_definition.rb', line 18

def self.all_tokens
  all_systems + PkgHelper.all_manager_keys + all_flavours + all_names
end

Instance Method Details

#codenameObject


28
29
30
# File 'lib/babushka/system_definition.rb', line 28

def codename
  (CODENAMES[system][flavour] || {})[release]
end

#codename_strObject


32
33
34
# File 'lib/babushka/system_definition.rb', line 32

def codename_str
  (DESCRIPTIONS[system][flavour] || {})[release]
end