Class: Wright::Resource::Package
- Inherits:
-
Wright::Resource
- Object
- Wright::Resource
- Wright::Resource::Package
- Extended by:
- Forwardable
- Defined in:
- lib/wright/resource/package.rb
Overview
Package resource, represents a package.
Instance Attribute Summary collapse
-
#options ⇒ String+
The options passed to the package manager.
-
#version ⇒ String
The package version to install or remove.
Attributes inherited from Wright::Resource
#action, #ignore_failure, #name, #resource_name
Instance Method Summary collapse
-
#initialize(name) ⇒ Package
constructor
Initializes a Package.
-
#install ⇒ Bool
Installs the Package.
-
#installed? ⇒ Bool
true
if the package is installed. -
#installed_versions ⇒ Array<String>
The installed package versions.
-
#remove ⇒ Bool
(also: #uninstall)
Removes the Package.
Methods inherited from Wright::Resource
Constructor Details
#initialize(name) ⇒ Package
Initializes a Package.
37 38 39 40 41 42 |
# File 'lib/wright/resource/package.rb', line 37 def initialize(name) super @version = nil @options = nil @action = :install end |
Instance Attribute Details
#options ⇒ String+
Returns the options passed to the package manager.
32 33 34 |
# File 'lib/wright/resource/package.rb', line 32 def @options end |
#version ⇒ String
Returns the package version to install or remove.
28 29 30 |
# File 'lib/wright/resource/package.rb', line 28 def version @version end |
Instance Method Details
#install ⇒ Bool
Installs the Package.
56 57 58 59 60 |
# File 'lib/wright/resource/package.rb', line 56 def install might_update_resource do @provider.install end end |
#installed? ⇒ Bool
Returns true
if the package is installed.
50 |
# File 'lib/wright/resource/package.rb', line 50 def_delegator :@provider, :installed? |
#installed_versions ⇒ Array<String>
Returns the installed package versions.
46 |
# File 'lib/wright/resource/package.rb', line 46 def_delegator :@provider, :installed_versions |
#remove ⇒ Bool Also known as: uninstall
Removes the Package.
66 67 68 69 70 |
# File 'lib/wright/resource/package.rb', line 66 def remove might_update_resource do @provider.remove end end |