utils/gems: install Bundler 2.

Our Gemfile requires it and it will result in a more consistent configuration.
This commit is contained in:
Mike McQuaid 2019-02-28 08:31:18 +00:00
parent ac3841a15c
commit 128300a754
No known key found for this signature in database
GPG Key ID: 48A898132FD8EE70

View File

@ -50,7 +50,7 @@ module Homebrew
ENV["PATH"] = paths.compact.join(":") ENV["PATH"] = paths.compact.join(":")
end end
def install_gem!(name, version = nil, setup_gem_environment: true) def install_gem!(name, version: nil, setup_gem_environment: true)
setup_gem_environment! if setup_gem_environment setup_gem_environment! if setup_gem_environment
return unless Gem::Specification.find_all_by_name(name, version).empty? return unless Gem::Specification.find_all_by_name(name, version).empty?
@ -63,8 +63,8 @@ module Homebrew
odie_if_defined "failed to install the '#{name}' gem." odie_if_defined "failed to install the '#{name}' gem."
end end
def install_gem_setup_path!(name, executable: name, setup_gem_environment: true) def install_gem_setup_path!(name, version: nil, executable: name, setup_gem_environment: true)
install_gem!(name, 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 ENV["PATH"].split(":").any? do |path|
File.executable?("#{path}/#{executable}") File.executable?("#{path}/#{executable}")
end end
@ -77,7 +77,7 @@ module Homebrew
def install_bundler! def install_bundler!
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", executable: "bundle", setup_gem_environment: false) install_gem_setup_path!("bundler", version: ">=2", executable: "bundle", setup_gem_environment: false)
end end
def install_bundler_gems! def install_bundler_gems!