| Path: | lib/automateit/package_manager.rb |
| Last Update: | Thu Jan 17 03:02:37 -0800 2008 |
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)