1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Merge bundler-2.1.1 from bundler/bundler

This commit is contained in:
Hiroshi SHIBATA 2019-12-18 14:53:19 +09:00
parent fa7fa5c86b
commit efbc0d499c
No known key found for this signature in database
GPG key ID: F9CF13417264FAC2
5 changed files with 23 additions and 13 deletions

View file

@ -25,12 +25,12 @@ module Bundler
SharedHelpers.set_bundle_environment
if bin_path = Bundler.which(cmd)
if !Bundler.settings[:disable_exec_load] && ruby_shebang?(bin_path)
return with_verbose_rubygems { kernel_load(bin_path, *args) }
return kernel_load(bin_path, *args)
end
with_verbose_rubygems { kernel_exec(bin_path, *args) }
kernel_exec(bin_path, *args)
else
# exec using the given command
with_verbose_rubygems { kernel_exec(cmd, *args) }
kernel_exec(cmd, *args)
end
end
@ -89,14 +89,5 @@ module Bundler
first_line = File.open(file, "rb") {|f| f.read(possibilities.map(&:size).max) }
possibilities.any? {|shebang| first_line.start_with?(shebang) }
end
def with_verbose_rubygems
old_ui = Gem::DefaultUserInteraction.ui
Gem::DefaultUserInteraction.ui = nil
yield
ensure
Gem::DefaultUserInteraction.ui = old_ui
end
end
end

View file

@ -525,6 +525,14 @@ module Bundler
end
end
def plain_specs
Gem::Specification._all
end
def plain_specs=(specs)
Gem::Specification.all = specs
end
def fetch_specs(remote, name)
path = remote.uri.to_s + "#{name}.#{Gem.marshal_version}.gz"
fetcher = gem_remote_fetcher

View file

@ -19,4 +19,9 @@ if Bundler::SharedHelpers.in_bundle?
else
Bundler.ui.silence { Bundler.setup }
end
# We might be in the middle of shelling out to rubygems
# (RUBYOPT=-rbundler/setup), so we need to give rubygems the opportunity of
# not being silent.
Gem::DefaultUserInteraction.ui = nil
end

View file

@ -1,7 +1,7 @@
# frozen_string_literal: false
module Bundler
VERSION = "2.1.0".freeze
VERSION = "2.1.1".freeze
def self.bundler_major_version
@bundler_major_version ||= VERSION.split(".").first.to_i

View file

@ -61,6 +61,12 @@ RSpec.describe "bundle exec" do
expect(out).to eq(Gem::VERSION)
end
it "works when exec'ing to rubygems through sh -c" do
install_gemfile 'gem "rack"'
bundle "exec sh -c '#{gem_cmd} --version'"
expect(out).to eq(Gem::VERSION)
end
it "respects custom process title when loading through ruby" do
script_that_changes_its_own_title_and_checks_if_picked_up_by_ps_unix_utility = <<~'RUBY'
Process.setproctitle("1-2-3-4-5-6-7-8-9-10-11-12-13-14-15")