Class: AutomateIt::PackageManager
- Inherits:
-
AutomateIt::Plugin::Manager
- Object
- Common
- AutomateIt::Plugin::Base
- AutomateIt::Plugin::Manager
- AutomateIt::PackageManager
- Defined in:
- lib/automateit/package_manager.rb
Overview
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)
Defined Under Namespace
Classes: APT, BaseDriver, CPAN, DPKG, Egg, Gem, PEAR, PECL, Portage, YUM
Constant Summary
Constants included from Constants
Constants::HELPERS_DIR, Constants::INSTALL_DIR, Constants::PERROR, Constants::PEXEC, Constants::PNOTE, Constants::WARNING_BOILERPLATE
Instance Attribute Summary
Attributes inherited from AutomateIt::Plugin::Manager
Attributes inherited from Common
Instance Method Summary collapse
-
#add(*packages) ⇒ Object
Alias for #install.
-
#install(*packages) ⇒ Object
Install these
packages
. -
#installed?(*packages) ⇒ Boolean
Are these
packages
installed?. -
#not_installed?(*packages) ⇒ Boolean
Are these
packages
not installed? . -
#remove(*packages) ⇒ Object
Alias for #uninstall.
-
#uninstall(*packages) ⇒ Object
Uninstall these
packages
.
Methods inherited from AutomateIt::Plugin::Manager
#[], abstract_manager, alias_methods, #available?, #default, #default=, #dispatch, #dispatch_safely, #dispatch_safely_to, #dispatch_to, driver_classes, #driver_for, #driver_suitability_levels_for, inherited, #instantiate_drivers, #setup
Methods inherited from AutomateIt::Plugin::Base
Methods inherited from Common
#initialize, #log, #nitpick, #noop, #noop=, #noop?, #preview, #preview=, #preview?, #preview_for, #setup, #superuser?, #writing, #writing=, #writing?
Constructor Details
This class inherits a constructor from AutomateIt::Common
Instance Method Details
#add(*packages) ⇒ Object
Alias for #install
39 |
# File 'lib/automateit/package_manager.rb', line 39 def add(*packages) dispatch_to(:install, *packages) end |
#install(*packages) ⇒ Object
Install these packages
. Returns true
if any packages are installed successfully; or false
if all packages were already installed.
60 |
# File 'lib/automateit/package_manager.rb', line 60 def install(*packages) dispatch(*packages) end |
#installed?(*packages) ⇒ Boolean
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.
49 |
# File 'lib/automateit/package_manager.rb', line 49 def installed?(*packages) dispatch(*packages) end |
#not_installed?(*packages) ⇒ Boolean
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.
56 |
# File 'lib/automateit/package_manager.rb', line 56 def not_installed?(*packages) dispatch(*packages) end |
#remove(*packages) ⇒ Object
Alias for #uninstall
42 |
# File 'lib/automateit/package_manager.rb', line 42 def remove(*packages) dispatch_to(:uninstall, *packages) end |
#uninstall(*packages) ⇒ Object
Uninstall these packages
. Returns true
if any packages are uninstalled successfully; or false
if none of the packages are installed.
64 |
# File 'lib/automateit/package_manager.rb', line 64 def uninstall(*packages) dispatch(*packages) end |