diff --git a/lib/puppet/provider/rvm_gem/gem.rb b/lib/puppet/provider/rvm_gem/gem.rb index 704c20b0..e79d753e 100644 --- a/lib/puppet/provider/rvm_gem/gem.rb +++ b/lib/puppet/provider/rvm_gem/gem.rb @@ -38,8 +38,13 @@ def gemlist(hash) command << "--http-proxy" << resource[:proxy_url] end + if resource[:source] && source_uri(resource[:source]).scheme =~ /^http/ + command << '--source' << resource[:source].to_s + end + list = [] begin + Puppet.debug("Running command #{command}") list = execute(command).split("\n").collect do |set| if gemhash = self.class.gemsplit(set) gemhash[:provider] = :gem @@ -76,7 +81,6 @@ def self.gemsplit(desc) end end - def install(useversion = true) command = gembinary + ['install'] command << "-v" << resource[:ensure] if (! resource[:ensure].is_a? Symbol) and useversion @@ -89,12 +93,7 @@ def install(useversion = true) end if source = resource[:source] - begin - uri = URI.parse(source) - rescue => detail - fail "Invalid source '#{uri}': #{detail}" - end - + uri = source_uri(source) case uri.scheme when nil # no URI scheme => interpret the source as a local file @@ -123,6 +122,15 @@ def install(useversion = true) self.fail "Could not install: #{output.chomp}" if output.include?("ERROR") end + def source_uri(source) + begin + uri = URI.parse(source) + rescue => detail + fail "Invalid source '#{uri}': #{detail}" + end + uri + end + def latest # This always gets the latest version available. hash = gemlist(:justme => resource[:name])