summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2022-03-21 20:33:56 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2022-03-21 20:33:56 -0700
commit86c3d3abee5134638d891b933461e87a614b35b9 (patch)
tree9a8b5f004e0d42af9a7b48cf9253564774ec302c
parent5e1179214e3bafbf225decea29db23598d4b336b (diff)
downloadchef-86c3d3abee5134638d891b933461e87a614b35b9.tar.gz
fix post-bundle-install
pull the name off of the gemspec, not the dirname Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
-rw-r--r--post-bundle-install.rb10
1 files changed, 4 insertions, 6 deletions
diff --git a/post-bundle-install.rb b/post-bundle-install.rb
index 3abefab725..2a4b0cb5e6 100644
--- a/post-bundle-install.rb
+++ b/post-bundle-install.rb
@@ -9,19 +9,17 @@ 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")
+
next unless gem_name
- next if gem_name == "chef"
+ next if gem_name == "chef" || gem_name == "chef-universal-mingw32"
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"