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

Merge RubyGems-3.2.12 and Bundler-2.2.12

This commit is contained in:
Hiroshi SHIBATA 2021-03-02 20:38:16 +09:00 committed by NARUSE, Yui
parent f375bc77d2
commit 06cd5711e0
18 changed files with 282 additions and 92 deletions

View file

@ -594,7 +594,7 @@ module Bundler
deps_for_source = @dependencies.select {|s| s.source == source }
locked_deps_for_source = @locked_deps.values.select {|dep| dep.source == locked_source }
deps_for_source.sort != locked_deps_for_source.sort
deps_for_source.uniq.sort != locked_deps_for_source.sort
end
def specs_for_source_changed?(source)

View file

@ -89,6 +89,8 @@ module Bundler
end
install(options)
Gem::Specification.reset # invalidate gem specification cache so that installed gems are immediately available
lock unless Bundler.frozen_bundle?
Standalone.new(options[:standalone], @definition).generate if options[:standalone]
end

View file

@ -8,6 +8,53 @@ module Bundler
# Bundler needs to install gems regardless of binstub overwriting
end
def install
pre_install_checks
run_pre_install_hooks
spec.loaded_from = spec_file
# Completely remove any previous gem files
FileUtils.rm_rf gem_dir
FileUtils.rm_rf spec.extension_dir
FileUtils.mkdir_p gem_dir, :mode => 0o755
extract_files
build_extensions
write_build_info_file
run_post_build_hooks
generate_bin
generate_plugins
write_spec
write_cache_file
say spec.post_install_message unless spec.post_install_message.nil?
run_post_install_hooks
spec
end
def generate_plugins
return unless Gem::Installer.instance_methods(false).include?(:generate_plugins)
latest = Gem::Specification.stubs_for(spec.name).first
return if latest && latest.version > spec.version
ensure_writable_dir @plugins_dir
if spec.plugins.empty?
remove_plugins_for(spec, @plugins_dir)
else
regenerate_plugins_for(spec, @plugins_dir)
end
end
def pre_install_checks
super && validate_bundler_checksum(options[:bundler_expected_checksum])
end

View file

@ -26,11 +26,19 @@ module Bundler
# @!group Stub Delegates
def manually_installed?
# This is for manually installed gems which are gems that were fixed in place after a
# failed installation. Once the issue was resolved, the user then manually created
# the gem specification using the instructions provided by `gem help install`
installed_by_version == Gem::Version.new(0)
end
# This is defined directly to avoid having to loading the full spec
def missing_extensions?
return false if default_gem?
return false if extensions.empty?
return false if File.exist? gem_build_complete_path
return false if manually_installed?
true
end

View file

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

View file

@ -8,7 +8,7 @@
require 'rbconfig'
module Gem
VERSION = "3.2.11".freeze
VERSION = "3.2.12".freeze
end
# Must be first since it unloads the prelude from 1.9.2

View file

@ -25,7 +25,7 @@ RSpec.describe Bundler::Dsl do
expect { subject.git_source(:example) }.to raise_error(Bundler::InvalidOption)
end
context "default hosts", :bundler => "2" do
context "default hosts", :bundler => "< 3" do
it "converts :github to URI using https" do
subject.gem("sparks", :github => "indirect/sparks")
github_uri = "https://github.com/indirect/sparks.git"
@ -195,19 +195,6 @@ RSpec.describe Bundler::Dsl do
# gem 'spree_api'
# gem 'spree_backend'
# end
describe "#github", :bundler => "< 3" do
it "from github" do
spree_gems = %w[spree_core spree_api spree_backend]
subject.github "spree" do
spree_gems.each {|spree_gem| subject.send :gem, spree_gem }
end
subject.dependencies.each do |d|
expect(d.source.uri).to eq("https://github.com/spree/spree.git")
end
end
end
describe "#github" do
it "from github" do
spree_gems = %w[spree_core spree_api spree_backend]

View file

@ -6,6 +6,7 @@ RSpec.describe Bundler::StubSpecification do
s.name = "gemname"
s.version = "1.0.0"
s.loaded_from = __FILE__
s.extensions = "ext/gemname"
end
described_class.from_stub(gemspec)
@ -17,4 +18,30 @@ RSpec.describe Bundler::StubSpecification do
expect(stub).to be(with_bundler_stub_spec)
end
end
describe "#manually_installed?" do
it "returns true if installed_by_version is nil or 0" do
stub = described_class.from_stub(with_bundler_stub_spec)
expect(stub.manually_installed?).to be true
end
it "returns false if installed_by_version is greater than 0" do
stub = described_class.from_stub(with_bundler_stub_spec)
stub.installed_by_version = Gem::Version.new(1)
expect(stub.manually_installed?).to be false
end
end
describe "#missing_extensions?" do
it "returns false if manually_installed?" do
stub = described_class.from_stub(with_bundler_stub_spec)
expect(stub.missing_extensions?).to be false
end
it "returns true if not manually_installed?" do
stub = described_class.from_stub(with_bundler_stub_spec)
stub.installed_by_version = Gem::Version.new(1)
expect(stub.missing_extensions?).to be true
end
end
end

View file

@ -21,12 +21,12 @@ RSpec.describe "bundle install" do
expect(the_bundle).to include_gems "bundler #{Bundler::VERSION}"
end
it "are not added if not already present" do
it "are forced to the current bundler version even if not already present" do
install_gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
gem "rack"
G
expect(the_bundle).not_to include_gems "bundler #{Bundler::VERSION}"
expect(the_bundle).to include_gems "bundler #{Bundler::VERSION}"
end
it "causes a conflict if explicitly requesting a different version of bundler" do

View file

@ -85,6 +85,18 @@ RSpec.describe "install in deployment or frozen mode" do
bundle :install
end
it "works when path gems are specified twice" do
build_lib "foo", :path => lib_path("nested/foo")
gemfile <<-G
gem "foo", :path => "#{lib_path("nested/foo")}"
gem "foo", :path => "#{lib_path("nested/foo")}"
G
bundle :install
bundle "config set --local deployment true"
bundle :install
end
it "works when there are credentials in the source URL" do
install_gemfile(<<-G, :artifice => "endpoint_strict_basic_authentication", :quiet => true)
source "http://user:pass@localgemserver.test/"
@ -401,7 +413,7 @@ RSpec.describe "install in deployment or frozen mode" do
gem "rack-obama"
G
expect(the_bundle).not_to include_gems "rack 1.0.0"
run "require 'rack'", :raise_on_error => false
expect(err).to include strip_whitespace(<<-E).strip
The dependencies in your gemfile changed

View file

@ -647,8 +647,6 @@ RSpec.describe "bundle install with git sources" do
end
it "installs dependencies from git even if a newer gem is available elsewhere" do
skip "override is not winning" if Gem.win_platform?
system_gems "rack-1.0.0"
build_lib "rack", "1.0", :path => lib_path("nested/bar") do |s|

View file

@ -136,8 +136,6 @@ RSpec.describe "bundle install with explicit source paths" do
end
it "installs dependencies from the path even if a newer gem is available elsewhere" do
skip "override is not winning" if Gem.win_platform?
system_gems "rack-1.0.0"
build_lib "rack", "1.0", :path => lib_path("nested/bar") do |s|
@ -701,8 +699,6 @@ RSpec.describe "bundle install with explicit source paths" do
describe "when there are both a gemspec and remote gems" do
it "doesn't query rubygems for local gemspec name" do
skip "platform issues" if Gem.win_platform?
build_lib "private_lib", "2.2", :path => lib_path("private_lib")
gemfile = <<-G
source "http://localgemserver.test"

View file

@ -27,7 +27,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
G
end
it "warns about ambiguous gems, but installs anyway, prioritizing sources last to first", :bundler => "2" do
it "warns about ambiguous gems, but installs anyway, prioritizing sources last to first", :bundler => "< 3" do
bundle :install
expect(err).to include("Warning: the gem 'rack' was found in multiple sources.")
@ -54,7 +54,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
G
end
it "warns about ambiguous gems, but installs anyway", :bundler => "2" do
it "warns about ambiguous gems, but installs anyway", :bundler => "< 3" do
bundle :install
expect(err).to include("Warning: the gem 'rack' was found in multiple sources.")
expect(err).to include("Installed from: #{file_uri_for(gem_repo1)}")
@ -96,7 +96,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
it "installs the gems without any warning" do
bundle :install
expect(out).not_to include("Warning")
expect(err).not_to include("Warning")
expect(the_bundle).to include_gems("rack-obama 1.0.0")
expect(the_bundle).to include_gems("rack 1.0.0", :source => "remote1")
end
@ -128,7 +128,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
end
end
gemfile <<-G
install_gemfile <<-G
source "#{file_uri_for(gem_repo3)}"
gem "rack-obama" # should come from repo3!
gem "rack", :source => "#{file_uri_for(gem_repo1)}"
@ -136,8 +136,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
end
it "installs the gems without any warning" do
bundle :install
expect(out).not_to include("Warning")
expect(err).not_to include("Warning")
expect(the_bundle).to include_gems("rack-obama 1.0.0", "rack 1.0.0")
end
end
@ -173,7 +172,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
it "installs from the same source without any warning" do
bundle :install
expect(out).not_to include("Warning")
expect(err).not_to include("Warning")
expect(the_bundle).to include_gems("depends_on_rack 1.0.1", "rack 1.0.0")
end
end
@ -196,15 +195,14 @@ RSpec.describe "bundle install with gems on multiple sources" do
it "installs from the same source without any warning" do
bundle :install
expect(out).not_to include("Warning: the gem 'rack' was found in multiple sources.")
expect(err).not_to include("Warning: the gem 'rack' was found in multiple sources.")
expect(the_bundle).to include_gems("depends_on_rack 1.0.1", "rack 1.0.0")
# In https://github.com/bundler/bundler/issues/3585 this failed
# when there is already a lock file, and the gems are missing, so try again
system_gems []
bundle :install
expect(out).not_to include("Warning: the gem 'rack' was found in multiple sources.")
expect(err).not_to include("Warning: the gem 'rack' was found in multiple sources.")
expect(the_bundle).to include_gems("depends_on_rack 1.0.1", "rack 1.0.0")
end
@ -222,7 +220,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
context "and not in any other sources" do
before do
gemfile <<-G
install_gemfile <<-G
source "#{file_uri_for(gem_repo2)}"
source "#{file_uri_for(gem_repo3)}" do
gem "depends_on_rack"
@ -231,8 +229,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
end
it "installs from the other source without any warning" do
bundle :install
expect(out).not_to include("Warning")
expect(err).not_to include("Warning")
expect(the_bundle).to include_gems("depends_on_rack 1.0.1", "rack 1.0.0")
end
end
@ -248,7 +245,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
G
end
it "installs from the other source and warns about ambiguous gems", :bundler => "2" do
it "installs from the other source and warns about ambiguous gems", :bundler => "< 3" do
bundle :install
expect(err).to include("Warning: the gem 'rack' was found in multiple sources.")
expect(err).to include("Installed from: #{file_uri_for(gem_repo2)}")
@ -280,7 +277,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
G
end
it "installs the dependency from the pinned source without warning", :bundler => "2" do
it "installs the dependency from the pinned source without warning", :bundler => "< 3" do
bundle :install
expect(err).not_to include("Warning: the gem 'rack' was found in multiple sources.")
@ -381,6 +378,123 @@ RSpec.describe "bundle install with gems on multiple sources" do
end
end
end
context "when the lockfile has aggregated rubygems sources and newer versions of dependencies are available" do
before do
build_repo gem_repo2 do
build_gem "activesupport", "6.0.3.4" do |s|
s.add_dependency "concurrent-ruby", "~> 1.0", ">= 1.0.2"
s.add_dependency "i18n", ">= 0.7", "< 2"
s.add_dependency "minitest", "~> 5.1"
s.add_dependency "tzinfo", "~> 1.1"
s.add_dependency "zeitwerk", "~> 2.2", ">= 2.2.2"
end
build_gem "activesupport", "6.1.2.1" do |s|
s.add_dependency "concurrent-ruby", "~> 1.0", ">= 1.0.2"
s.add_dependency "i18n", ">= 1.6", "< 2"
s.add_dependency "minitest", ">= 5.1"
s.add_dependency "tzinfo", "~> 2.0"
s.add_dependency "zeitwerk", "~> 2.3"
end
build_gem "concurrent-ruby", "1.1.8"
build_gem "concurrent-ruby", "1.1.9"
build_gem "connection_pool", "2.2.3"
build_gem "i18n", "1.8.9" do |s|
s.add_dependency "concurrent-ruby", "~> 1.0"
end
build_gem "minitest", "5.14.3"
build_gem "rack", "2.2.3"
build_gem "redis", "4.2.5"
build_gem "sidekiq", "6.1.3" do |s|
s.add_dependency "connection_pool", ">= 2.2.2"
s.add_dependency "rack", "~> 2.0"
s.add_dependency "redis", ">= 4.2.0"
end
build_gem "thread_safe", "0.3.6"
build_gem "tzinfo", "1.2.9" do |s|
s.add_dependency "thread_safe", "~> 0.1"
end
build_gem "tzinfo", "2.0.4" do |s|
s.add_dependency "concurrent-ruby", "~> 1.0"
end
build_gem "zeitwerk", "2.4.2"
end
build_repo gem_repo3 do
build_gem "sidekiq-pro", "5.2.1" do |s|
s.add_dependency "connection_pool", ">= 2.2.3"
s.add_dependency "sidekiq", ">= 6.1.0"
end
end
gemfile <<-G
# frozen_string_literal: true
source "#{file_uri_for(gem_repo2)}"
gem "activesupport"
source "#{file_uri_for(gem_repo3)}" do
gem "sidekiq-pro"
end
G
lockfile <<~L
GEM
remote: #{file_uri_for(gem_repo2)}/
remote: #{file_uri_for(gem_repo3)}/
specs:
activesupport (6.0.3.4)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
zeitwerk (~> 2.2, >= 2.2.2)
concurrent-ruby (1.1.8)
connection_pool (2.2.3)
i18n (1.8.9)
concurrent-ruby (~> 1.0)
minitest (5.14.3)
rack (2.2.3)
redis (4.2.5)
sidekiq (6.1.3)
connection_pool (>= 2.2.2)
rack (~> 2.0)
redis (>= 4.2.0)
sidekiq-pro (5.2.1)
connection_pool (>= 2.2.3)
sidekiq (>= 6.1.0)
thread_safe (0.3.6)
tzinfo (1.2.9)
thread_safe (~> 0.1)
zeitwerk (2.4.2)
PLATFORMS
#{specific_local_platform}
DEPENDENCIES
activesupport
sidekiq-pro!
BUNDLED WITH
#{Bundler::VERSION}
L
end
it "upgrades gems when running bundle update, without printing any warnings or errors" do
bundle "update --all"
expect(err).to be_empty
end
end
end
context "with a gem that is only found in the wrong source" do
@ -389,14 +503,13 @@ RSpec.describe "bundle install with gems on multiple sources" do
build_gem "not_in_repo1", "1.0.0"
end
gemfile <<-G
install_gemfile <<-G, :raise_on_error => false
source "#{file_uri_for(gem_repo3)}"
gem "not_in_repo1", :source => "#{file_uri_for(gem_repo1)}"
G
end
it "does not install the gem" do
bundle :install, :raise_on_error => false
expect(err).to include("Could not find gem 'not_in_repo1'")
end
end
@ -457,14 +570,13 @@ RSpec.describe "bundle install with gems on multiple sources" do
before do
system_gems "rack-0.9.1"
gemfile <<-G
install_gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
gem "rack" # shoud come from repo1!
G
end
it "installs the gems without any warning" do
bundle :install
expect(err).not_to include("Warning")
expect(the_bundle).to include_gems("rack 1.0.0")
end
@ -615,7 +727,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
G
end
it "keeps the old version", :bundler => "2" do
it "keeps the old version", :bundler => "< 3" do
expect(the_bundle).to include_gems("rack 1.0.0")
end

View file

@ -160,10 +160,6 @@ RSpec.describe "bundle install with install-time dependencies" do
describe "when a required ruby version" do
context "allows only an older version" do
before do
skip "gem not found" if Gem.win_platform?
end
it "installs the older version" do
build_repo2 do
build_gem "rack", "1.2" do |s|

View file

@ -28,8 +28,6 @@ RSpec.describe "bundle install" do
end
it "should use gemspecs in the system cache when available" do
skip "weird incompatible marshal file format error" if Gem.win_platform?
gemfile <<-G
source "http://localtestserver.gem"
gem 'rack'

View file

@ -17,7 +17,7 @@ RSpec.describe "major deprecations" do
bundle "exec ruby -e #{source.dump}"
end
it "is deprecated in favor of .unbundled_env", :bundler => "2" do
it "is deprecated in favor of .unbundled_env", :bundler => "< 3" do
expect(deprecations).to include \
"`Bundler.clean_env` has been deprecated in favor of `Bundler.unbundled_env`. " \
"If you instead want the environment before bundler was originally loaded, use `Bundler.original_env` " \
@ -33,7 +33,7 @@ RSpec.describe "major deprecations" do
bundle "exec ruby -e #{source.dump}"
end
it "is deprecated in favor of .unbundled_env", :bundler => "2" do
it "is deprecated in favor of .unbundled_env", :bundler => "< 3" do
expect(deprecations).to include(
"`Bundler.with_clean_env` has been deprecated in favor of `Bundler.with_unbundled_env`. " \
"If you instead want the environment before bundler was originally loaded, use `Bundler.with_original_env` " \
@ -50,7 +50,7 @@ RSpec.describe "major deprecations" do
bundle "exec ruby -e #{source.dump}"
end
it "is deprecated in favor of .unbundled_system", :bundler => "2" do
it "is deprecated in favor of .unbundled_system", :bundler => "< 3" do
expect(deprecations).to include(
"`Bundler.clean_system` has been deprecated in favor of `Bundler.unbundled_system`. " \
"If you instead want to run the command in the environment before bundler was originally loaded, use `Bundler.original_system` " \
@ -67,7 +67,7 @@ RSpec.describe "major deprecations" do
bundle "exec ruby -e #{source.dump}"
end
it "is deprecated in favor of .unbundled_exec", :bundler => "2" do
it "is deprecated in favor of .unbundled_exec", :bundler => "< 3" do
expect(deprecations).to include(
"`Bundler.clean_exec` has been deprecated in favor of `Bundler.unbundled_exec`. " \
"If you instead want to exec to a command in the environment before bundler was originally loaded, use `Bundler.original_exec` " \
@ -84,7 +84,7 @@ RSpec.describe "major deprecations" do
bundle "exec ruby -e #{source.dump}"
end
it "is deprecated in favor of .load", :bundler => "2" do
it "is deprecated in favor of .load", :bundler => "< 3" do
expect(deprecations).to include "Bundler.environment has been removed in favor of Bundler.load (called at -e:1)"
end
@ -109,7 +109,7 @@ RSpec.describe "major deprecations" do
bundle "check --path vendor/bundle", :raise_on_error => false
end
it "should print a deprecation warning", :bundler => "2" do
it "should print a deprecation warning", :bundler => "< 3" do
expect(deprecations).to include(
"The `--path` flag is deprecated because it relies on being " \
"remembered across bundler invocations, which bundler will no " \
@ -118,7 +118,7 @@ RSpec.describe "major deprecations" do
)
end
pending "should fail with a helpful error", :bundler => "3"
pending "fails with a helpful error", :bundler => "3"
end
context "bundle check --path=" do
@ -131,7 +131,7 @@ RSpec.describe "major deprecations" do
bundle "check --path=vendor/bundle", :raise_on_error => false
end
it "should print a deprecation warning", :bundler => "2" do
it "should print a deprecation warning", :bundler => "< 3" do
expect(deprecations).to include(
"The `--path` flag is deprecated because it relies on being " \
"remembered across bundler invocations, which bundler will no " \
@ -140,7 +140,7 @@ RSpec.describe "major deprecations" do
)
end
pending "should fail with a helpful error", :bundler => "3"
pending "fails with a helpful error", :bundler => "3"
end
context "bundle cache --all" do
@ -153,7 +153,7 @@ RSpec.describe "major deprecations" do
bundle "cache --all", :raise_on_error => false
end
it "should print a deprecation warning", :bundler => "2" do
it "should print a deprecation warning", :bundler => "< 3" do
expect(deprecations).to include(
"The `--all` flag is deprecated because it relies on being " \
"remembered across bundler invocations, which bundler will no " \
@ -162,7 +162,7 @@ RSpec.describe "major deprecations" do
)
end
pending "should fail with a helpful error", :bundler => "3"
pending "fails with a helpful error", :bundler => "3"
end
describe "bundle config" do
@ -292,7 +292,7 @@ RSpec.describe "major deprecations" do
G
end
it "should output a deprecation warning", :bundler => "2" do
it "should output a deprecation warning", :bundler => "< 3" do
expect(deprecations).to include("The --binstubs option will be removed in favor of `bundle binstubs --all`")
end
@ -356,7 +356,7 @@ RSpec.describe "major deprecations" do
bundle "install #{flag_name} #{value}"
end
it "should print a deprecation warning", :bundler => "2" do
it "should print a deprecation warning", :bundler => "< 3" do
expect(deprecations).to include(
"The `#{flag_name}` flag is deprecated because it relies on " \
"being remembered across bundler invocations, which bundler " \
@ -365,7 +365,7 @@ RSpec.describe "major deprecations" do
)
end
pending "should fail with a helpful error", :bundler => "3"
pending "fails with a helpful error", :bundler => "3"
end
end
end
@ -378,7 +378,7 @@ RSpec.describe "major deprecations" do
G
end
it "shows a deprecation", :bundler => "2" do
it "shows a deprecation", :bundler => "< 3" do
expect(deprecations).to include(
"Your Gemfile contains multiple primary sources. " \
"Using `source` more than once without a block is a security risk, and " \
@ -389,7 +389,7 @@ RSpec.describe "major deprecations" do
)
end
pending "should fail with a helpful error", :bundler => "3"
pending "fails with a helpful error", :bundler => "3"
end
context "when Bundler.setup is run in a ruby script" do
@ -422,14 +422,14 @@ RSpec.describe "major deprecations" do
RUBY
end
it "should print a capistrano deprecation warning", :bundler => "2" do
it "should print a capistrano deprecation warning", :bundler => "< 3" do
expect(deprecations).to include("Bundler no longer integrates " \
"with Capistrano, but Capistrano provides " \
"its own integration with Bundler via the " \
"capistrano-bundler gem. Use it instead.")
end
pending "should fail with a helpful error", :bundler => "3"
pending "fails with a helpful error", :bundler => "3"
end
describe Bundler::Dsl do
@ -439,7 +439,7 @@ RSpec.describe "major deprecations" do
end
context "with github gems" do
it "does not warn about removal", :bundler => "2" do
it "does not warn about removal", :bundler => "< 3" do
expect(Bundler.ui).not_to receive(:warn)
subject.gem("sparks", :github => "indirect/sparks")
github_uri = "https://github.com/indirect/sparks.git"
@ -461,7 +461,7 @@ The :github git source is deprecated, and will be removed in the future. Change
end
context "with bitbucket gems" do
it "does not warn about removal", :bundler => "2" do
it "does not warn about removal", :bundler => "< 3" do
expect(Bundler.ui).not_to receive(:warn)
subject.gem("not-really-a-gem", :bitbucket => "mcorp/flatlab-rails")
end
@ -483,7 +483,7 @@ The :bitbucket git source is deprecated, and will be removed in the future. Add
end
context "with gist gems" do
it "does not warn about removal", :bundler => "2" do
it "does not warn about removal", :bundler => "< 3" do
expect(Bundler.ui).not_to receive(:warn)
subject.gem("not-really-a-gem", :gist => "1234")
end
@ -514,7 +514,7 @@ The :gist git source is deprecated, and will be removed in the future. Add this
bundle :show
end
it "prints a deprecation warning recommending `bundle list`", :bundler => "2" do
it "prints a deprecation warning recommending `bundle list`", :bundler => "< 3" do
expect(deprecations).to include("use `bundle list` instead of `bundle show`")
end
@ -526,7 +526,7 @@ The :gist git source is deprecated, and will be removed in the future. Add this
bundle "show --outdated"
end
it "prints a deprecation warning informing about its removal", :bundler => "2" do
it "prints a deprecation warning informing about its removal", :bundler => "< 3" do
expect(deprecations).to include("the `--outdated` flag to `bundle show` was undocumented and will be removed without replacement")
end
@ -538,7 +538,7 @@ The :gist git source is deprecated, and will be removed in the future. Add this
bundle "show --verbose"
end
it "prints a deprecation warning informing about its removal", :bundler => "2" do
it "prints a deprecation warning informing about its removal", :bundler => "< 3" do
expect(deprecations).to include("the `--verbose` flag to `bundle show` was undocumented and will be removed without replacement")
end
@ -550,7 +550,7 @@ The :gist git source is deprecated, and will be removed in the future. Add this
bundle "show rack"
end
it "prints a deprecation warning recommending `bundle info`", :bundler => "2" do
it "prints a deprecation warning recommending `bundle info`", :bundler => "< 3" do
expect(deprecations).to include("use `bundle info rack` instead of `bundle show rack`")
end
@ -562,7 +562,7 @@ The :gist git source is deprecated, and will be removed in the future. Add this
bundle "show --paths"
end
it "prints a deprecation warning recommending `bundle list`", :bundler => "2" do
it "prints a deprecation warning recommending `bundle list`", :bundler => "< 3" do
expect(deprecations).to include("use `bundle list` instead of `bundle show --paths`")
end
@ -574,7 +574,7 @@ The :gist git source is deprecated, and will be removed in the future. Add this
bundle "show rack --paths"
end
it "prints deprecation warning recommending `bundle info`", :bundler => "2" do
it "prints deprecation warning recommending `bundle info`", :bundler => "< 3" do
expect(deprecations).to include("use `bundle info rack --path` instead of `bundle show rack --paths`")
end
@ -587,7 +587,7 @@ The :gist git source is deprecated, and will be removed in the future. Add this
bundle "console", :raise_on_error => false
end
it "prints a deprecation warning", :bundler => "2" do
it "prints a deprecation warning", :bundler => "< 3" do
expect(deprecations).to include \
"bundle console will be replaced by `bin/console` generated by `bundle gem <name>`"
end
@ -603,7 +603,7 @@ The :gist git source is deprecated, and will be removed in the future. Add this
bundle "viz"
end
it "prints a deprecation warning", :bundler => "2" do
it "prints a deprecation warning", :bundler => "< 3" do
expect(deprecations).to include "The `viz` command has been moved to the `bundle-viz` gem, see https://github.com/bundler/bundler-viz"
end

View file

@ -46,8 +46,6 @@ RSpec.describe "bundler/inline#gemfile" do
end
it "requires the gems" do
skip "gems not found" if Gem.win_platform?
script <<-RUBY
gemfile do
path "#{lib_path}" do
@ -94,8 +92,6 @@ RSpec.describe "bundler/inline#gemfile" do
end
it "lets me use my own ui object" do
skip "prints just one CONFIRMED" if Gem.win_platform?
script <<-RUBY, :artifice => "endpoint"
require '#{lib_dir}/bundler'
class MyBundlerUI < Bundler::UI::Silent

View file

@ -145,23 +145,34 @@ module Spec
match_when_negated do
opts = names.last.is_a?(Hash) ? names.pop : {}
groups = Array(opts[:groups]) || []
groups = Array(opts.delete(:groups)).map(&:inspect).join(", ")
opts[:raise_on_error] = false
@errors = names.map do |name|
name, version = name.split(/\s+/, 2)
run <<-R, *(groups + [opts])
ruby <<-R, opts
begin
require '#{lib_dir}/bundler'
Bundler.setup(#{groups})
rescue Bundler::GemNotFound, Bundler::GitError
exit 0
end
begin
require '#{name}'
puts #{Spec::Builders.constantize(name)}
name_constant = '#{Spec::Builders.constantize(name)}'
if #{version.nil?} || name_constant == '#{version}'
exit 64
else
exit 0
end
rescue LoadError, NameError
puts "WIN"
exit 0
end
R
next if out == "WIN"
next if exitstatus == 0
next "command to check version of #{name} installed failed" unless exitstatus == 64
next "expected #{name} to not be installed, but it was" if version.nil?
if Gem::Version.new(out) == Gem::Version.new(version)
next "expected #{name} (#{version}) not to be installed, but it was"
end
next "expected #{name} (#{version}) not to be installed, but it was"
end.compact
@errors.empty?