Class: Wright::Provider::Package
- Inherits:
-
Wright::Provider
- Object
- Wright::Provider
- Wright::Provider::Package
- Defined in:
- lib/wright/provider/package.rb,
lib/wright/provider/package/apt.rb,
lib/wright/provider/package/yum.rb,
lib/wright/provider/package/homebrew.rb
Overview
Package provider. Used as a base class for Resource::Package providers.
Defined Under Namespace
Constant Summary
Constants inherited from Wright::Provider
Instance Method Summary collapse
-
#install ⇒ void
Installs the package.
-
#installed? ⇒ Bool
True if the package is installed, false otherwise.
-
#installed_versions ⇒ Array<String>
The installed package versions.
-
#remove ⇒ void
Removes the package.
Methods inherited from Wright::Provider
Constructor Details
This class inherits a constructor from Wright::Provider
Instance Method Details
#install ⇒ void
This method returns an undefined value.
Installs the package.
11 12 13 14 15 16 17 18 |
# File 'lib/wright/provider/package.rb', line 11 def install unless_uptodate(:install, "package already installed: '#{package_name}'") do unless_dry_run("install package: '#{package_name}'") do install_package end end end |
#installed? ⇒ Bool
Returns true if the package is installed, false otherwise.
39 40 41 42 43 44 45 |
# File 'lib/wright/provider/package.rb', line 39 def installed? if package_version installed_versions.include?(package_version) else !installed_versions.empty? end end |
#installed_versions ⇒ Array<String>
Returns the installed package versions.
33 34 35 |
# File 'lib/wright/provider/package.rb', line 33 def installed_versions fail NotImplementedError end |
#remove ⇒ void
This method returns an undefined value.
Removes the package.
23 24 25 26 27 28 29 30 |
# File 'lib/wright/provider/package.rb', line 23 def remove unless_uptodate(:remove, "package already removed: '#{package_name}'") do unless_dry_run("remove package: '#{package_name}'") do remove_package end end end |