summaryrefslogtreecommitdiffstats
path: root/lib/puppet/provider/package/gem.rb
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-09-06 04:49:45 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-09-06 04:49:45 +0000
commite309b76e168f83e27cf541dc19a02c5b25c1e47c (patch)
treef5849a38377df2d719646c438d43ccdb9a99702f /lib/puppet/provider/package/gem.rb
parentc5ce953462f424138f0009ce978eb9620aff84a7 (diff)
downloadpuppet-e309b76e168f83e27cf541dc19a02c5b25c1e47c.tar.gz
puppet-e309b76e168f83e27cf541dc19a02c5b25c1e47c.tar.xz
puppet-e309b76e168f83e27cf541dc19a02c5b25c1e47c.zip
Modifying the provider base class so that it defines a method for every used command (e.g., you call "commands :rpm => 'rpm'", and it defines an "rpm" method. I then pushed this throughout the package providers, which are the heaviest users of commands.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1571 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet/provider/package/gem.rb')
-rwxr-xr-xlib/puppet/provider/package/gem.rb19
1 files changed, 5 insertions, 14 deletions
diff --git a/lib/puppet/provider/package/gem.rb b/lib/puppet/provider/package/gem.rb
index 67d5e37c4..b0ecaafe6 100755
--- a/lib/puppet/provider/package/gem.rb
+++ b/lib/puppet/provider/package/gem.rb
@@ -17,6 +17,7 @@ Puppet::Type.type(:package).provide :gem do
if name = hash[:justme]
command += name
end
+
begin
list = execute(command).split("\n\n").collect do |set|
if gemhash = gemsplit(set)
@@ -60,7 +61,7 @@ Puppet::Type.type(:package).provide :gem do
end
def install(useversion = true)
- command = "#{command(:gem)} install "
+ command = "install "
if (! @model.should(:ensure).is_a? Symbol) and useversion
command += "-v %s " % @model.should(:ensure)
end
@@ -69,12 +70,8 @@ Puppet::Type.type(:package).provide :gem do
else
command += @model[:name]
end
- begin
- execute(command)
- rescue Puppet::ExecutionFailure => detail
- raise Puppet::Error, "Could not install %s: %s" %
- [@model[:name], detail]
- end
+
+ gem command
end
def latest
@@ -89,13 +86,7 @@ Puppet::Type.type(:package).provide :gem do
end
def uninstall
- begin
- # Remove everything, including the binaries.
- execute("#{command(:gem)} uninstall -x -a #{@model[:name]}")
- rescue Puppet::ExecutionFailure => detail
- raise Puppet::Error, "Could not uninstall %s: %s" %
- [@model[:name], detail]
- end
+ gem "uninstall -x -a #{@model[:name]}"
end
def update