Skip to content

Commit e40bafe

Browse files
committed
Shell out fewer times
This is a follow up to #9053. We can avoid shelling out for generating the gem index.
1 parent b1ab33a commit e40bafe

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

bundler/spec/spec_helper.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
require "rspec/expectations"
2828
require "rspec/mocks"
2929
require "rspec/support/differ"
30+
require "rubygems/indexer"
3031

3132
require_relative "support/builders"
3233
require_relative "support/checksums"

bundler/spec/support/builders.rb

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -279,14 +279,8 @@ def update_repo(path, build_compact_index: true)
279279
@_build_path = "#{path}/gems"
280280
@_build_repo = File.basename(path)
281281
yield
282-
with_gem_path_as scoped_base_system_gem_path do
283-
Dir[scoped_base_system_gem_path.join("gems/rubygems-generate_index*/lib")].first ||
284-
raise("Could not find rubygems-generate_index lib directory in #{scoped_base_system_gem_path}")
285-
286-
command = "generate_index"
287-
command += " --no-compact" if !build_compact_index && gem_command(command + " --help").include?("--[no-]compact")
288-
gem_command command, dir: path
289-
end
282+
options = { build_compact: build_compact_index }
283+
Gem::Indexer.new(path, options).generate_index
290284
ensure
291285
@_build_path = nil
292286
@_build_repo = nil

0 commit comments

Comments
 (0)