Class: Cfruby::Packages::RPMPackageManager
- Inherits:
-
PackageManager
- Object
- PackageManager
- Cfruby::Packages::RPMPackageManager
- Defined in:
- lib/libcfruby/osmodules/linux-suse.rb
Overview
PackageManager implementation for rpm
Instance Method Summary collapse
-
#initialize ⇒ RPMPackageManager
constructor
A new instance of RPMPackageManager.
-
#install(packagename, force = false) ⇒ Object
Installs the latest version of the named package.
-
#installed_packages ⇒ Object
Returns a PackageList object that contains key value pairs for every installed package where the key is the package name and the value is the currently installed version.
-
#packages ⇒ Object
Returns a PackageList object that contains key value pairs for every package (installed or not) where the key is the package name and the value is a PackageInfo object.
-
#uninstall(packagename) ⇒ Object
Uninstalls the named package.
Methods inherited from PackageManager
#[], #installed?, #installed_version, #method_missing, #version
Constructor Details
#initialize ⇒ RPMPackageManager
Returns a new instance of RPMPackageManager.
11 12 13 14 |
# File 'lib/libcfruby/osmodules/linux-suse.rb', line 11 def initialize() # FIXME - search for rpm @rpmbin = 'rpm' end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Cfruby::Packages::PackageManager
Instance Method Details
#install(packagename, force = false) ⇒ Object
Installs the latest version of the named package
18 19 20 21 22 23 24 25 26 |
# File 'lib/libcfruby/osmodules/linux-suse.rb', line 18 def install(packagename, force=false) packagename.strip!() # FIXME - check to see if it is already installed Cfruby.controller.attempt("Installing \"#{packagename}\"", 'destructive', 'unknown', 'install') { `#{@rpmbin} -i '#{packagename.gsub(/(\')/, "\\\1")}'` } end |
#installed_packages ⇒ Object
Returns a PackageList object that contains key value pairs for every installed package where the key is the package name and the value is the currently installed version. See PackageList for more information
43 44 |
# File 'lib/libcfruby/osmodules/linux-suse.rb', line 43 def installed_packages() end |
#packages ⇒ Object
Returns a PackageList object that contains key value pairs for every package (installed or not) where the key is the package name and the value is a PackageInfo object
50 51 |
# File 'lib/libcfruby/osmodules/linux-suse.rb', line 50 def packages() end |
#uninstall(packagename) ⇒ Object
Uninstalls the named package
30 31 32 33 34 35 36 |
# File 'lib/libcfruby/osmodules/linux-suse.rb', line 30 def uninstall(packagename) pacakgename.strip!() Cfruby.controller.attempt("Uninstalling \"#{packagename}\"", 'destructive', 'unknown') { `#{@rpmbin} -e #{packagename}` } end |