summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/bundler.rb1
-rw-r--r--lib/bundler/cli.rb83
-rw-r--r--lib/bundler/feature_flag.rb1
-rw-r--r--lib/bundler/settings.rb1
-rw-r--r--lib/bundler/worker.rb2
-rw-r--r--man/bundle-config.ronn2
-rw-r--r--spec/commands/list_spec.rb2
-rw-r--r--spec/commands/show_spec.rb2
-rw-r--r--spec/lock/lockfile_bundler_1_spec.rb1388
-rw-r--r--spec/lock/lockfile_spec.rb182
-rw-r--r--spec/other/major_deprecation_spec.rb56
-rw-r--r--spec/realworld/dependency_api_spec.rb2
-rw-r--r--spec/realworld/gemfile_source_header_spec.rb2
-rw-r--r--spec/realworld/mirror_probe_spec.rb2
-rw-r--r--spec/support/platforms.rb5
15 files changed, 268 insertions, 1463 deletions
diff --git a/lib/bundler.rb b/lib/bundler.rb
index d500a57861..f792a3bc98 100644
--- a/lib/bundler.rb
+++ b/lib/bundler.rb
@@ -5,7 +5,6 @@ require "bundler/compatibility_guard"
require "bundler/vendored_fileutils"
require "pathname"
require "rbconfig"
-require "thread"
require "bundler/errors"
require "bundler/environment_preserver"
diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb
index 3dc90c04dc..4e3735847e 100644
--- a/lib/bundler/cli.rb
+++ b/lib/bundler/cli.rb
@@ -282,52 +282,53 @@ module Bundler
end
end
- desc "show GEM [OPTIONS]", "Shows all gems that are part of the bundle, or the path to a given gem"
- long_desc <<-D
- Show lists the names and versions of all gems that are required by your Gemfile.
- Calling show with [GEM] will list the exact location of that gem on your machine.
- D
- method_option "paths", :type => :boolean,
- :banner => "List the paths of all gems that are required by your Gemfile."
- method_option "outdated", :type => :boolean,
- :banner => "Show verbose output including whether gems are outdated."
- def show(gem_name = nil)
- if ARGV[0] == "show"
- rest = ARGV[1..-1]
-
- new_command = rest.find {|arg| !arg.start_with?("--") } ? "info" : "list"
-
- new_arguments = rest.map do |arg|
- next arg if arg != "--paths"
- next "--path" if new_command == "info"
+ unless Bundler.feature_flag.bundler_3_mode?
+ desc "show GEM [OPTIONS]", "Shows all gems that are part of the bundle, or the path to a given gem"
+ long_desc <<-D
+ Show lists the names and versions of all gems that are required by your Gemfile.
+ Calling show with [GEM] will list the exact location of that gem on your machine.
+ D
+ method_option "paths", :type => :boolean,
+ :banner => "List the paths of all gems that are required by your Gemfile."
+ method_option "outdated", :type => :boolean,
+ :banner => "Show verbose output including whether gems are outdated."
+ def show(gem_name = nil)
+ if ARGV[0] == "show"
+ rest = ARGV[1..-1]
+
+ if flag = rest.find{|arg| ["--verbose", "--outdated"].include?(arg) }
+ Bundler::SharedHelpers.major_deprecation(2, "the `#{flag}` flag to `bundle show` was undocumented and will be removed without replacement")
+ else
+ new_command = rest.find {|arg| !arg.start_with?("--") } ? "info" : "list"
+
+ new_arguments = rest.map do |arg|
+ next arg if arg != "--paths"
+ next "--path" if new_command == "info"
+ end
+
+ old_argv = ARGV.join(" ")
+ new_argv = [new_command, *new_arguments.compact].join(" ")
+
+ Bundler::SharedHelpers.major_deprecation(2, "use `bundle #{new_argv}` instead of `bundle #{old_argv}`")
+ end
end
-
- old_argv = ARGV.join(" ")
- new_argv = [new_command, *new_arguments.compact].join(" ")
-
- Bundler::SharedHelpers.major_deprecation(2, "use `bundle #{new_argv}` instead of `bundle #{old_argv}`")
- end
- require "bundler/cli/show"
- Show.new(options, gem_name).run
- end
- # TODO: 2.0 remove `bundle show`
-
- if Bundler.feature_flag.list_command?
- desc "list", "List all gems in the bundle"
- method_option "name-only", :type => :boolean, :banner => "print only the gem names"
- method_option "only-group", :type => :string, :banner => "print gems from a particular group"
- method_option "without-group", :type => :string, :banner => "print all gems expect from a group"
- method_option "paths", :type => :boolean, :banner => "print the path to each gem in the bundle"
- def list
- require "bundler/cli/list"
- List.new(options).run
+ require "bundler/cli/show"
+ Show.new(options, gem_name).run
end
+ end
- map %w[ls] => "list"
- else
- map %w[list] => "show"
+ desc "list", "List all gems in the bundle"
+ method_option "name-only", :type => :boolean, :banner => "print only the gem names"
+ method_option "only-group", :type => :string, :banner => "print gems from a particular group"
+ method_option "without-group", :type => :string, :banner => "print all gems except from a group"
+ method_option "paths", :type => :boolean, :banner => "print the path to each gem in the bundle"
+ def list
+ require "bundler/cli/list"
+ List.new(options).run
end
+ map %w[ls] => "list"
+
desc "info GEM [OPTIONS]", "Show information for the given gem"
method_option "path", :type => :boolean, :banner => "Print full path to gem"
def info(gem_name)
diff --git a/lib/bundler/feature_flag.rb b/lib/bundler/feature_flag.rb
index 6347e46900..04d8272195 100644
--- a/lib/bundler/feature_flag.rb
+++ b/lib/bundler/feature_flag.rb
@@ -41,7 +41,6 @@ module Bundler
settings_flag(:global_path_appends_ruby_scope) { bundler_2_mode? }
settings_flag(:global_gem_cache) { bundler_2_mode? }
settings_flag(:init_gems_rb) { bundler_2_mode? }
- settings_flag(:list_command) { bundler_2_mode? }
settings_flag(:lockfile_uses_separate_rubygems_sources) { bundler_2_mode? }
settings_flag(:only_update_to_newer_versions) { bundler_2_mode? }
settings_flag(:path_relative_to_cwd) { bundler_2_mode? }
diff --git a/lib/bundler/settings.rb b/lib/bundler/settings.rb
index a1c0825d39..bf709f712b 100644
--- a/lib/bundler/settings.rb
+++ b/lib/bundler/settings.rb
@@ -39,7 +39,6 @@ module Bundler
global_gem_cache
ignore_messages
init_gems_rb
- list_command
lockfile_uses_separate_rubygems_sources
no_install
no_prune
diff --git a/lib/bundler/worker.rb b/lib/bundler/worker.rb
index 1c7c1ccf6c..3471654b43 100644
--- a/lib/bundler/worker.rb
+++ b/lib/bundler/worker.rb
@@ -1,7 +1,5 @@
# frozen_string_literal: true
-require "thread"
-
module Bundler
class Worker
POISON = Object.new
diff --git a/man/bundle-config.ronn b/man/bundle-config.ronn
index 9dc2edbf2a..4e717b4b69 100644
--- a/man/bundle-config.ronn
+++ b/man/bundle-config.ronn
@@ -214,8 +214,6 @@ learn more about their operation in [bundle install(1)](bundle-install.1.html).
Generate a `gems.rb` instead of a `Gemfile` when running `bundle init`.
* `jobs` (`BUNDLE_JOBS`):
The number of gems Bundler can install in parallel. Defaults to 1.
-* `list_command` (`BUNDLE_LIST_COMMAND`)
- Enable new list command feature
* `no_install` (`BUNDLE_NO_INSTALL`):
Whether `bundle package` should skip installing gems.
* `no_prune` (`BUNDLE_NO_PRUNE`):
diff --git a/spec/commands/list_spec.rb b/spec/commands/list_spec.rb
index fcce34cc72..613249cc59 100644
--- a/spec/commands/list_spec.rb
+++ b/spec/commands/list_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-RSpec.describe "bundle list", :bundler => "2" do
+RSpec.describe "bundle list", :bundler => ">= 2" do
before do
install_gemfile <<-G
source "file://#{gem_repo1}"
diff --git a/spec/commands/show_spec.rb b/spec/commands/show_spec.rb
index d79ac2704f..6634a3f7ed 100644
--- a/spec/commands/show_spec.rb
+++ b/spec/commands/show_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-RSpec.describe "bundle show" do
+RSpec.describe "bundle show", :bundler => "< 3" do
context "with a standard Gemfile" do
before :each do
install_gemfile <<-G
diff --git a/spec/lock/lockfile_bundler_1_spec.rb b/spec/lock/lockfile_bundler_1_spec.rb
deleted file mode 100644
index d44b076cb7..0000000000
--- a/spec/lock/lockfile_bundler_1_spec.rb
+++ /dev/null
@@ -1,1388 +0,0 @@
-# frozen_string_literal: true
-
-RSpec.describe "the lockfile format", :bundler => "< 2" do
- include Bundler::GemHelpers
-
- before { ENV["BUNDLER_SPEC_IGNORE_COMPATIBILITY_GUARD"] = "TRUE" }
-
- it "generates a simple lockfile for a single source, gem" do
- install_gemfile <<-G
- source "file://localhost#{gem_repo1}"
-
- gem "rack"
- G
-
- lockfile_should_be <<-G
- GEM
- remote: file://localhost#{gem_repo1}/
- specs:
- rack (1.0.0)
-
- PLATFORMS
- #{generic_local_platform}
-
- DEPENDENCIES
- rack
-
- BUNDLED WITH
- #{Bundler::VERSION}
- G
- end
-
- it "updates the lockfile's bundler version if current ver. is newer" do
- lockfile <<-L
- GIT
- remote: git://github.com/nex3/haml.git
- revision: 8a2271f
- specs:
-
- GEM
- remote: file://localhost#{gem_repo1}/
- specs:
- rack (1.0.0)
-
- PLATFORMS
- #{generic_local_platform}
-
- DEPENDENCIES
- omg!
- rack
-
- BUNDLED WITH
- 1.8.2
- L
-
- install_gemfile <<-G
- source "file://localhost#{gem_repo1}"
-
- gem "rack"
- G
-
- lockfile_should_be <<-G
- GEM
- remote: file://localhost#{gem_repo1}/
- specs:
- rack (1.0.0)
-
- PLATFORMS
- #{generic_local_platform}
-
- DEPENDENCIES
- rack
-
- BUNDLED WITH
- #{Bundler::VERSION}
- G
- end
-
- it "does not update the lockfile's bundler version if nothing changed during bundle install", :ruby_repo do
- version = "#{Bundler::VERSION.split(".").first}.0.0.0.a"
-
- lockfile normalize_uri_file(<<-L)
- GEM
- remote: file://localhost#{gem_repo1}/
- specs:
- rack (1.0.0)
-
- PLATFORMS
- #{generic_local_platform}
-
- DEPENDENCIES
- rack
-
- BUNDLED WITH
- #{version}
- L
-
- install_gemfile normalize_uri_file(<<-G)
- source "file://localhost#{gem_repo1}"
-
- gem "rack"
- G
-
- lockfile_should_be normalize_uri_file(<<-G)
- GEM
- remote: file://localhost#{gem_repo1}/
- specs:
- rack (1.0.0)
-
- PLATFORMS
- #{generic_local_platform}
-
- DEPENDENCIES
- rack
-
- BUNDLED WITH
- #{version}
- G
- end
-
- it "updates the lockfile's bundler version if not present" do
- lockfile <<-L
- GEM
- remote: file://localhost#{gem_repo1}/
- specs:
- rack (1.0.0)
-
- PLATFORMS
- #{generic_local_platform}
-
- DEPENDENCIES
- rack
- L
-
- install_gemfile <<-G
- source "file://localhost#{gem_repo1}"
-
- gem "rack", "> 0"
- G
-
- lockfile_should_be <<-G
- GEM
- remote: file://localhost#{gem_repo1}/
- specs:
- rack (1.0.0)
-
- PLATFORMS
- #{generic_local_platform}
-
- DEPENDENCIES
- rack (> 0)
-
- BUNDLED WITH
- #{Bundler::VERSION}
- G
- end
-
- it "outputs a warning if the current is older than lockfile's bundler version" do
- lockfile <<-L
- GEM
- remote: file://localhost#{gem_repo1}/
- specs:
- rack (1.0.0)
-
- PLATFORMS
- #{generic_local_platform}
-
- DEPENDENCIES
- rack
-
- BUNDLED WITH
- 9999999.1.0
- L
-
- simulate_bundler_version "9999999.0.0" do
- install_gemfile <<-G
- source "file://localhost#{gem_repo1}"
-
- gem "rack"
- G
- end
-
- warning_message = "the running version of Bundler (9999999.0.0) is older " \
- "than the version that created the lockfile (9999999.1.0). " \
- "We suggest you to upgrade to the version that created the " \
- "lockfile by running `gem install bundler:9999999.1.0`."
- expect(last_command.stderr.scan(warning_message).size).to eq(1)
-
- lockfile_should_be <<-G
- GEM
- remote: file://localhost#{gem_repo1}/
- specs:
- rack (1.0.0)
-
- PLATFORMS
- #{generic_local_platform}
- #{specific_local_platform}
-
- DEPENDENCIES
- rack
-
- BUNDLED WITH
- 9999999.1.0
- G
- end
-
- it "errors if the current is a major version older than lockfile's bundler version" do
- lockfile <<-L
- GEM
- remote: file://localhost#{gem_repo1}/
- specs:
- rack (1.0.0)
-
- PLATFORMS
- #{generic_local_platform}
-
- DEPENDENCIES
- rack
-
- BUNDLED WITH
- 9999999.0.0
- L
-
- install_gemfile <<-G
- source "file://localhost#{gem_repo1}"
-
- gem "rack"
- G
-
- expect(exitstatus > 0) if exitstatus
- expect(out).to include("You must use Bundler 9999999 or greater with this lockfile.")
- end
-
- it "shows a friendly error when running with a new bundler 2 lockfile" do
- lockfile <<-L
- GEM
- remote: https://rails-assets.org/
- specs:
- rails-assets-bootstrap (3.3.4)
- rails-assets-jquery (>= 1.9.1)
- rails-assets-jquery (2.1.4)
-
- GEM
- remote: https://rubygems.org/
- specs:
- rake (10.4.2)
-
- PLATFORMS
- ruby
-
- DEPENDENCIES
- rails-assets-bootstrap!
- rake
-
- BUNDLED WITH
- 9999999.0.0
- L
-
- install_gemfile <<-G
- source 'https://rubygems.org'
- gem 'rake'
-
- source 'https://rails-assets.org' do
- gem 'rails-assets-bootstrap'
- end
- G
-
- expect(exitstatus > 0) if exitstatus
- expect(err).to include("You must use Bundler 9999999 or greater with this lockfile.")
- end
-
- it "warns when updating bundler major version" do
- lockfile <<-L
- GEM
- remote: file://localhost#{gem_repo1}/
- specs:
- rack (1.0.0)
-
- PLATFORMS
- #{generic_local_platform}
-
- DEPENDENCIES
- rack
-
- BUNDLED WITH
- 1.10.0
- L
-
- simulate_bundler_version "9999999.0.0" do
- install_gemfile <<-G
- source "file://localhost#{gem_repo1}"
-
- gem "rack"
- G
- end
-
- expect(last_command.stderr).to include("Warning: the lockfile is being updated to Bundler " \
- "9999999, after which you will be unable to return to Bundler 1.")
-
- lockfile_should_be <<-G
- GEM
- remote: file://localhost#{gem_repo1}/
- specs:
- rack (1.0.0)
-
- PLATFORMS
- #{generic_local_platform}
- #{specific_local_platform}
-
- DEPENDENCIES
- rack
-
- BUNDLED WITH
- 9999999.0.0
- G
- end
-
- it "generates a simple lockfile for a single source, gem with dependencies" do
- install_gemfile <<-G
- source "file://localhost#{gem_repo1}"
-
- gem "rack-obama"
- G
-
- lockfile_should_be <<-G
- GEM
- remote: file://localhost#{gem_repo1}/
- specs:
- rack (1.0.0)
- rack-obama (1.0)
- rack
-
- PLATFORMS
- #{generic_local_platform}
-
- DEPENDENCIES
- rack-obama
-
- BUNDLED WITH
- #{Bundler::VERSION}
- G
- end
-
- it "generates a simple lockfile for a single source, gem with a version requirement" do
- install_gemfile <<-G
- source "file://localhost#{gem_repo1}"
-
- gem "rack-obama", ">= 1.0"
- G
-
- lockfile_should_be <<-G
- GEM
- remote: file://localhost#{gem_repo1}/
- specs:
- rack (1.0.0)
- rack-obama (1.0)
- rack
-
- PLATFORMS
- #{generic_local_platform}
-
- DEPENDENCIES
- rack-obama (>= 1.0)
-
- BUNDLED WITH
- #{Bundler::VERSION}
- G
- end
-
- it "generates a lockfile wihout credentials for a configured source" do
- bundle "config set http://localgemserver.test/ user:pass"
-
- install_gemfile(<<-G, :artifice => "endpoint_strict_basic_authentication", :quiet => true)
- source "http://localgemserver.test/"
- source "http://user:pass@othergemserver.test/"
-
- gem "rack-obama", ">= 1.0"
- G
-
- lockfile_should_be <<-G
- GEM
- remote: http://localgemserver.test/
- remote: http://user:pass@othergemserver.test/
- specs:
- rack (1.0.0)
- rack-obama (1.0)
- rack
-
- PLATFORMS
- #{generic_local_platform}
-
- DEPENDENCIES
- rack-obama (>= 1.0)
-
- BUNDLED WITH
- #{Bundler::VERSION}
- G
- end
-
- it "generates lockfiles with multiple requirements" do
- install_gemfile <<-G
- source "file://localhost#{gem_repo1}"
- gem "net-sftp"
- G
-
- lockfile_should_be <<-G
- GEM
- remote: file://localhost#{gem_repo1}/
- specs:
- net-sftp (1.1.1)
- net-ssh (>= 1.0.0, < 1.99.0)
- net-ssh (1.0)
-
- PLATFORMS
- ruby
-
- DEPENDENCIES
- net-sftp
-
- BUNDLED WITH
- #{Bundler::VERSION}
- G
-
- expect(the_bundle).to include_gems "net-sftp 1.1.1", "net-ssh 1.0.0"
- end
-
- it "generates a simple lockfile for a single pinned source, gem with a version requirement" do
- git = build_git "foo"
-
- install_gemfile <<-G
- gem "foo", :git => "#{lib_path("foo-1.0")}"
- G
-
- lockfile_should_be <<-G
- GIT
- remote: #{lib_path("foo-1.0")}
- revision: #{git.ref_for("master")}
- specs:
- foo (1.0)
-
- GEM
- specs:
-
- PLATFORMS
- #{generic_local_platform}
-
- DEPENDENCIES
- foo!
-
- BUNDLED WITH
- #{Bundler::VERSION}
- G
- end
-
- it "does not asplode when a platform specific dependency is present and the Gemfile has not been resolved on that platform" do
- build_lib "omg", :path => lib_path("omg")
-
- gemfile <<-G
- source "file://localhost#{gem_repo1}"
-
- platforms :#{not_local_tag} do
- gem "omg", :path => "#{lib_path("omg")}"
- end
-
- gem "rack"
- G
-
- lockfile <<-L
- GIT
- remote: git://github.com/nex3/haml.git
- revision: 8a2271f
- specs:
-
- GEM
- remote: file://localhost#{gem_repo1}/
- specs:
- rack (1.0.0)
-
- PLATFORMS
- #{not_local}
-
- DEPENDENCIES
- omg!
- rack
-
- BUNDLED WITH
- #{Bundler::VERSION}
- L
-
- bundle "install"
- expect(the_bundle).to include_gems "rack 1.0.0"
- end
-
- it "serializes global git sources" do
- git = build_git "foo"
-
- install_gemfile <<-G
- git "#{lib_path("foo-1.0")}" do
- gem "foo"
- end
- G
-
- lockfile_should_be <<-G
- GIT
- remote: #{lib_path("foo-1.0")}
- revision: #{git.ref_for("master")}
- specs:
- foo (1.0)
-
- GEM
- specs:
-
- PLATFORMS
- #{generic_local_platform}
-
- DEPENDENCIES
- foo!
-
- BUNDLED WITH
- #{Bundler::VERSION}
- G
- end
-
- it "generates a lockfile with a ref for a single pinned source, git gem with a branch requirement" do
- git = build_git "foo"
- update_git "foo", :branch => "omg"
-
- install_gemfile <<-G
- gem "foo", :git => "#{lib_path("foo-1.0")}", :branch => "omg"
- G
-
- lockfile_should_be <<-G
- GIT
- remote: #{lib_path("foo-1.0")}
- revision: #{git.ref_for("omg")}
- branch: omg
- specs:
- foo (1.0)
-
- GEM
- specs:
-
- PLATFORMS
- #{generic_local_platform}
-
- DEPENDENCIES
- foo!
-
- BUNDLED WITH
- #{Bundler::VERSION}
- G
- end
-
- it "generates a lockfile with a ref for a single pinned source, git gem with a tag requirement" do
- git = build_git "foo"
- update_git "foo", :tag => "omg"
-
- install_gemfile <<-G
- gem "foo", :git => "#{lib_path("foo-1.0")}", :tag => "omg"
- G
-
- lockfile_should_be <<-G
- GIT
- remote: #{lib_path("foo-1.0")}
- revision: #{git.ref_for("omg")}
- tag: omg
- specs:
- foo (1.0)
-
- GEM
- specs:
-
- PLATFORMS
- #{generic_local_platform}
-
- DEPENDENCIES
- foo!
-
- BUNDLED WITH
- #{Bundler::VERSION}
- G
- end
-
- it "serializes pinned path sources to the lockfile" do
- build_lib "foo"
-
- install_gemfile <<-G
- gem "foo", :path => "#{lib_path("foo-1.0")}"
- G
-
- lockfile_should_be <<-G
- PATH
- remote: #{lib_path("foo-1.0")}
- specs:
- foo (1.0)
-
- GEM
- specs:
-
- PLATFORMS
- #{generic_local_platform}
-
- DEPENDENCIES
- foo!
-
- BUNDLED WITH
- #{Bundler::VERSION}
- G
- end
-
- it "serializes pinned path sources to the lockfile even when packaging" do
- build_lib "foo"
-
- install_gemfile! <<-G
- gem "foo", :path => "#{lib_path("foo-1.0")}"
- G
-
- bundle! :package, forgotten_command_line_options([:all, :cache_all] => true)
- bundle! :install, :local => true
-
- lockfile_should_be <<-G
- PATH
- remote: #{lib_path("foo-1.0")}
- specs:
- foo (1.0)
-
- GEM
- specs:
-
- PLATFORMS
- #{generic_local_platform}
-
- DEPENDENCIES
- foo!
-
- BUNDLED WITH
- #{Bundler::VERSION}
- G
- end
-
- it "sorts serialized sources by type" do
- build_lib "foo"
- bar = build_git "bar"
-
- install_gemfile <<-G
- source "file://localhost#{gem_repo1}"
-
- gem "rack"
- gem "foo", :path => "#{lib_path("foo-1.0")}"
- gem "bar", :git => "#{lib_path("bar-1.0")}"
- G
-
- lockfile_should_be <<-G
- GIT
- remote: #{lib_path("bar-1.0")}
- revision: #{bar.ref_for("master")}
- specs:
- bar (1.0)
-
- PATH
- remote: #{lib_path("foo-1.0")}
- specs:
- foo (1.0)
-
- GEM
- remote: file://localhost#{gem_repo1}/
- specs:
- rack (1.0.0)
-
- PLATFORMS
- #{generic_local_platform}
-
- DEPENDENCIES
- bar!
- foo!
- rack
-
- BUNDLED WITH
- #{Bundler::VERSION}
- G
- end
-
- it "lists gems alphabetically" do
- install_gemfile <<-G
- source "file://localhost#{gem_repo1}"
-
- gem "thin"
- gem "actionpack"
- gem "rack-obama"
- G
-
- lockfile_should_be <<-G
- GEM
- remote: file://localhost#{gem_repo1}/
- specs:
- actionpack (2.3.2)
- activesupport (= 2.3.2)
- activesupport (2.3.2)
- rack (1.0.0)
- rack-obama (1.0)
- rack
- thin (1.0)
- rack
-
- PLATFORMS
- #{generic_local_platform}
-
- DEPENDENCIES
- actionpack
- rack-obama
- thin
-
- BUNDLED WITH
- #{Bundler::VERSION}
- G
- end
-
- it "orders dependencies' dependencies in alphabetical order" do
- install_gemfile <<-G
- source "file://localhost#{gem_repo1}"
-
- gem "rails"
- G
-
- lockfile_should_be <<-G
- GEM
- remote: file://localhost#{gem_repo1}/
- specs:
- actionmailer (2.3.2)
- activesupport (= 2.3.2)
- actionpack (2.3.2)
- activesupport (= 2.3.2)
- activerecord (2.3.2)
- activesupport (= 2.3.2)
- activeresource (2.3.2)
- activesupport (= 2.3.2)
- activesupport (2.3.2)
- rails (2.3.2)
- actionmailer (= 2.3.2)
- actionpack (= 2.3.2)
- activerecord (= 2.3.2)
- activeresource (= 2.3.2)
- rake (= 12.3.2)
- rake (12.3.2)
-
- PLATFORMS
- #{generic_local_platform}
-
- DEPENDENCIES
- rails
-
- BUNDLED WITH
- #{Bundler::VERSION}
- G
- end
-
- it "orders dependencies by version" do
- install_gemfile <<-G
- source "file://localhost#{gem_repo1}"
- gem 'double_deps'
- G
-
- lockfile_should_be <<-G
- GEM
- remote: file://localhost#{gem_repo1}/
- specs:
- double_deps (1.0)
- net-ssh
- net-ssh (>= 1.0.0)
- net-ssh (1.0)
-
- PLATFORMS
- #{generic_local_platform}
-
- DEPENDENCIES
- double_deps
-
- BUNDLED WITH
- #{Bundler::VERSION}
- G
- end
-
- it "does not add the :require option to the lockfile" do
- install_gemfile <<-G
- source "file://localhost#{gem_repo1}"
-
- gem "rack-obama", ">= 1.0", :require => "rack/obama"
- G
-
- lockfile_should_be <<-G
- GEM
- remote: file://localhost#{gem_repo1}/
- specs:
- rack (1.0.0)
- rack-obama (1.0)
- rack
-
- PLATFORMS
- #{generic_local_platform}
-
- DEPENDENCIES
- rack-obama (>= 1.0)
-
- BUNDLED WITH
- #{Bundler::VERSION}
- G
- end
-
- it "does not add the :group option to the lockfile" do
- install_gemfile <<-G
- source "file://localhost#{gem_repo1}"
-
- gem "rack-obama", ">= 1.0", :group => :test
- G
-
- lockfile_should_be <<-G
- GEM
- remote: file://localhost#{gem_repo1}/
- specs:
- rack (1.0.0)
- rack-obama (1.0)
- rack
-
- PLATFORMS
- #{generic_local_platform}
-
- DEPENDENCIES
- rack-obama (>= 1.0)
-
- BUNDLED WITH
- #{Bundler::VERSION}
- G
- end
-
- it "stores relative paths when the path is provided in a relative fashion and in Gemfile dir" do
- build_lib "foo", :path => bundled_app("foo")
-
- install_gemfile <<-G
- path "foo"
- gem "foo"
- G
-
- lockfile_should_be <<-G
- PATH
- remote: foo
- specs:
- foo (1.0)
-
- GEM
- specs:
-
- PLATFORMS
- #{generic_local_platform}
-
- DEPENDENCIES
- foo
-
- BUNDLED WITH
- #{Bundler::VERSION}
- G
- end
-
- it "stores relative paths when the path is provided in a relative fashion and is above Gemfile dir" do
- build_lib "foo", :path => bundled_app(File.join("..", "foo"))
-
- install_gemfile <<-G
- path "../foo"
- gem "foo"
- G
-
- lockfile_should_be <<-G
- PATH
- remote: ../foo
- specs:
- foo (1.0)
-
- GEM
- specs:
-
- PLATFORMS
- #{generic_local_platform}
-
- DEPENDENCIES
- foo
-
- BUNDLED WITH
- #{Bundler::VERSION}
- G
- end
-
- it "stores relative paths when the path is provided in an absolute fashion but is relative" do
- build_lib "foo", :path => bundled_app("foo")
-
- install_gemfile <<-G
- path File.expand_path("../foo", __FILE__)
- gem "foo"
- G
-
- lockfile_should_be <<-G
- PATH
- remote: foo
- specs:
- foo (1.0)
-
- GEM
- specs:
-
- PLATFORMS
- #{generic_local_platform}
-
- DEPENDENCIES
- foo
-
- BUNDLED WITH
- #{Bundler::VERSION}
- G
- end
-
- it "stores relative paths when the path is provided for gemspec" do
- build_lib("foo", :path => tmp.join("foo"))
-
- install_gemfile <<-G
- gemspec :path => "../foo"
- G
-
- lockfile_should_be <<-G
- PATH
- remote: ../foo
- specs:
- foo (1.0)
-
- GEM
- specs:
-
- PLATFORMS
- #{generic_local_platform}
-
- DEPENDENCIES
- foo!
-
- BUNDLED WITH
- #{Bundler::VERSION}
- G
- end
-
- it "keeps existing platforms in the lockfile" do
- lockfile <<-G
- GEM
- remote: file://localhost#{gem_repo1}/
- specs:
- rack (1.0.0)
-
- PLATFORMS
- java
-
- DEPENDENCIES
- rack
-
- BUNDLED WITH
- #{Bundler::VERSION}
- G
-
- install_gemfile <<-G
- source "file://localhost#{gem_repo1}"
-
- gem "rack"
- G
-
- platforms = ["java", generic_local_platform.to_s].sort
-
- lockfile_should_be <<-G
- GEM
- remote: file://localhost#{gem_repo1}/
- specs:
- rack (1.0.0)
-
- PLATFORMS
- #{platforms[0]}
- #{platforms[1]}
-
- DEPENDENCIES
- rack
-
- BUNDLED WITH
- #{Bundler::VERSION}
- G
- end
-
- it "persists the spec's platform to the lockfile" do
- build_gem "platform_specific", "1.0.0", :to_system => true do |s|
- s.platform = Gem::Platform.new("universal-java-16")
- end
-
- simulate_platform "universal-java-16"
-
- install_gemfile <<-G
- source "file://localhost#{gem_repo1}"
- gem "platform_specific"
- G
-
- lockfile_should_be <<-G
- GEM
- remote: file://localhost#{gem_repo1}/
- specs:
- platform_specific (1.0-java)
-
- PLATFORMS
- java
-
- DEPENDENCIES
- platform_specific
-
- BUNDLED WITH
- #{Bundler::VERSION}
- G
- end
-
- it "does not add duplicate gems" do
- install_gemfile <<-G
- source "file://localhost#{gem_repo1}"
- gem "rack"
- G
-
- install_gemfile <<-G
- source "file://localhost#{gem_repo1}"
- gem "rack"
- gem "activesupport"
- G
-
- lockfile_should_be <<-G
- GEM
- remote: file://localhost#{gem_repo1}/
- specs:
- activesupport (2.3.5)
- rack (1.0.0)
-
- PLATFORMS
- ruby
-
- DEPENDENCIES
- activesupport
- rack
-
- BUNDLED WITH
- #{Bundler::VERSION}
- G
- end
-
- it "does not add duplicate dependencies" do
- install_gemfile <<-G
- source "file://localhost#{gem_repo1}"
- gem "rack"
- gem "rack"
- G
-
- lockfile_should_be <<-G
- GEM
- remote: file://localhost#{gem_repo1}/
- specs:
- rack (1.0.0)
-
- PLATFORMS
- ruby
-
- DEPENDENCIES
- rack
-
- BUNDLED WITH
- #{Bundler::VERSION}
- G
- end
-
- it "does not add duplicate dependencies with versions" do
- install_gemfile <<-G
- source "file://localhost#{gem_repo1}"
- gem "rack", "1.0"
- gem "rack", "1.0"
- G
-
- lockfile_should_be <<-G
- GEM
- remote: file://localhost#{gem_repo1}/
- specs:
- rack (1.0.0)
-
- PLATFORMS
- ruby
-
- DEPENDENCIES
- rack (= 1.0)
-
- BUNDLED WITH
- #{Bundler::VERSION}
- G
- end
-
- it "does not add duplicate dependencies in different groups" do
- install_gemfile <<-G
- source "file://localhost#{gem_repo1}"
- gem "rack", "1.0", :group => :one
- gem "rack", "1.0", :group => :two
- G
-
- lockfile_should_be <<-G
- GEM
- remote: file://localhost#{gem_repo1}/
- specs:
- rack (1.0.0)
-
- PLATFORMS
- ruby
-
- DEPENDENCIES
- rack (= 1.0)
-
- BUNDLED WITH
- #{Bundler::VERSION}
- G
- end
-
- it "raises if two different versions are used" do
- install_gemfile <<-G
- source "file://localhost#{gem_repo1}"
- gem "rack", "1.0"
- gem "rack", "1.1"
- G
-
- expect(bundled_app("Gemfile.lock")).not_to exist
- expect(err).to include "rack (= 1.0) and rack (= 1.1)"
- end
-
- it "raises if two different sources are used" do
- install_gemfile <<-G
- source "file://localhost#{gem_repo1}"
- gem "rack"
- gem "rack", :git => "git://hubz.com"
- G
-
- expect(bundled_app("Gemfile.lock")).not_to exist
- expect(err).to include "rack (>= 0) should come from an unspecified source and git://hubz.com (at master)"
- end
-
- it "works correctly with multiple version dependencies" do
- install_gemfile <<-G
- source "file://localhost#{gem_repo1}"
- gem "rack", "> 0.9", "< 1.0"
- G
-
- lockfile_should_be <<-G
- GEM
- remote: file://localhost#{gem_repo1}/
- specs:
- rack (0.9.1)
-
- PLATFORMS
- ruby
-
- DEPENDENCIES
- rack (> 0.9, < 1.0)
-
- BUNDLED WITH
- #{Bundler::VERSION}
- G
- end
-
- it "captures the Ruby version in the lockfile" do
- install_gemfile <<-G
- source "file://localhost#{gem_repo1}"
- ruby '#{RUBY_VERSION}'
- gem "rack", "> 0.9", "< 1.0"
- G
-
- lockfile_should_be <<-G
- GEM
- remote: file://localhost#{gem_repo1}/
- specs:
- rack (0.9.1)
-
- PLATFORMS
- ruby
-
- DEPENDENCIES
- rack (> 0.9, < 1.0)
-
- RUBY VERSION
- ruby #{RUBY_VERSION}p#{RUBY_PATCHLEVEL}
-
- BUNDLED WITH
- #{Bundler::VERSION}
- G
- end
-
- # Some versions of the Bundler 1.1 RC series introduced corrupted
- # lockfiles. There were two major problems:
- #
- # * multiple copies of the same GIT section appeared in the lockfile
- # * when this happened, those sections got multiple copies of gems
- # in those sections.
- it "fixes corrupted lockfiles" do
- build_git "omg", :path => lib_path("omg")
- revision = revision_for(lib_path("omg"))
-
- gemfile <<-G
- source "file://localhost#{gem_repo1}"
- gem "omg", :git => "#{lib_path("omg")}", :branch => 'master'
- G
-
- bundle "install --path vendor"
- expect(the_bundle).to include_gems "omg 1.0"
-
- # Create a Gemfile.lock that has duplicate GIT sections
- lockfile <<-L
- GIT
- remote: #{lib_path("omg")}
- revision: #{revision}
- branch: master
- specs:
- omg (1.0)
-
- GIT
- remote: #{lib_path("omg")}
- revision: #{revision}
- branch: master
- specs:
- omg (1.0)
-
- GEM
- remote: file://localhost#{gem_repo1}/
- specs:
-
- PLATFORMS
- #{local}
-
- DEPENDENCIES
- omg!
-
- BUNDLED WITH
- #{Bundler::VERSION}
- L
-
- FileUtils.rm_rf(bundled_app("vendor"))
- bundle "install"
- expect(the_bundle).to include_gems "omg 1.0"
-
- # Confirm that duplicate specs do not appear
- lockfile_should_be(<<-L)
- GIT
- remote: #{lib_path("omg")}
- revision: #{revision}
- branch: master
- specs:
- omg (1.0)
-
- GEM
- remote: file://localhost#{gem_repo1}/
- specs:
-
- PLATFORMS
- #{local}
-
- DEPENDENCIES
- omg!
-
- BUNDLED WITH
- #{Bundler::VERSION}
- L
- end
-
- it "raises a helpful error message when the lockfile is missing deps" do
- lockfile <<-L
- GEM
- remote: file://localhost#{gem_repo1}/
- specs:
- rack_middleware (1.0)
-
- PLATFORMS
- #{local}
-
- DEPENDENCIES
- rack_middleware
- L
-
- install_gemfile <<-G
- source "file:#{gem_repo1}"
- gem "rack_middleware"
- G
-
- expect(err).to include("Downloading rack_middleware-1.0 revealed dependencies not in the API or the lockfile (#{Gem::Dependency.new("rack", "= 0.9.1")}).").
- and include("Either installing with `--full-index` or running `bundle update rack_middleware` should fix the problem.")
- end
-
- describe "a line ending" do
- def set_lockfile_mtime_to_known_value
- time = Time.local(2000, 1, 1, 0, 0, 0)
- File.utime(time, time, bundled_app("Gemfile.lock"))
- end
- before(:each) do
- build_repo2
-
- install_gemfile <<-G
- source "file://localhost#{gem_repo2}"
- gem "rack"
- G
- set_lockfile_mtime_to_known_value
- end
-
- it "generates Gemfile.lock with \\n line endings" do
- expect(File.read(bundled_app("Gemfile.lock"))).not_to match("\r\n")
- expect(the_bundle).to include_gems "rack 1.0"
- end
-
- context "during updates" do
- it "preserves Gemfile.lock \\n line endings" do
- update_repo2
-
- expect { bundle "update", :all => true }.to change { File.mtime(bundled_app("Gemfile.lock")) }
- expect(File.read(bundled_app("Gemfile.lock"))).not_to match("\r\n")
- expect(the_bundle).to include_gems "rack 1.2"
- end
-
- it "preserves Gemfile.lock \\n\\r line endings" do
- update_repo2
- win_lock = File.read(bundled_app("Gemfile.lock")).gsub(/\n/, "\r\n")
- File.open(bundled_app("Gemfile.lock"), "wb") {|f| f.puts(win_lock) }
- set_lockfile_mtime_to_known_value
-
- expect { bundle "update", :all => true }.to change { File.mtime(bundled_app("Gemfile.lock")) }
- expect(File.read(bundled_app("Gemfile.lock"))).to match("\r\n")
- expect(the_bundle).to include_gems "rack 1.2"
- end
- end
-
- context "when nothing changes" do
- it "preserves Gemfile.lock \\n line endings" do
- expect do
- ruby <<-RUBY
- require 'rubygems'
- require 'bundler'
- Bundler.setup
- RUBY
- end.not_to change { File.mtime(bundled_app("Gemfile.lock")) }
- end
-
- it "preserves Gemfile.lock \\n\\r line endings" do
- win_lock = File.read(bundled_app("Gemfile.lock")).gsub(/\n/, "\r\n")
- File.open(bundled_app("Gemfile.lock"), "wb") {|f| f.puts(win_lock) }
- set_lockfile_mtime_to_known_value
-
- expect do
- ruby <<-RUBY
- require 'rubygems'
- require 'bundler'
- Bundler.setup
- RUBY
- end.not_to change { File.mtime(bundled_app("Gemfile.lock")) }
- end
- end
- end
-
- it "refuses to install if Gemfile.lock contains conflict markers" do
- lockfile <<-L
- GEM
- remote: file://localhost#{gem_repo1}/
- specs:
- <<<<<<<
- rack (1.0.0)
- =======
- rack (1.0.1)
- >>>>>>>
-
- PLATFORMS
- ruby
-
- DEPENDENCIES
- rack
-
- BUNDLED WITH
- #{Bundler::VERSION}
- L
-
- install_gemfile(<<-G)
- source "file://localhost#{gem_repo1}"
- gem "rack"
- G
-
- expect(last_command.bundler_err).to match(/your Gemfile.lock contains merge conflicts/i)
- expect(last_command.bundler_err).to match(/git checkout HEAD -- Gemfile.lock/i)
- end
-end
diff --git a/spec/lock/lockfile_spec.rb b/spec/lock/lockfile_spec.rb
index 7f6ec77651..c07c4e1db8 100644
--- a/spec/lock/lockfile_spec.rb
+++ b/spec/lock/lockfile_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-RSpec.describe "the lockfile format", :bundler => "2" do
+RSpec.describe "the lockfile format" do
include Bundler::GemHelpers
before { ENV["BUNDLER_SPEC_IGNORE_COMPATIBILITY_GUARD"] = "TRUE" }
@@ -183,7 +183,7 @@ RSpec.describe "the lockfile format", :bundler => "2" do
"than the version that created the lockfile (9999999.1.0). " \
"We suggest you to upgrade to the version that created the " \
"lockfile by running `gem install bundler:9999999.1.0`."
- expect(last_command.bundler_err).to include warning_message
+ expect(last_command.stderr).to include warning_message
lockfile_should_be <<-G
GEM
@@ -192,7 +192,8 @@ RSpec.describe "the lockfile format", :bundler => "2" do
rack (1.0.0)
PLATFORMS
- #{lockfile_platforms}
+ #{generic_local_platform}
+ #{specific_local_platform}
DEPENDENCIES
rack
@@ -202,7 +203,7 @@ RSpec.describe "the lockfile format", :bundler => "2" do
G
end
- it "errors if the current is a major version older than lockfile's bundler version" do
+ it "errors if the current is a major version older than lockfile's bundler version", :bundler => "2" do
lockfile <<-L
GEM
remote: file://localhost#{gem_repo1}/
@@ -267,7 +268,7 @@ RSpec.describe "the lockfile format", :bundler => "2" do
expect(err).to include("You must use Bundler 9999999 or greater with this lockfile.")
end
- it "warns when updating bundler major version" do
+ it "warns when updating bundler major version", :bundler => "< 2" do
lockfile <<-L
GEM
remote: file://localhost#{gem_repo1}/
@@ -292,8 +293,10 @@ RSpec.describe "the lockfile format", :bundler => "2" do
G
end
- expect(err).to include("Warning: the lockfile is being updated to Bundler " \
- "9999999, after which you will be unable to return to Bundler 1.")
+ expect(last_command.stderr).to include(
+ "Warning: the lockfile is being updated to Bundler " \
+ "9999999, after which you will be unable to return to Bundler 1."
+ )
lockfile_should_be <<-G
GEM
@@ -302,7 +305,8 @@ RSpec.describe "the lockfile format", :bundler => "2" do
rack (1.0.0)
PLATFORMS
- #{lockfile_platforms}
+ #{generic_local_platform}
+ #{specific_local_platform}
DEPENDENCIES
rack
@@ -312,6 +316,53 @@ RSpec.describe "the lockfile format", :bundler => "2" do
G
end
+ it "warns when updating bundler major version", :bundler => "2" do
+ lockfile <<-L
+ GEM
+ remote: file://localhost#{gem_repo1}/
+ specs:
+ rack (1.0.0)
+
+ PLATFORMS
+ #{lockfile_platforms}
+
+ DEPENDENCIES
+ rack
+
+ BUNDLED WITH
+ 1.10.0
+ L
+
+ simulate_bundler_version "9999999.0.0" do
+ install_gemfile <<-G
+ source "file://localhost#{gem_repo1}/"
+
+ gem "rack"
+ G
+
+ expect(last_command.stderr).to include(
+ "Warning: the lockfile is being updated to Bundler " \
+ "9999999, after which you will be unable to return to Bundler 1."
+ )
+
+ lockfile_should_be <<-G
+ GEM
+ remote: file://localhost#{gem_repo1}/
+ specs:
+ rack (1.0.0)
+
+ PLATFORMS
+ #{lockfile_platforms}
+
+ DEPENDENCIES
+ rack
+
+ BUNDLED WITH
+ 9999999.0.0
+ G
+ end
+ end
+
it "generates a simple lockfile for a single source, gem with dependencies" do
install_gemfile <<-G
source "file://localhost#{gem_repo1}/"
@@ -364,7 +415,40 @@ RSpec.describe "the lockfile format", :bundler => "2" do
G
end
- it "generates a lockfile without credentials for a configured source" do
+ it "generates a lockfile without credentials for a configured source", :bundler => "< 2" do
+ bundle "config set http://localgemserver.test/ user:pass"
+
+ install_gemfile(<<-G, :artifice => "endpoint_strict_basic_authentication", :quiet => true)
+ source "http://localgemserver.test/" do
+
+ end
+
+ source "http://user:pass@othergemserver.test/" do
+ gem "rack-obama", ">= 1.0"
+ end
+ G
+
+ lockfile_should_be <<-G
+ GEM
+ remote: http://localgemserver.test/
+ remote: http://user:pass@othergemserver.test/
+ specs:
+ rack (1.0.0)
+ rack-obama (1.0)
+ rack
+
+ PLATFORMS
+ #{lockfile_platforms}
+
+ DEPENDENCIES
+ rack-obama (>= 1.0)!
+
+ BUNDLED WITH
+ #{Bundler::VERSION}
+ G
+ end
+
+ it "generates a lockfile without credentials for a configured source", :bundler => "2" do
bundle "config set http://localgemserver.test/ user:pass"
install_gemfile(<<-G, :artifice => "endpoint_strict_basic_authentication", :quiet => true)
@@ -980,7 +1064,7 @@ RSpec.describe "the lockfile format", :bundler => "2" do
G
end
- it "keeps existing platforms in the lockfile" do
+ it "keeps existing platforms in the lockfile", :bundler => "< 2" do
lockfile <<-G
GEM
remote: file://localhost#{gem_repo1}/
@@ -1010,7 +1094,8 @@ RSpec.describe "the lockfile format", :bundler => "2" do
rack (1.0.0)
PLATFORMS
- #{lockfile_platforms "java", generic_local_platform, specific_local_platform}
+ java
+ #{generic_local_platform}
DEPENDENCIES
rack
@@ -1020,7 +1105,80 @@ RSpec.describe "the lockfile format", :bundler => "2" do
G
end
- it "persists the spec's platform to the lockfile" do
+ it "keeps existing platforms in the lockfile", :bundler => "2" do
+ lockfile <<-G
+ GEM
+ remote: file://localhost#{gem_repo1}/
+ specs:
+ rack (1.0.0)
+
+ PLATFORMS
+ java
+
+ DEPENDENCIES
+ rack
+
+ BUNDLED WITH
+ #{Bundler::VERSION}
+ G
+
+ install_gemfile <<-G
+ source "file://localhost#{gem_repo1}/"
+
+ gem "rack"
+ G
+
+ lockfile_should_be <<-G
+ GEM
+ remote: file://localhost#{gem_repo1}/
+ specs:
+ rack (1.0.0)
+
+ PLATFORMS
+ java
+ #{generic_local_platform}
+ #{specific_local_platform}
+
+ DEPENDENCIES
+ rack
+
+ BUNDLED WITH
+ #{Bundler::VERSION}
+ G
+ end
+
+ it "persists the spec's platform to the lockfile", :bundler => "< 2" do
+ build_repo2 do
+ build_gem "platform_specific", "1.0" do |s|
+ s.platform = Gem::Platform.new("universal-java-16")
+ end
+ end
+
+ simulate_platform "universal-java-16"
+
+ install_gemfile! <<-G
+ source "file://localhost#{gem_repo2}"
+ gem "platform_specific"
+ G
+
+ lockfile_should_be <<-G
+ GEM
+ remote: file://localhost#{gem_repo2}/
+ specs:
+ platform_specific (1.0-java)
+
+ PLATFORMS
+ java
+
+ DEPENDENCIES
+ platform_specific
+
+ BUNDLED WITH
+ #{Bundler::VERSION}
+ G
+ end
+
+ it "persists the spec's platform and specific platform to the lockfile", :bundler => "2" do
build_repo2 do
build_gem "platform_specific", "1.0" do |s|
s.platform = Gem::Platform.new("universal-java-16")
diff --git a/spec/other/major_deprecation_spec.rb b/spec/other/major_deprecation_spec.rb
index 39bba9c3da..3d79a51b94 100644
--- a/spec/other/major_deprecation_spec.rb
+++ b/spec/other/major_deprecation_spec.rb
@@ -470,16 +470,62 @@ The :gist git source is deprecated, and will be removed in the future. Add this
source "file://#{gem_repo1}"
gem "rack"
G
+ end
- bundle! :show
+ context "without flags" do
+ before do
+ bundle! :show
+ end
+
+ it "does not print a deprecation warning", :bundler => "< 2" do
+ expect(deprecations).to be_empty
+ end
+
+ it "prints a deprecation warning recommending `bundle list`", :bundler => "2" do
+ expect(deprecations).to include("use `bundle list` instead of `bundle show`")
+ end
end
- it "does not print a deprecation warning", :bundler => "< 2" do
- expect(deprecations).to be_empty
+ context "with --outdated flag" do
+ before do
+ bundle! "show --outdated"
+ end
+
+ it "does not print a deprecation warning", :bundler => "< 2" do
+ expect(deprecations).to be_empty
+ end
+
+ it "prints a deprecation warning informing about its removal", :bundler => "2" do
+ expect(deprecations).to include("the `--outdated` flag to `bundle show` was undocumented and will be removed without replacement")
+ end
end
- it "prints a deprecation warning", :bundler => "2" do
- expect(deprecations).to include("use `bundle list` instead of `bundle show`")
+ context "with --verbose flag" do
+ before do
+ bundle! "show --verbose"
+ end
+
+ it "does not print a deprecation warning", :bundler => "< 2" do
+ expect(deprecations).to be_empty
+ end
+
+ it "prints a deprecation warning informing about its removal", :bundler => "2" do
+ expect(deprecations).to include("the `--verbose` flag to `bundle show` was undocumented and will be removed without replacement")
+ end
+ end
+
+ context "with a gem argument" do
+ before do
+ bundle! "show rack"
+ end
+
+ it "does not print a deprecation warning", :bundler => "< 2" do
+ expect(deprecations).to be_empty
+ end
+
+ it "prints a deprecation warning recommending `bundle info`", :bundler => "2" do
+ expect(deprecations).to include("use `bundle info rack` instead of `bundle show rack`")
+ end
end
end
diff --git a/spec/realworld/dependency_api_spec.rb b/spec/realworld/dependency_api_spec.rb
index c1ce8ceff1..e7d11419cd 100644
--- a/spec/realworld/dependency_api_spec.rb
+++ b/spec/realworld/dependency_api_spec.rb
@@ -9,7 +9,7 @@ RSpec.describe "gemcutter's dependency API", :realworld => true do
@server_uri = "http://127.0.0.1:#{port}"
require File.expand_path("../../support/artifice/endpoint_timeout", __FILE__)
- require "thread"
+
@t = Thread.new do
server = Rack::Server.start(:app => EndpointTimeout,
:Host => "0.0.0.0",
diff --git a/spec/realworld/gemfile_source_header_spec.rb b/spec/realworld/gemfile_source_header_spec.rb
index ad8897d68c..eaefd0f03e 100644
--- a/spec/realworld/gemfile_source_header_spec.rb
+++ b/spec/realworld/gemfile_source_header_spec.rb
@@ -1,7 +1,5 @@
# frozen_string_literal: true
-require "thread"
-
RSpec.describe "fetching dependencies with a mirrored source", :realworld => true do
let(:mirror) { "https://server.example.org" }
let(:original) { "http://127.0.0.1:#{@port}" }
diff --git a/spec/realworld/mirror_probe_spec.rb b/spec/realworld/mirror_probe_spec.rb
index 8235032321..c5e95f3059 100644
--- a/spec/realworld/mirror_probe_spec.rb
+++ b/spec/realworld/mirror_probe_spec.rb
@@ -1,7 +1,5 @@
# frozen_string_literal: true
-require "thread"
-
RSpec.describe "fetching dependencies with a not available mirror", :realworld => true do
let(:mirror) { @mirror_uri }
let(:original) { @server_uri }
diff --git a/spec/support/platforms.rb b/spec/support/platforms.rb
index 39040a61bd..29758e888c 100644
--- a/spec/support/platforms.rb
+++ b/spec/support/platforms.rb
@@ -100,9 +100,8 @@ module Spec
9999
end
- def lockfile_platforms(*platforms)
- platforms = local_platforms if platforms.empty?
- platforms.map(&:to_s).sort.join("\n ")
+ def lockfile_platforms
+ local_platforms.map(&:to_s).sort.join("\n ")
end
def local_platforms