summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVikram Karve <vikram.karve@progress.com>2023-03-13 22:48:05 +0530
committerVikram Karve <vikram.karve@progress.com>2023-03-13 22:48:05 +0530
commit730889d34b8f9650b8d7d70acd890b15126363ba (patch)
treeb4ae3ad9afc2625efdced01b10e18634e1a465bc
parent0bedc86a0347b1ae42773e44643498066b0929c2 (diff)
downloadchef-730889d34b8f9650b8d7d70acd890b15126363ba.tar.gz
sync gem filter with main branch
Signed-off-by: Vikram Karve <vikram.karve@progress.com>
-rw-r--r--post-bundle-install.rb12
1 files changed, 6 insertions, 6 deletions
diff --git a/post-bundle-install.rb b/post-bundle-install.rb
index 3abefab725..f3b953e7e3 100644
--- a/post-bundle-install.rb
+++ b/post-bundle-install.rb
@@ -9,19 +9,19 @@ puts "fixing bundle installed gems in #{gem_home}"
# rake install since we need --conservative --minimal-deps in order to not install duplicate gems.
#
Dir["#{gem_home}/bundler/gems/*"].each do |gempath|
- matches = File.basename(gempath).match(/(.*)-[A-Fa-f0-9]{12}/)
+ matches = File.basename(gempath).match(/.*-[A-Fa-f0-9]{12}/)
next unless matches
- gem_name = matches[1]
+ gem_name = File.basename(Dir["#{gempath}/*.gemspec"].first, ".gemspec")
+ # FIXME: should strip any valid ruby platform off of the gem_name if it matches
+
next unless gem_name
- next if gem_name == "chef"
+ # FIXME: should omit the gem which is in the current directory and not hard code chef
+ next if %w{chef chef-universal-mingw-ucrt}.include?(gem_name)
puts "re-installing #{gem_name}..."
- # we can't use "command" or "bundle" or "gem" DSL methods here since those are lazy and we need to run commands immediately
- # (this is like a shell_out inside of a ruby_block in core chef, you don't use an execute resource inside of a ruby_block or
- # things get really weird and unexpected)
Dir.chdir(gempath) do
system("gem build #{gem_name}.gemspec") or raise "gem build failed"
system("gem install #{gem_name}*.gem --conservative --minimal-deps --no-document") or raise "gem install failed"