class Wright::Resource::Package
Package
resource, represents a package.
@example
vim = Wright::Resource::Package.new('vim') vim.installed_versions # => [] vim.install vim.installed_versions # => ["2:7.3.547-7"] htop = Wright::Resource::Package.new('htop') htop.installed_versions # => ["1.0.1-1"] htop.remove htop.installed_versions # => []
Attributes
options[RW]
@return [String, Array<String>] the options passed to the
package manager
version[RW]
@return [String] the package version to install or remove
Public Class Methods
new(name, args = {})
click to toggle source
Initializes a Package
.
@param name [String] the package's name @param args [Hash] the arguments @option args [Symbol] :action (:install) the action @option args [String, to_s] :version the package version @option args [String, Array<String>] :options the package options
Calls superclass method
Wright::Resource::new
# File lib/wright/resource/package.rb, line 41 def initialize(name, args = {}) super @action = args.fetch(:action, :install) @version = args.fetch(:version, nil) @options = args.fetch(:options, nil) end
Public Instance Methods
install()
click to toggle source
Installs the Package
.
@return [Bool] true if the package was updated and false
otherwise
# File lib/wright/resource/package.rb, line 60 def install might_update_resource do provider.install end end