Merge pull request #6660 from MikeMcQuaid/bundler-from-ruby

Use bundler from Ruby 2.6
This commit is contained in:
Mike McQuaid 2019-10-30 14:09:47 +00:00 committed by GitHub
commit d044c46beb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 8 deletions

View File

@ -132,4 +132,4 @@ DEPENDENCIES
simplecov simplecov
BUNDLED WITH BUNDLED WITH
2.0.2 1.17.2

View File

@ -69,9 +69,7 @@ module Homebrew
def install_gem_setup_path!(name, version: nil, executable: name, setup_gem_environment: true) 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) install_gem!(name, version: version, setup_gem_environment: setup_gem_environment)
return if ENV["PATH"].split(":").any? do |path| return if find_in_path(executable)
File.executable?("#{path}/#{executable}")
end
odie_if_defined <<~EOS odie_if_defined <<~EOS
the '#{name}' gem is installed but couldn't find '#{executable}' in the PATH: the '#{name}' gem is installed but couldn't find '#{executable}' in the PATH:
@ -79,10 +77,16 @@ module Homebrew
EOS EOS
end end
def find_in_path(executable)
ENV["PATH"].split(":").find do |path|
File.executable?("#{path}/#{executable}")
end
end
def install_bundler! def install_bundler!
require "rubygems" require "rubygems"
setup_gem_environment!(gem_home: Gem.user_dir, gem_bindir: gem_user_bindir) 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 end
def install_bundler_gems! def install_bundler_gems!
@ -90,7 +94,7 @@ module Homebrew
ENV["BUNDLE_GEMFILE"] = "#{ENV["HOMEBREW_LIBRARY"]}/Homebrew/Gemfile" ENV["BUNDLE_GEMFILE"] = "#{ENV["HOMEBREW_LIBRARY"]}/Homebrew/Gemfile"
@bundle_installed ||= begin @bundle_installed ||= begin
bundle = "#{gem_user_bindir}/bundle" bundle = "#{find_in_path(bundle)}/bundle"
bundle_check_output = `#{bundle} check 2>&1` bundle_check_output = `#{bundle} check 2>&1`
bundle_check_failed = !$CHILD_STATUS.success? bundle_check_failed = !$CHILD_STATUS.success?

View File

@ -1 +0,0 @@
2.6.1

View File

@ -260,4 +260,4 @@ DEPENDENCIES
rake rake
BUNDLED WITH BUNDLED WITH
2.0.1 1.17.2