Module: Sprinkle::Verifiers::Package

Defined in:
lib/sprinkle/verifiers/package.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) has_package(*packages) Also known as: has_packages



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/sprinkle/verifiers/package.rb', line 6

def has_package(*packages)
  if packages.is_a?(Array) && packages.first.is_a?(Array)
    packages = packages.first
  else
    packages = [packages] unless packages.is_a? Array
  end

  packages.each do |pak|
    case Sprinkle::Installers::InstallPackage.installer
      when :yum
        @commands << "[ -n \"`yum list installed #{pak} 2> /dev/null | egrep -e \\\"#{pak}\\\"`\" ]"
      else
        raise "Unknown InstallPackage.installer"
    end
  end
end