Skip to content

Commit

Permalink
Try to use Gem::Installer for default gems in Bundler's example
Browse files Browse the repository at this point in the history
  • Loading branch information
hsbt committed Apr 18, 2024
1 parent 40a1a27 commit 87b194f
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions bundler/spec/support/helpers.rb
Expand Up @@ -320,10 +320,20 @@ def system_gems(*gems)
def install_gem(path, install_dir, default = false)
raise "OMG `#{path}` does not exist!" unless File.exist?(path)

args = "--no-document --ignore-dependencies --verbose --local --install-dir #{install_dir}"
args += " --default" if default

gem_command "install #{args} '#{path}'"
require "rubygems/installer"
installer = Gem::Installer.at(
path,
document: [],
ignore_dependencies: true,
verbose: true,
domain: :local,
install_dir: install_dir,
)
installer.install
if default
File.delete installer.spec_file
installer.write_default_spec
end
end

def with_built_bundler(version = nil, &block)
Expand Down

0 comments on commit 87b194f

Please sign in to comment.