Sha256: 3e565396612aa76417c07d3ddaf7e105cf47de7e2f3d8d8a5c348f9fe8e1a593

Contents?: true

Size: 1.15 KB

Versions: 1

Compression:

Stored size: 1.15 KB

Contents

require 'rubygems'
require 'fileutils'
require 'mixlib/cli'

module PKGWizard

  VERSION = '0.1.16'
  
  class Distribution
    def self.detect
      if File.exist?('/etc/redhat-release') and \
        File.read('/etc/redhat-release') =~ /Fedora/
        return Fedora.new
      end
      if File.exist?('/etc/redhat-release') and \
        File.read('/etc/redhat-release') =~ /FrameOS|RedHat|CentOS/
        return RedHat.new
      end
      if `lsb_release -i` =~ /Ubuntu/
        return Ubuntu.new
      end
      return UnknownDistro.new
    end
  end

  class UnknownDistro
    def prepare_env
    end

    def to_s
      'unknown'
    end
  end

  class Ubuntu
    def prepare_env
    end
    def to_s
      'ubuntu'
    end
  end

  class RedHat
    def prepare_env
      if `uname -r` =~ /\.el6\./
      else
        raise UnsupportedDistribution.new('Unsupported RHEL distribution')
      end
      output = `yum install createrepo yum-utils rsync git rpmdevtools wget mock 2>&1`
    end
    def to_s
      'redhat'
    end
  end

  class Fedora
    def prepare_env
    end
    def to_s
      'fedora'
    end
  end

  class UnsupportedDistribution < Exception
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pkg-wizard-0.1.16 lib/pkg-wizard.rb