Class AutomateIt::PackageManager
In: lib/automateit/package_manager.rb
Parent: AutomateIt::Plugin::Manager

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)

Methods

Classes and Modules

Class AutomateIt::PackageManager::APT
Class AutomateIt::PackageManager::BaseDriver
Class AutomateIt::PackageManager::CPAN
Class AutomateIt::PackageManager::DPKG
Class AutomateIt::PackageManager::Egg
Class AutomateIt::PackageManager::Gem
Class AutomateIt::PackageManager::PEAR
Class AutomateIt::PackageManager::PECL
Class AutomateIt::PackageManager::Portage
Class AutomateIt::PackageManager::YUM

Public Instance methods

Alias for install

[Source]

# File lib/automateit/package_manager.rb, line 39
  def add(*packages) dispatch_to(:install, *packages) end

Install these packages. Returns true if any packages are installed successfully; or false if all packages were already installed.

[Source]

# File lib/automateit/package_manager.rb, line 60
  def install(*packages) dispatch(*packages) end

Are these packages installed?

Options:

  • :details — Returns an array containing the boolean result value and an array with a subset of installed packages. Boolean, defaults to false.

[Source]

# File lib/automateit/package_manager.rb, line 49
  def installed?(*packages) dispatch(*packages) end

Are these packages not installed?

Options:

  • :details — Returns an array containing the boolean result value and an array with a subset of packages not installed. Boolean, defaults to false.

[Source]

# File lib/automateit/package_manager.rb, line 56
  def not_installed?(*packages) dispatch(*packages) end

Alias for uninstall

[Source]

# File lib/automateit/package_manager.rb, line 42
  def remove(*packages) dispatch_to(:uninstall, *packages) end

Uninstall these packages. Returns true if any packages are uninstalled successfully; or false if none of the packages are installed.

[Source]

# File lib/automateit/package_manager.rb, line 64
  def uninstall(*packages) dispatch(*packages) end

[Validate]