package_manager.rb

Path: lib/automateit/package_manager.rb
Last Update: Wed Nov 04 20:51:52 -0800 2009

PackageManager

The PackageManager provides a way to manage packages, e.g., install, uninstall and query if the Apache package is installed with APT.

Examples:

  package_manager.installed?("apache2") # => false
  package_manager.install("apache2") # => true
  package_manager.installed?("apache2") # => true
  package_manager.uninstall("apache2") # => true
  package_manager.not_installed("apache2") # => true

Commands can accept arrays:

  package_manager.install("apache2", "bash")
  package_manager.installed? %w(apache2 bash)

Commands can also accept a single, annotated string as a manifest — useful for installing large numbers of packages at once:

  package_manager.install <<HERE, :with => :apt
    # One per line
    apache
    bash

    # Or many on the same line
    sysvconfig sysv-rc-conf
  HERE

Commands can also accept a hash of names to paths — necessary for installing packages stored on the filesystem:

  # Is the package called "TracTags" installed? If not, run the installer
  # with the "/tmp/tractags_latest" path as an argument:
  package.manager.install({"TracTags" => "/tmp/tractags_latest"}, :with => :egg)

Required files

automateit/package_manager/dpkg   automateit/package_manager/apt   automateit/package_manager/yum   automateit/package_manager/gem   automateit/package_manager/egg   automateit/package_manager/portage   automateit/package_manager/pear   automateit/package_manager/pecl   automateit/package_manager/cpan  

[Validate]