Module: Jah::ActPkg

Defined in:
lib/jah/act_pkg.rb,
lib/jah/act_pkg/base.rb

Defined Under Namespace

Classes: Base

Class Method Summary collapse

Class Method Details

.detectObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/jah/act_pkg.rb', line 13

def self.detect
  if RUBY_PLATFORM =~ /darwin/
    :ports
  else
    case File.read("/etc/issue")
    when /Arch/i    then :pacman
    when /SUSE/i    then :zypp
    when /Mandriva/ then :urpm
    when /BSD/      then :ports
    when /Fedora|CentOS/ then :yum
    when /Debian|Ubuntu/ then :apt
    when /This|Gentoo/   then :emerge
    when /Welcome|Slack/ then :slack
    else
      raise "Is this LFS??"
    end
  end
end

.managerObject



32
33
34
# File 'lib/jah/act_pkg.rb', line 32

def self.manager
  @manager ||= const_get(detect.to_s.capitalize).new
end

.method_missing(*meth) ⇒ Object



36
37
38
# File 'lib/jah/act_pkg.rb', line 36

def self.method_missing(*meth)
  manager.send(*meth)
end