Use bundler from Ruby 2.6
Now Ruby comes with its own bundler let's favour using it when we can over requiring a system one be installed. This avoids needing to have anything in `~/.gem` again. I am somewhat optimistic this may help with #6579 but it's useful by itself.
This commit is contained in:
parent
13bc67fc2d
commit
77531166d6
@ -132,4 +132,4 @@ DEPENDENCIES
|
||||
simplecov
|
||||
|
||||
BUNDLED WITH
|
||||
2.0.2
|
||||
1.17.2
|
||||
|
||||
@ -69,9 +69,7 @@ module Homebrew
|
||||
|
||||
def install_gem_setup_path!(name, version: nil, executable: name, setup_gem_environment: true)
|
||||
install_gem!(name, version: version, setup_gem_environment: setup_gem_environment)
|
||||
return if ENV["PATH"].split(":").any? do |path|
|
||||
File.executable?("#{path}/#{executable}")
|
||||
end
|
||||
return if find_in_path(executable)
|
||||
|
||||
odie_if_defined <<~EOS
|
||||
the '#{name}' gem is installed but couldn't find '#{executable}' in the PATH:
|
||||
@ -79,10 +77,16 @@ module Homebrew
|
||||
EOS
|
||||
end
|
||||
|
||||
def find_in_path(executable)
|
||||
ENV["PATH"].split(":").find do |path|
|
||||
File.executable?("#{path}/#{executable}")
|
||||
end
|
||||
end
|
||||
|
||||
def install_bundler!
|
||||
require "rubygems"
|
||||
setup_gem_environment!(gem_home: Gem.user_dir, gem_bindir: gem_user_bindir)
|
||||
install_gem_setup_path!("bundler", version: ">=2", executable: "bundle", setup_gem_environment: false)
|
||||
install_gem_setup_path!("bundler", version: ">=1.17", executable: "bundle", setup_gem_environment: false)
|
||||
end
|
||||
|
||||
def install_bundler_gems!
|
||||
@ -90,7 +94,7 @@ module Homebrew
|
||||
|
||||
ENV["BUNDLE_GEMFILE"] = "#{ENV["HOMEBREW_LIBRARY"]}/Homebrew/Gemfile"
|
||||
@bundle_installed ||= begin
|
||||
bundle = "#{gem_user_bindir}/bundle"
|
||||
bundle = "#{find_in_path(bundle)}/bundle"
|
||||
bundle_check_output = `#{bundle} check 2>&1`
|
||||
bundle_check_failed = !$CHILD_STATUS.success?
|
||||
|
||||
|
||||
@ -1 +0,0 @@
|
||||
2.6.1
|
||||
@ -260,4 +260,4 @@ DEPENDENCIES
|
||||
rake
|
||||
|
||||
BUNDLED WITH
|
||||
2.0.1
|
||||
1.17.2
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user