Merge RubyGems/Bundler master from 4076391fce5847689bf2ec402b17133fe4e32285
This commit is contained in:
parent
30b960ba34
commit
4bbeed6134
Notes:
git
2023-05-30 12:50:27 +00:00
@ -210,9 +210,10 @@ module Bundler
|
||||
end
|
||||
|
||||
def frozen_bundle?
|
||||
frozen = settings[:deployment]
|
||||
frozen ||= settings[:frozen]
|
||||
frozen
|
||||
frozen = settings[:frozen]
|
||||
return frozen unless frozen.nil?
|
||||
|
||||
settings[:deployment]
|
||||
end
|
||||
|
||||
def locked_gems
|
||||
|
@ -361,10 +361,8 @@ module Bundler
|
||||
"updated #{Bundler.default_lockfile.relative_path_from(SharedHelpers.pwd)} to version control."
|
||||
|
||||
unless explicit_flag
|
||||
suggested_command = if Bundler.settings.locations("frozen").keys.&([:global, :local]).any?
|
||||
"bundle config unset frozen"
|
||||
elsif Bundler.settings.locations("deployment").keys.&([:global, :local]).any?
|
||||
"bundle config unset deployment"
|
||||
suggested_command = unless Bundler.settings.locations("frozen").keys.include?(:env)
|
||||
"bundle config set frozen false"
|
||||
end
|
||||
msg << "\n\nIf this is a development machine, remove the #{Bundler.default_gemfile} " \
|
||||
"freeze \nby running `#{suggested_command}`." if suggested_command
|
||||
@ -886,7 +884,8 @@ module Bundler
|
||||
if preserve_unknown_sections
|
||||
sections_to_ignore = LockfileParser.sections_to_ignore(@locked_bundler_version)
|
||||
sections_to_ignore += LockfileParser.unknown_sections_in_lockfile(current)
|
||||
sections_to_ignore += LockfileParser::ENVIRONMENT_VERSION_SECTIONS
|
||||
sections_to_ignore << LockfileParser::RUBY
|
||||
sections_to_ignore << LockfileParser::BUNDLED unless @unlocking_bundler
|
||||
pattern = /#{Regexp.union(sections_to_ignore)}\n(\s{2,}.*\n)+/
|
||||
whitespace_cleanup = /\n{2,}/
|
||||
current = current.gsub(pattern, "\n").gsub(whitespace_cleanup, "\n\n").strip
|
||||
|
@ -90,7 +90,7 @@ module Bundler
|
||||
|
||||
Gem::Specification.reset # invalidate gem specification cache so that installed gems are immediately available
|
||||
|
||||
lock unless Bundler.frozen_bundle?
|
||||
lock
|
||||
Standalone.new(options[:standalone], @definition).generate if options[:standalone]
|
||||
end
|
||||
end
|
||||
|
@ -26,6 +26,7 @@ module Bundler
|
||||
KNOWN_SECTIONS = SECTIONS_BY_VERSION_INTRODUCED.values.flatten.freeze
|
||||
|
||||
ENVIRONMENT_VERSION_SECTIONS = [BUNDLED, RUBY].freeze
|
||||
deprecate_constant(:ENVIRONMENT_VERSION_SECTIONS)
|
||||
|
||||
def self.sections_in_lockfile(lockfile_contents)
|
||||
lockfile_contents.scan(/^\w[\w ]*$/).uniq
|
||||
|
@ -245,7 +245,7 @@ By default, this RubyGems will install gem as:
|
||||
def install_executables(bin_dir)
|
||||
prog_mode = options[:prog_mode] || 0o755
|
||||
|
||||
executables = { "gem" => "bin" }
|
||||
executables = { "gem" => "exe" }
|
||||
executables.each do |tool, path|
|
||||
say "Installing #{tool} executable" if @verbose
|
||||
|
||||
|
@ -659,21 +659,21 @@ RSpec.describe "bundle update" do
|
||||
|
||||
expect(last_command).to be_failure
|
||||
expect(err).to match(/You are trying to install in deployment mode after changing.your Gemfile/m)
|
||||
expect(err).to match(/freeze \nby running `bundle config unset deployment`./m)
|
||||
expect(err).to match(/freeze \nby running `bundle config set frozen false`./m)
|
||||
end
|
||||
|
||||
it "should suggest different command when frozen is set globally", :bundler => "< 3" do
|
||||
it "should fail loudly when frozen is set globally" do
|
||||
bundle "config set --global frozen 1"
|
||||
bundle "update", :all => true, :raise_on_error => false
|
||||
expect(err).to match(/You are trying to install in deployment mode after changing.your Gemfile/m).
|
||||
and match(/freeze \nby running `bundle config unset frozen`./m)
|
||||
and match(/freeze \nby running `bundle config set frozen false`./m)
|
||||
end
|
||||
|
||||
it "should suggest different command when frozen is set globally", :bundler => "3" do
|
||||
it "should fail loudly when deployment is set globally" do
|
||||
bundle "config set --global deployment true"
|
||||
bundle "update", :all => true, :raise_on_error => false
|
||||
expect(err).to match(/You are trying to install in deployment mode after changing.your Gemfile/m).
|
||||
and match(/freeze \nby running `bundle config unset deployment`./m)
|
||||
and match(/freeze \nby running `bundle config set frozen false`./m)
|
||||
end
|
||||
|
||||
it "should not suggest any command to unfreeze bundler if frozen is set through ENV" do
|
||||
@ -1451,6 +1451,31 @@ RSpec.describe "bundle update --bundler" do
|
||||
expect(out).to include("Using bundler 2.3.9")
|
||||
end
|
||||
end
|
||||
|
||||
it "prints an error when trying to update bundler in frozen mode" do
|
||||
system_gems "bundler-2.3.9"
|
||||
|
||||
gemfile <<~G
|
||||
source "#{file_uri_for(gem_repo2)}"
|
||||
G
|
||||
|
||||
lockfile <<-L
|
||||
GEM
|
||||
remote: #{file_uri_for(gem_repo2)}/
|
||||
specs:
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
|
||||
BUNDLED WITH
|
||||
2.1.4
|
||||
L
|
||||
|
||||
bundle "update --bundler=2.3.9", :env => { "BUNDLE_FROZEN" => "true" }
|
||||
expect(err).to include("Cannot write a changed lockfile while frozen")
|
||||
end
|
||||
end
|
||||
|
||||
# these specs are slow and focus on integration and therefore are not exhaustive. unit specs elsewhere handle that.
|
||||
|
@ -1148,7 +1148,7 @@ RSpec.describe "bundle install with git sources" do
|
||||
it "gives a helpful error message when the remote branch no longer exists" do
|
||||
build_git "foo"
|
||||
|
||||
install_gemfile <<-G, :raise_on_error => false
|
||||
install_gemfile <<-G, :env => { "LANG" => "en" }, :raise_on_error => false
|
||||
source "#{file_uri_for(gem_repo1)}"
|
||||
gem "foo", :git => "#{file_uri_for(lib_path("foo-1.0"))}", :branch => "deadbeef"
|
||||
G
|
||||
|
@ -28,7 +28,7 @@ RSpec.describe "bundle lock with git gems" do
|
||||
gem 'foo', :git => "#{lib_path("foo-1.0")}", :branch => "bad"
|
||||
G
|
||||
|
||||
bundle "lock --update foo", :raise_on_error => false
|
||||
bundle "lock --update foo", :env => { "LANG" => "en" }, :raise_on_error => false
|
||||
|
||||
expect(err).to include("Revision bad does not exist in the repository")
|
||||
end
|
||||
|
@ -302,7 +302,7 @@ module Spec
|
||||
def install_gem(path, default = false)
|
||||
raise "OMG `#{path}` does not exist!" unless File.exist?(path)
|
||||
|
||||
args = "--no-document --ignore-dependencies"
|
||||
args = "--no-document --ignore-dependencies --verbose --local"
|
||||
args += " --default --install-dir #{system_gem_path}" if default
|
||||
|
||||
gem_command "install #{args} '#{path}'"
|
||||
|
@ -42,7 +42,8 @@ module Spec
|
||||
end
|
||||
|
||||
def dev_gemfile
|
||||
@dev_gemfile ||= tool_dir.join("dev_gems.rb")
|
||||
name = RUBY_VERSION.start_with?("2.6") ? "dev26_gems.rb" : "dev_gems.rb"
|
||||
@dev_gemfile ||= tool_dir.join(name)
|
||||
end
|
||||
|
||||
def bindir
|
||||
|
@ -18,7 +18,7 @@ class TestGemCommandsSetupCommand < Gem::TestCase
|
||||
@cmd.options[:document] = []
|
||||
|
||||
filelist = %w[
|
||||
bin/gem
|
||||
exe/gem
|
||||
lib/rubygems.rb
|
||||
lib/rubygems/requirement.rb
|
||||
lib/rubygems/ssl_certs/rubygems.org/foo.pem
|
||||
|
@ -100,7 +100,7 @@ class TestGemExtCargoBuilder < Gem::TestCase
|
||||
require "tmpdir"
|
||||
|
||||
env_for_subprocess = @rust_envs.merge("GEM_HOME" => Gem.paths.home)
|
||||
gem = [env_for_subprocess, *ruby_with_rubygems_in_load_path, File.expand_path("../../bin/gem", __dir__)]
|
||||
gem = [env_for_subprocess, *ruby_with_rubygems_in_load_path, File.expand_path("../../exe/gem", __dir__)]
|
||||
|
||||
Dir.mktmpdir("rust_ruby_example") do |dir|
|
||||
built_gem = File.expand_path(File.join(dir, "rust_ruby_example.gem"))
|
||||
@ -122,7 +122,7 @@ class TestGemExtCargoBuilder < Gem::TestCase
|
||||
require "tmpdir"
|
||||
|
||||
env_for_subprocess = @rust_envs.merge("GEM_HOME" => Gem.paths.home)
|
||||
gem = [env_for_subprocess, *ruby_with_rubygems_in_load_path, File.expand_path("../../bin/gem", __dir__)]
|
||||
gem = [env_for_subprocess, *ruby_with_rubygems_in_load_path, File.expand_path("../../exe/gem", __dir__)]
|
||||
|
||||
Dir.mktmpdir("custom_name") do |dir|
|
||||
built_gem = File.expand_path(File.join(dir, "custom_name.gem"))
|
||||
|
@ -4,9 +4,6 @@ require_relative "helper"
|
||||
|
||||
class TestGemGemRunner < Gem::TestCase
|
||||
def setup
|
||||
@orig_gem_home = ENV["GEM_HOME"]
|
||||
ENV["GEM_HOME"] = @gemhome
|
||||
|
||||
require "rubygems/command"
|
||||
@orig_args = Gem::Command.build_args
|
||||
@orig_specific_extra_args = Gem::Command.specific_extra_args_hash.dup
|
||||
@ -24,8 +21,6 @@ class TestGemGemRunner < Gem::TestCase
|
||||
Gem::Command.build_args = @orig_args
|
||||
Gem::Command.specific_extra_args_hash = @orig_specific_extra_args
|
||||
Gem::Command.extra_args = @orig_extra_args
|
||||
|
||||
ENV["GEM_HOME"] = @orig_gem_home
|
||||
end
|
||||
|
||||
def test_do_configuration
|
||||
|
@ -7,7 +7,8 @@ gem "rake", "~> 13.0"
|
||||
gem "rb_sys"
|
||||
|
||||
gem "webrick", "~> 1.6"
|
||||
gem "parallel_tests", "~> 2.29"
|
||||
gem "turbo_tests", "~> 2.1"
|
||||
gem "parallel_tests", "< 3.9.0"
|
||||
gem "parallel", "~> 1.19"
|
||||
gem "rspec-core", "~> 3.12"
|
||||
gem "rspec-expectations", "~> 3.12"
|
||||
|
@ -5,34 +5,42 @@ GEM
|
||||
hpricot (0.8.6)
|
||||
hpricot (0.8.6-java)
|
||||
mustache (1.1.1)
|
||||
parallel (1.22.1)
|
||||
parallel_tests (2.32.0)
|
||||
parallel (1.23.0)
|
||||
parallel_tests (3.8.1)
|
||||
parallel
|
||||
power_assert (2.0.2)
|
||||
power_assert (2.0.3)
|
||||
rake (13.0.6)
|
||||
rb_sys (0.9.63)
|
||||
rb_sys (0.9.78)
|
||||
rdiscount (2.2.7)
|
||||
ronn (0.7.3)
|
||||
hpricot (>= 0.8.2)
|
||||
mustache (>= 0.7.0)
|
||||
rdiscount (>= 1.5.8)
|
||||
rspec-core (3.12.0)
|
||||
rspec (3.12.0)
|
||||
rspec-core (~> 3.12.0)
|
||||
rspec-expectations (~> 3.12.0)
|
||||
rspec-mocks (~> 3.12.0)
|
||||
rspec-core (3.12.2)
|
||||
rspec-support (~> 3.12.0)
|
||||
rspec-expectations (3.12.0)
|
||||
rspec-expectations (3.12.3)
|
||||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
rspec-support (~> 3.12.0)
|
||||
rspec-mocks (3.12.1)
|
||||
rspec-mocks (3.12.5)
|
||||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
rspec-support (~> 3.12.0)
|
||||
rspec-support (3.12.0)
|
||||
test-unit (3.5.5)
|
||||
test-unit (3.5.9)
|
||||
power_assert
|
||||
uri (0.12.0)
|
||||
webrick (1.7.0)
|
||||
turbo_tests (2.1.0)
|
||||
bundler (>= 2.1)
|
||||
parallel_tests (>= 3.3.0, < 5)
|
||||
rspec (>= 3.10)
|
||||
uri (0.12.1)
|
||||
webrick (1.8.1)
|
||||
|
||||
PLATFORMS
|
||||
arm64-darwin-22
|
||||
java
|
||||
ruby
|
||||
universal-java-11
|
||||
universal-java-18
|
||||
x64-mingw-ucrt
|
||||
@ -42,7 +50,7 @@ PLATFORMS
|
||||
|
||||
DEPENDENCIES
|
||||
parallel (~> 1.19)
|
||||
parallel_tests (~> 2.29)
|
||||
parallel_tests (< 3.9.0)
|
||||
rake (~> 13.0)
|
||||
rb_sys
|
||||
ronn (~> 0.7.3)
|
||||
@ -50,6 +58,7 @@ DEPENDENCIES
|
||||
rspec-expectations (~> 3.12)
|
||||
rspec-mocks (~> 3.12)
|
||||
test-unit (~> 3.0)
|
||||
turbo_tests (~> 2.1)
|
||||
uri (~> 0.12.0)
|
||||
webrick (~> 1.6)
|
||||
|
||||
|
@ -21,12 +21,12 @@ GEM
|
||||
rspec-core (~> 3.12.0)
|
||||
rspec-expectations (~> 3.12.0)
|
||||
rspec-mocks (~> 3.12.0)
|
||||
rspec-core (3.12.0)
|
||||
rspec-core (3.12.2)
|
||||
rspec-support (~> 3.12.0)
|
||||
rspec-expectations (3.12.0)
|
||||
rspec-expectations (3.12.3)
|
||||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
rspec-support (~> 3.12.0)
|
||||
rspec-mocks (3.12.1)
|
||||
rspec-mocks (3.12.5)
|
||||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
rspec-support (~> 3.12.0)
|
||||
rspec-support (3.12.0)
|
||||
|
@ -22,12 +22,12 @@ GEM
|
||||
rspec-core (~> 3.12.0)
|
||||
rspec-expectations (~> 3.12.0)
|
||||
rspec-mocks (~> 3.12.0)
|
||||
rspec-core (3.12.0)
|
||||
rspec-core (3.12.2)
|
||||
rspec-support (~> 3.12.0)
|
||||
rspec-expectations (3.12.0)
|
||||
rspec-expectations (3.12.3)
|
||||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
rspec-support (~> 3.12.0)
|
||||
rspec-mocks (3.12.1)
|
||||
rspec-mocks (3.12.5)
|
||||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
rspec-support (~> 3.12.0)
|
||||
rspec-support (3.12.0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user