Skip to content

Commit

Permalink
Merge pull request #142 from jplindquist/master
Browse files Browse the repository at this point in the history
Update deprecated install options, and strip default string from gem output
  • Loading branch information
bastelfreak authored Jun 25, 2020
2 parents a8c2f1a + d101c1c commit 4678309
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions lib/puppet/provider/rvm_gem/gem.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ def ruby_version
resource[:ruby_version]
end

def rubygems_version
command = gembinary + ['-v']
execute(command)
end

def gembinary
[command(:rvmcmd), ruby_version, 'do', 'gem']
end
Expand Down Expand Up @@ -53,10 +58,11 @@ def gemlist(hash)
end

def self.gemsplit(desc)
desc = desc.gsub('default: ', '')

case desc
when %r{^\*\*\*}, %r{^\s*$}, %r{^\s+} then return nil
when %r{gem: not found} then nil
# when /^(\S+)\s+\((((((\d+[.]?))+)(,\s)*)+)\)/
when %r{^(\S+)\s+\((\d+.*)\)}
name = Regexp.last_match(1)
version = Regexp.last_match(2).split(%r{,\s*})
Expand Down Expand Up @@ -102,7 +108,11 @@ def install(useversion = true)
command << '--source' << source.to_s << resource[:name]
end
else
command << '--no-rdoc' << '--no-ri' << resource[:name]
if Gem::Version.new(rubygems_version) < Gem::Version.new('3.0.0')
command << '--no-rdoc' << '--no-ri' << resource[:name] # Deprecated options (backwards compatible)
else
command << '--no-document' << resource[:name]
end
end

# makefile opts,
Expand Down

0 comments on commit 4678309

Please sign in to comment.