Class: Wright::Provider::Package::Apt
- Inherits:
-
Wright::Provider::Package
- Object
- Wright::Provider
- Wright::Provider::Package
- Wright::Provider::Package::Apt
- Defined in:
- lib/wright/provider/package/apt.rb
Overview
Apt package provider. Used as a provider for Resource::Package on Debian-based systems.
Constant Summary
Constants inherited from Wright::Provider
Wright::Provider::PROVIDER_DIR
Instance Method Summary collapse
-
#installed_versions ⇒ Array<String>
The installed package versions.
Methods inherited from Wright::Provider::Package
#install, #installed?, #remove
Methods inherited from Wright::Provider
Constructor Details
This class inherits a constructor from Wright::Provider
Instance Method Details
#installed_versions ⇒ Array<String>
Returns the installed package versions.
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/wright/provider/package/apt.rb', line 13 def installed_versions package = "package '#{package_name}'" err = "Cannot determine installed versions for #{package}" apt_policy = exec_or_fail('apt-cache', ['policy', package_name], err) version_re = /(?!\(none\)).*/ installed_re = /^ Installed: (?<version>#{version_re})$/ match = installed_re.match(apt_policy) match ? [match['version']] : virtual_package_versions end |