From c923af57de86ac904d67e38e9b57bfcf438f1739 Mon Sep 17 00:00:00 2001 From: Carl Denis Date: Wed, 28 Oct 2015 17:59:17 +0100 Subject: [PATCH] add support for puppet:// source of gem --- lib/puppet/provider/rvm_gem/gem.rb | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/puppet/provider/rvm_gem/gem.rb b/lib/puppet/provider/rvm_gem/gem.rb index 704c20b0..74987a58 100644 --- a/lib/puppet/provider/rvm_gem/gem.rb +++ b/lib/puppet/provider/rvm_gem/gem.rb @@ -76,6 +76,15 @@ def self.gemsplit(desc) end end + def gemfile_from_puppet_url(source) + unless tmp = Puppet::FileServing::Content.indirection.find(source, :environment => resource.catalog.environment_instance, :links => :follow) + fail "Could not find gemfile at %s" % source + end + tmpfile = Tempfile.open(['puppet-rvm_geminstaller','.gem']) + tmpfile.write(tmp.content) + tmpfile.flush + return tmpfile.path.to_s + end def install(useversion = true) command = gembinary + ['install'] @@ -102,8 +111,7 @@ def install(useversion = true) when /file/i command << uri.path when 'puppet' - # we don't support puppet:// URLs (yet) - raise Puppet::Error.new("puppet:// URLs are not supported as gem sources") + command << gemfile_from_puppet_url(uri.to_s) else # interpret it as a gem repository command << "--source" << "#{source}" << resource[:name]