Skip to content

Commit 0470306

Browse files
committed
Remove gemspec for default gems we are updating
When we are providing a newer version of a default gem than the one that Ruby ships with, in order to avoid warnings about multiple gem versions being available, we have to remove the gemspec for the older version. Generally, we don't need to ship our own version of a default gem unless it has a CVE and Ruby has not yet fixed it.
1 parent 8a436cd commit 0470306

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

configs/components/_base-rubygem.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,10 @@
4646
else
4747
"#{settings[:gem_install]} #{name}-#{version}.gem #{gem_install_options}"
4848
end
49+
# If we are installing a newer version of a default gem, we need to remove the existing
50+
# specification file so that we don't get warnings.
51+
steps << "rm -f #{settings[:gem_home]}/specifications/default/#{name}-*.gemspec"
52+
# This dir is usually empty and only there for compatilibity reasons for things requiring
53+
# a directory corresponding to a gemspec. Remove it to avoid confusion.
54+
steps << "rm -f #{settings[:gem_home]}/gems/#{name}-*[!#{version}]"
4955
end

0 commit comments

Comments
 (0)