Class: Sunshine::Yum

Inherits:
Dependency show all
Defined in:
lib/sunshine/package_managers/yum.rb

Overview

The Yum dependency class supports most of yum’s installation features:

dependency_lib.instance_eval do
  yum "ruby", :version => '1.9',
              :rel     => 'release-num',
              :arch    => 'i386',
              :epoch   => 'some-epoch'
end

See the Dependency class for more info.

Instance Attribute Summary

Attributes inherited from Dependency

#children, #name, #parents, #pkg

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Dependency

#add_child, #check, #check_test, #child_dependencies, #install, #install!, #install_parents!, #installed?, #missing_parents?, #parent_dependencies, #requires, sudo, sudo=, #to_s, #uninstall, #uninstall!, #uninstall_children!

Constructor Details

#initialize(name, options = {}, &block) ⇒ Yum

Returns a new instance of Yum.



20
21
22
23
24
25
26
27
28
29
30
# File 'lib/sunshine/package_managers/yum.rb', line 20

def initialize(name, options={}, &block)
  super(name, options) do
    pkg_name = build_pkg_name @pkg.dup, options

    install    "yum install -y #{pkg_name}"
    uninstall  "yum remove -y #{pkg_name}"
    check_test "yum list installed #{pkg_name} | grep -c #{@pkg}", '-ge 1'

    instance_eval(&block) if block_given?
  end
end

Class Method Details

.system_manager?(shell = nil) ⇒ Boolean

Checks if dependency type is valid for a given shell.

Returns:

  • (Boolean)


36
37
38
# File 'lib/sunshine/package_managers/yum.rb', line 36

def self.system_manager? shell=nil
  (shell || Sunshine.shell).system "yum --version"
end