Sha256: 3244e82117c80fd89e0d1f4ba5c451c5ab52f36956d82500239b01500b454b19

Contents?: true

Size: 1.24 KB

Versions: 79

Compression:

Stored size: 1.24 KB

Contents

# Copyright (C) 2011 RightScale, Inc, All Rights Reserved Worldwide.
#
# THIS PROGRAM IS CONFIDENTIAL AND PROPRIETARY TO RIGHTSCALE
# AND CONSTITUTES A VALUABLE TRADE SECRET. Any unauthorized use,
# reproduction, modification, or disclosure of this program is
# strictly prohibited. Any use of this program by an authorized
# licensee is strictly subject to the terms and conditions,
# including confidentiality obligations, set forth in the applicable
# License Agreement between RightScale.com, Inc. and
# the licensee

module RightConf

  # Linux specific implementation
  class Platform

    FEDORA_REL = '/etc/fedora-release'
    FEDORA_SIG = /Fedora release ([0-9]+) \(.*\)/

    attr_reader :flavor, :release

    # Initialize flavor and release
    def init
      system('lsb_release --help > /dev/null 2>&1')
      if $?.success?
        # Use the lsb_release utility if it's available
        @flavor  = `lsb_release -is`.strip.downcase
        @release =  `lsb_release -rs`.strip
      elsif File.exist?(FEDORA_REL) && (match = FEDORA_SIG.match(File.read(FEDORA_REL)))
        # Parse the fedora-release file if it exists
        @distro   = 'fedora'
        @release  = match[1]
      else
        @distro = @release = 'unknown'
      end
    end

  end

end

Version data entries

79 entries across 79 versions & 1 rubygems

Version Path
rconf-0.9.18 lib/rconf/platforms/linux.rb
rconf-0.9.17 lib/rconf/platforms/linux.rb
rconf-0.9.12 lib/rconf/platforms/linux.rb
rconf-0.9.11 lib/rconf/platforms/linux.rb
rconf-0.9.10 lib/rconf/platforms/linux.rb
rconf-0.9.9 lib/rconf/platforms/linux.rb
rconf-0.9.8 lib/rconf/platforms/linux.rb
rconf-0.9.7 lib/rconf/platforms/linux.rb
rconf-0.9.6 lib/rconf/platforms/linux.rb
rconf-0.9.4 lib/rconf/platforms/linux.rb
rconf-0.8.30 lib/rconf/platforms/linux.rb
rconf-0.8.29 lib/rconf/platforms/linux.rb
rconf-0.8.21 lib/rconf/platforms/linux.rb
rconf-0.8.20 lib/rconf/platforms/linux.rb
rconf-0.8.19 lib/rconf/platforms/linux.rb
rconf-0.8.18 lib/rconf/platforms/linux.rb
rconf-0.8.17 lib/rconf/platforms/linux.rb
rconf-0.8.16 lib/rconf/platforms/linux.rb
rconf-0.8.15 lib/rconf/platforms/linux.rb
rconf-0.8.14 lib/rconf/platforms/linux.rb