Sha256: 2aebb0248cec0c0ca5b3e309c14f59e9795f5cae96158186793b4a5dc50cb00f

Contents?: true

Size: 1.14 KB

Versions: 2

Compression:

Stored size: 1.14 KB

Contents

module Tacape
  module Os
    class Fedora
      def initialize
        Tacape.logger.info 'Building OS class...'
        @version = Tacape::Fedora.version
        @config_folder = Tacape::Fedora.config_folder
      end

      def self.locale
        puts 'Retrieving locale thorugh LANG environment variable...'
        return ENV['LANG'].split('.').first
      end

      def self.config_folder
        return "#{ENV['HOME']}/.tacape/config"
      end

      def self.tool_folder
        return "#{ENV['HOME']}/.tacape/tools"
      end

      def self.identify
        if self.issue_info.include? 'Fedora'
          puts "Creating folder structure for Fedora"
          return Tacape::Belt.os_families[:linux][:fedora]
        else
          return nil
        end
      end

      def self.version
        if issue_info.include? 'Fedora'
          return issue_info.split(' ')[2]
        else
          raise WrongOSException,'Expecting Fedora'
        end
      end

      protected
        def self.issue_info
          id_file='/etc/issue'
          if File.exists?(id_file)
            return File.read(id_file)
          end
        end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tacape-0.0.4 lib/tacape/oses/fedora.rb
tacape-0.0.3 lib/tacape/oses/fedora.rb