summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThe Bundler Bot <bot@bundler.io>2017-08-20 20:09:49 +0000
committerThe Bundler Bot <bot@bundler.io>2017-08-20 20:09:49 +0000
commit0d07f1aa813355be1134105a8933455f9a30cf4b (patch)
tree2796493c25024a5b2e905cd3ae02f80c38444ade
parentaea4046b5b91b83b27f117822e1bd6c614da3e6e (diff)
parent1451bdf8b1038fd64dee8b1c13174a5d543474b3 (diff)
downloadbundler-0d07f1aa813355be1134105a8933455f9a30cf4b.tar.gz
Auto merge of #5873 - bundler:seg-deprecations-hard-error-in-2, r=segiddins
Ensure deprecations become a hard error in Bundler 2 ### What was the end-user problem that led to this PR? The problem was some deprecations aren't guaranteed to be behind a feature flag, so we want to guarantee that we won't continue to support those behaviors when they're intended to be removed. ### What was your diagnosis of the problem? My diagnosis was we needed to ensure that deprecations don't stay deprecations past the point they're supported. ### What is your fix for the problem, implemented in this PR? My fix adds a `major_version` argument to the deprecation method, and raises an error if the current version is `>=` that version ### Why did you choose this fix out of the possible options? I chose this fix because it will ensure that everything deprecated won't continue to work past when it's supposed to, reducing the chance we'll need to accidentally support things we won't want to.
-rwxr-xr-xexe/bundle_ruby7
-rw-r--r--lib/bundler.rb5
-rw-r--r--lib/bundler/capistrano.rb4
-rw-r--r--lib/bundler/cli.rb4
-rw-r--r--lib/bundler/cli/console.rb2
-rw-r--r--lib/bundler/cli/install.rb2
-rw-r--r--lib/bundler/cli/open.rb2
-rw-r--r--lib/bundler/cli/update.rb2
-rw-r--r--lib/bundler/deployment.rb2
-rw-r--r--lib/bundler/dsl.rb10
-rw-r--r--lib/bundler/rubygems_integration.rb4
-rw-r--r--lib/bundler/settings.rb2
-rw-r--r--lib/bundler/shared_helpers.rb31
-rw-r--r--lib/bundler/version.rb4
-rw-r--r--lib/bundler/vlad.rb4
-rw-r--r--spec/commands/inject_spec.rb2
-rw-r--r--spec/commands/install_spec.rb6
-rw-r--r--spec/commands/show_spec.rb2
-rw-r--r--spec/install/binstubs_spec.rb8
-rw-r--r--spec/install/bundler_spec.rb4
-rw-r--r--spec/install/gemfile/platform_spec.rb2
-rw-r--r--spec/install/gemfile_spec.rb4
-rw-r--r--spec/lock/git_spec.rb2
-rw-r--r--spec/other/bundle_ruby_spec.rb2
-rw-r--r--spec/other/major_deprecation_spec.rb23
-rw-r--r--spec/other/platform_spec.rb14
-rw-r--r--spec/plugins/source/example_spec.rb2
-rw-r--r--spec/quality_spec.rb1
-rw-r--r--spec/realworld/parallel_spec.rb8
-rw-r--r--spec/runtime/with_clean_env_spec.rb14
30 files changed, 101 insertions, 78 deletions
diff --git a/exe/bundle_ruby b/exe/bundle_ruby
index 847708c3ea..df6f8cc8a1 100755
--- a/exe/bundle_ruby
+++ b/exe/bundle_ruby
@@ -1,12 +1,15 @@
#!/usr/bin/env ruby
# frozen_string_literal: true
+require "bundler/shared_helpers"
+
+Bundler::SharedHelpers.major_deprecation(2, "the bundle_ruby executable has been removed in favor of `bundle platform --ruby`")
+
Signal.trap("INT") { exit 1 }
require "bundler/errors"
require "bundler/ruby_version"
require "bundler/ruby_dsl"
-require "bundler/shared_helpers"
module Bundler
class Dsl
@@ -42,8 +45,6 @@ module Bundler
end
end
-Bundler::SharedHelpers.major_deprecation("the bundle_ruby executable has been removed in favor of `bundle platform --ruby`")
-
dsl = Bundler::Dsl.new
begin
dsl.eval_gemfile(Bundler::SharedHelpers.default_gemfile)
diff --git a/lib/bundler.rb b/lib/bundler.rb
index e4b9313401..d1be40c2b5 100644
--- a/lib/bundler.rb
+++ b/lib/bundler.rb
@@ -119,7 +119,7 @@ module Bundler
end
def environment
- SharedHelpers.major_deprecation "Bundler.environment has been removed in favor of Bundler.load"
+ SharedHelpers.major_deprecation 2, "Bundler.environment has been removed in favor of Bundler.load"
load
end
@@ -267,7 +267,7 @@ EOF
# @deprecated Use `original_env` instead
# @return [Hash] Environment with all bundler-related variables removed
def clean_env
- Bundler::SharedHelpers.major_deprecation("`Bundler.clean_env` has weird edge cases, use `.original_env` instead")
+ Bundler::SharedHelpers.major_deprecation(2, "`Bundler.clean_env` has weird edge cases, use `.original_env` instead")
env = original_env
if env.key?("BUNDLER_ORIG_MANPATH")
@@ -464,6 +464,7 @@ EOF
def reset_paths!
@bin_path = nil
+ @bundler_major_version = nil
@bundle_path = nil
@configured = nil
@configured_bundle_path = nil
diff --git a/lib/bundler/capistrano.rb b/lib/bundler/capistrano.rb
index 81d457cf26..1b7145b72b 100644
--- a/lib/bundler/capistrano.rb
+++ b/lib/bundler/capistrano.rb
@@ -1,5 +1,9 @@
# frozen_string_literal: true
+require "bundler/shared_helpers"
+Bundler::SharedHelpers.major_deprecation 2,
+ "The Bundler task for Capistrano. Please use http://github.com/capistrano/bundler"
+
# Capistrano task for Bundler.
#
# Add "require 'bundler/capistrano'" in your Capistrano deploy.rb, and
diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb
index 70d210b9e9..12fe7adf01 100644
--- a/lib/bundler/cli.rb
+++ b/lib/bundler/cli.rb
@@ -253,7 +253,7 @@ module Bundler
method_option "outdated", :type => :boolean,
:banner => "Show verbose output including whether gems are outdated."
def show(gem_name = nil)
- Bundler::SharedHelpers.major_deprecation("use `bundle list` instead of `bundle show`") if ARGV[0] == "show"
+ Bundler::SharedHelpers.major_deprecation(2, "use `bundle list` instead of `bundle show`") if ARGV[0] == "show"
require "bundler/cli/show"
Show.new(options, gem_name).run
end
@@ -536,7 +536,7 @@ module Bundler
method_option "group", :type => :string, :banner =>
"Install gem into a bundler group"
def inject(name, version)
- SharedHelpers.major_deprecation "The `inject` command has been replaced by the `add` command"
+ SharedHelpers.major_deprecation 2, "The `inject` command has been replaced by the `add` command"
require "bundler/cli/inject"
Inject.new(options.dup, name, version).run
end
diff --git a/lib/bundler/cli/console.rb b/lib/bundler/cli/console.rb
index 70a2c90f74..853eca8358 100644
--- a/lib/bundler/cli/console.rb
+++ b/lib/bundler/cli/console.rb
@@ -9,7 +9,7 @@ module Bundler
end
def run
- Bundler::SharedHelpers.major_deprecation "bundle console will be replaced " \
+ Bundler::SharedHelpers.major_deprecation 2, "bundle console will be replaced " \
"by `bin/console` generated by `bundle gem <name>`"
group ? Bundler.require(:default, *(group.split.map!(&:to_sym))) : Bundler.require
diff --git a/lib/bundler/cli/install.rb b/lib/bundler/cli/install.rb
index 771ff6f5dc..5b852dd88c 100644
--- a/lib/bundler/cli/install.rb
+++ b/lib/bundler/cli/install.rb
@@ -55,7 +55,7 @@ module Bundler
Bundler::Fetcher.disable_endpoint = options["full-index"]
if options["binstubs"]
- Bundler::SharedHelpers.major_deprecation \
+ Bundler::SharedHelpers.major_deprecation 2,
"The --binstubs option will be removed in favor of `bundle binstubs`"
end
diff --git a/lib/bundler/cli/open.rb b/lib/bundler/cli/open.rb
index 380dbcb258..fb18b0aacc 100644
--- a/lib/bundler/cli/open.rb
+++ b/lib/bundler/cli/open.rb
@@ -18,7 +18,7 @@ module Bundler
path = spec.full_gem_path
Dir.chdir(path) do
command = Shellwords.split(editor) + [path]
- Bundler.with_clean_env do
+ Bundler.with_original_env do
system(*command)
end || Bundler.ui.info("Could not run '#{command.join(" ")}'")
end
diff --git a/lib/bundler/cli/update.rb b/lib/bundler/cli/update.rb
index 73caae387f..26ee192aa9 100644
--- a/lib/bundler/cli/update.rb
+++ b/lib/bundler/cli/update.rb
@@ -24,7 +24,7 @@ module Bundler
if Bundler.feature_flag.update_requires_all_flag?
raise InvalidOption, "To update everything, pass the `--all` flag."
end
- SharedHelpers.major_deprecation "Pass --all to `bundle update` to update everything"
+ SharedHelpers.major_deprecation 2, "Pass --all to `bundle update` to update everything"
elsif !full_update && options[:all]
raise InvalidOption, "Cannot specify --all along with specific options."
end
diff --git a/lib/bundler/deployment.rb b/lib/bundler/deployment.rb
index 94f2fac620..291e158ca0 100644
--- a/lib/bundler/deployment.rb
+++ b/lib/bundler/deployment.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
require "bundler/shared_helpers"
-Bundler::SharedHelpers.major_deprecation "Bundler no longer integrates with " \
+Bundler::SharedHelpers.major_deprecation 2, "Bundler no longer integrates with " \
"Capistrano, but Capistrano provides its own integration with " \
"Bundler via the capistrano-bundler gem. Use it instead."
diff --git a/lib/bundler/dsl.rb b/lib/bundler/dsl.rb
index 679c66e711..8681163277 100644
--- a/lib/bundler/dsl.rb
+++ b/lib/bundler/dsl.rb
@@ -178,7 +178,7 @@ module Bundler
" end\n\n"
raise DeprecatedError, msg if Bundler.feature_flag.disable_multisource?
- SharedHelpers.major_deprecation(msg.strip)
+ SharedHelpers.major_deprecation(2, msg.strip)
end
source_options = normalize_hash(options).merge(
@@ -290,7 +290,7 @@ module Bundler
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
# TODO: 2.0 upgrade this setting to the default
if Bundler.settings["github.https"]
- Bundler::SharedHelpers.major_deprecation "The `github.https` setting will be removed"
+ Bundler::SharedHelpers.major_deprecation 2, "The `github.https` setting will be removed"
"https://github.com/#{repo_name}.git"
else
"git://github.com/#{repo_name}.git"
@@ -440,7 +440,7 @@ repo_name ||= user_name
def normalize_source(source)
case source
when :gemcutter, :rubygems, :rubyforge
- Bundler::SharedHelpers.major_deprecation "The source :#{source} is deprecated because HTTP " \
+ Bundler::SharedHelpers.major_deprecation 2, "The source :#{source} is deprecated because HTTP " \
"requests are insecure.\nPlease change your source to 'https://" \
"rubygems.org' if possible, or 'http://rubygems.org' if not."
"http://rubygems.org"
@@ -464,7 +464,7 @@ repo_name ||= user_name
end
raise GemfileEvalError, msg
else
- Bundler::SharedHelpers.major_deprecation "Your Gemfile contains multiple primary sources. " \
+ Bundler::SharedHelpers.major_deprecation 2, "Your Gemfile contains multiple primary sources. " \
"Using `source` more than once without a block is a security risk, and " \
"may result in installing unexpected gems. To resolve this warning, use " \
"a block to indicate which gems should come from the secondary source. " \
@@ -482,7 +482,7 @@ repo_name ||= user_name
"do |repo_name|\n#{replacement.to_s.gsub(/^/, " ")}\n end"
end
- Bundler::SharedHelpers.major_deprecation <<-EOS
+ Bundler::SharedHelpers.major_deprecation 2, <<-EOS
The :#{name} git source is deprecated, and will be removed in Bundler 2.0.#{additional_message} Add this code to the top of your Gemfile to ensure it continues to work:
git_source(:#{name}) #{replacement}
diff --git a/lib/bundler/rubygems_integration.rb b/lib/bundler/rubygems_integration.rb
index 202903d981..6f8a7608b0 100644
--- a/lib/bundler/rubygems_integration.rb
+++ b/lib/bundler/rubygems_integration.rb
@@ -455,8 +455,8 @@ module Bundler
raise Gem::Exception, "no default executable for #{spec.full_name}" unless exec_name ||= spec.default_executable
- unless spec.name == exec_name
- Bundler::SharedHelpers.major_deprecation \
+ unless spec.name == gem_name
+ Bundler::SharedHelpers.major_deprecation 2,
"Bundler is using a binstub that was created for a different gem (#{spec.name}).\n" \
"You should run `bundle binstub #{gem_name}` " \
"to work around a system/bundle conflict."
diff --git a/lib/bundler/settings.rb b/lib/bundler/settings.rb
index d19cc18dd6..8d4276159b 100644
--- a/lib/bundler/settings.rb
+++ b/lib/bundler/settings.rb
@@ -103,7 +103,7 @@ module Bundler
"bundle config #{key} #{Array(value).join(":")}"
end
- Bundler::SharedHelpers.major_deprecation \
+ Bundler::SharedHelpers.major_deprecation 2,\
"flags passed to commands " \
"will no longer be automatically remembered. Instead please set flags " \
"you want remembered between commands using `bundle config " \
diff --git a/lib/bundler/shared_helpers.rb b/lib/bundler/shared_helpers.rb
index ce3286cc28..bef9cc6139 100644
--- a/lib/bundler/shared_helpers.rb
+++ b/lib/bundler/shared_helpers.rb
@@ -5,6 +5,7 @@ require "bundler/compatibility_guard"
require "pathname"
require "rubygems"
+require "bundler/version"
require "bundler/constants"
require "bundler/rubygems_integration"
require "bundler/current_ruby"
@@ -138,20 +139,34 @@ module Bundler
namespace.const_get(constant_name)
end
- def major_deprecation(message)
+ def major_deprecation(major_version, message)
+ if Bundler.bundler_major_version >= major_version
+ require "bundler/errors"
+ raise DeprecatedError, "[REMOVED FROM #{major_version}.0] #{message}"
+ end
+
return unless prints_major_deprecations?
@major_deprecation_ui ||= Bundler::UI::Shell.new("no-color" => true)
ui = Bundler.ui.is_a?(@major_deprecation_ui.class) ? Bundler.ui : @major_deprecation_ui
- ui.warn("[DEPRECATED FOR #{Bundler::VERSION.split(".").first.to_i + 1}.0] #{message}")
+ ui.warn("[DEPRECATED FOR #{major_version}.0] #{message}")
end
def print_major_deprecations!
- deprecate_gemfile(find_gemfile) if find_gemfile(:order_matters) == find_file("Gemfile")
+ multiple_gemfiles = search_up(".") do |dir|
+ gemfiles = gemfile_names.select {|gf| File.file? File.expand_path(gf, dir) }
+ next if gemfiles.empty?
+ break false if gemfiles.size == 1
+ end
+ if multiple_gemfiles && Bundler.bundler_major_version == 1
+ Bundler::SharedHelpers.major_deprecation 2, \
+ "gems.rb and gems.locked will be preferred to Gemfile and Gemfile.lock."
+ end
+
if RUBY_VERSION < "2"
- major_deprecation("Bundler will only support ruby >= 2.0, you are running #{RUBY_VERSION}")
+ major_deprecation(2, "Bundler will only support ruby >= 2.0, you are running #{RUBY_VERSION}")
end
return if Bundler.rubygems.provides?(">= 2")
- major_deprecation("Bundler will only support rubygems >= 2.0, you are running #{Bundler.rubygems.version}")
+ major_deprecation(2, "Bundler will only support rubygems >= 2.0, you are running #{Bundler.rubygems.version}")
end
def trap(signal, override = false, &block)
@@ -330,12 +345,6 @@ module Bundler
true
end
- def deprecate_gemfile(gemfile)
- return unless gemfile && File.basename(gemfile) == "Gemfile"
- Bundler::SharedHelpers.major_deprecation \
- "gems.rb and gems.locked will be preferred to Gemfile and Gemfile.lock."
- end
-
extend self
end
end
diff --git a/lib/bundler/version.rb b/lib/bundler/version.rb
index fe36d4e45b..424965771a 100644
--- a/lib/bundler/version.rb
+++ b/lib/bundler/version.rb
@@ -21,4 +21,8 @@ module Bundler
end
private_class_method :overwrite_loaded_gem_version
overwrite_loaded_gem_version
+
+ def self.bundler_major_version
+ @bundler_major_version ||= VERSION.split(".").first.to_i
+ end
end
diff --git a/lib/bundler/vlad.rb b/lib/bundler/vlad.rb
index bd2128c73d..68181e7db8 100644
--- a/lib/bundler/vlad.rb
+++ b/lib/bundler/vlad.rb
@@ -1,5 +1,9 @@
# frozen_string_literal: true
+require "bundler/shared_helpers"
+Bundler::SharedHelpers.major_deprecation 2,
+ "The Bundler task for Vlad"
+
# Vlad task for Bundler.
#
# Add "require 'bundler/vlad'" in your Vlad deploy.rb, and
diff --git a/spec/commands/inject_spec.rb b/spec/commands/inject_spec.rb
index 80d22ee286..6c1994b59d 100644
--- a/spec/commands/inject_spec.rb
+++ b/spec/commands/inject_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-RSpec.describe "bundle inject" do
+RSpec.describe "bundle inject", :bundler => "< 2" do
before :each do
gemfile <<-G
source "file://#{gem_repo1}"
diff --git a/spec/commands/install_spec.rb b/spec/commands/install_spec.rb
index 46ec7105a0..7370c27c25 100644
--- a/spec/commands/install_spec.rb
+++ b/spec/commands/install_spec.rb
@@ -389,10 +389,10 @@ RSpec.describe "bundle install with gem sources" do
context "and using an unsupported Ruby version" do
it "prints an error" do
install_gemfile <<-G
- ::RUBY_VERSION = '1.8.7'
- ruby '~> 2.1'
+ ::RUBY_VERSION = '2.0.1'
+ ruby '~> 2.2'
G
- expect(out).to include("Your Ruby version is 1.8.7, but your Gemfile specified ~> 2.1")
+ expect(out).to include("Your Ruby version is 2.0.1, but your Gemfile specified ~> 2.2")
end
end
diff --git a/spec/commands/show_spec.rb b/spec/commands/show_spec.rb
index 9b2648bf75..d91ac275d1 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 => "< 2" do
context "with a standard Gemfile" do
before :each do
install_gemfile <<-G
diff --git a/spec/install/binstubs_spec.rb b/spec/install/binstubs_spec.rb
index 9f361035e0..23eb691ab8 100644
--- a/spec/install/binstubs_spec.rb
+++ b/spec/install/binstubs_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-RSpec.describe "bundle install" do
+RSpec.describe "bundle install", :bundler => "< 2" do
describe "when system_bindir is set" do
# On OS X, Gem.bindir defaults to /usr/bin, so system_bindir is useful if
# you want to avoid sudo installs for system gems with OS X's default ruby
@@ -35,12 +35,6 @@ RSpec.describe "bundle install" do
G
end
- it "prints a deprecation notice" do
- bundle "config major_deprecations true"
- gembin("rackup")
- expect(out).to include("Bundler is using a binstub that was created for a different gem (rack).")
- end
-
it "loads the correct spec's executable" do
gembin("rackup")
expect(out).to eq("1.2")
diff --git a/spec/install/bundler_spec.rb b/spec/install/bundler_spec.rb
index 3c5ae0a84f..08b7e2b673 100644
--- a/spec/install/bundler_spec.rb
+++ b/spec/install/bundler_spec.rb
@@ -125,7 +125,7 @@ RSpec.describe "bundle install" do
expect(last_command.bundler_err).to include(nice_error)
end
- it "can install dependencies with newer bundler version with system gems" do
+ it "can install dependencies with newer bundler version with system gems", :ruby => "> 2" do
bundle! "config path.system true"
install_gemfile! <<-G
source "file://#{gem_repo2}"
@@ -138,7 +138,7 @@ RSpec.describe "bundle install" do
expect(out).to include("The Gemfile's dependencies are satisfied")
end
- it "can install dependencies with newer bundler version with a local path" do
+ it "can install dependencies with newer bundler version with a local path", :ruby => "> 2" do
bundle! "config path .bundle"
install_gemfile! <<-G
source "file://#{gem_repo2}"
diff --git a/spec/install/gemfile/platform_spec.rb b/spec/install/gemfile/platform_spec.rb
index d14847daa9..d7d4e0a53c 100644
--- a/spec/install/gemfile/platform_spec.rb
+++ b/spec/install/gemfile/platform_spec.rb
@@ -199,7 +199,7 @@ RSpec.describe "bundle install with platform conditionals" do
end
G
- bundle :show
+ bundle :list
expect(exitstatus).to eq(0) if exitstatus
end
diff --git a/spec/install/gemfile_spec.rb b/spec/install/gemfile_spec.rb
index d1b1f1e6b8..945d9f485d 100644
--- a/spec/install/gemfile_spec.rb
+++ b/spec/install/gemfile_spec.rb
@@ -36,7 +36,7 @@ RSpec.describe "bundle install" do
end
it "uses the gemfile to install" do
bundle "install"
- bundle "show"
+ bundle "list"
expect(out).to include("rack (1.0.0)")
end
@@ -44,7 +44,7 @@ RSpec.describe "bundle install" do
bundled_app("subdir").mkpath
Dir.chdir(bundled_app("subdir")) do
bundle "install"
- bundle "show"
+ bundle "list"
expect(out).to include("rack (1.0.0)")
end
diff --git a/spec/lock/git_spec.rb b/spec/lock/git_spec.rb
index 4179a0218a..14b80483ee 100644
--- a/spec/lock/git_spec.rb
+++ b/spec/lock/git_spec.rb
@@ -29,6 +29,6 @@ RSpec.describe "bundle lock with git gems" do
run <<-RUBY
puts Bundler.rubygems.find_name('foo').first.full_gem_path
RUBY
- expect(out).to eq(bundle("show foo"))
+ expect(out).to eq(bundle("info foo --path"))
end
end
diff --git a/spec/other/bundle_ruby_spec.rb b/spec/other/bundle_ruby_spec.rb
index e65bbc5e42..6cc33f60ac 100644
--- a/spec/other/bundle_ruby_spec.rb
+++ b/spec/other/bundle_ruby_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-RSpec.describe "bundle_ruby" do
+RSpec.describe "bundle_ruby", :bundler => "< 2" do
context "without patchlevel" do
it "returns the ruby version" do
gemfile <<-G
diff --git a/spec/other/major_deprecation_spec.rb b/spec/other/major_deprecation_spec.rb
index dada1db317..fba177b497 100644
--- a/spec/other/major_deprecation_spec.rb
+++ b/spec/other/major_deprecation_spec.rb
@@ -132,12 +132,14 @@ RSpec.describe "major deprecations", :bundler => "< 2" do
end
it "should print a Gemfile deprecation warning" do
- install_gemfile <<-G
+ create_file "gems.rb"
+ install_gemfile! <<-G
source "file://#{gem_repo1}"
gem "rack"
G
+ expect(the_bundle).to include_gem "rack 1.0"
- expect(warnings).to have_major_deprecation("gems.rb and gems.locked will be preferred to Gemfile and Gemfile.lock.")
+ expect(warnings).to have_major_deprecation a_string_including("gems.rb and gems.locked will be preferred to Gemfile and Gemfile.lock.")
end
context "with flags" do
@@ -156,7 +158,8 @@ RSpec.describe "major deprecations", :bundler => "< 2" do
context "when Bundler.setup is run in a ruby script" do
it "should print a single deprecation warning" do
- install_gemfile <<-G
+ create_file "gems.rb"
+ install_gemfile! <<-G
source "file://#{gem_repo1}"
gem "rack", :group => :test
G
@@ -171,7 +174,7 @@ RSpec.describe "major deprecations", :bundler => "< 2" do
Bundler.setup
RUBY
- expect(warnings).to have_major_deprecation("gems.rb and gems.locked will be preferred to Gemfile and Gemfile.lock.")
+ expect(warnings_without_version_messages).to have_major_deprecation("gems.rb and gems.locked will be preferred to Gemfile and Gemfile.lock.")
end
end
@@ -202,7 +205,7 @@ The :github git source is deprecated, and will be removed in Bundler 2.0. Change
git_source(:github) {|repo_name| "https://github.com/\#{repo_name}.git" }
EOS
- expect(Bundler::SharedHelpers).to receive(:major_deprecation).with(msg)
+ expect(Bundler::SharedHelpers).to receive(:major_deprecation).with(2, msg)
subject.gem("sparks", :github => "indirect/sparks")
end
@@ -214,8 +217,8 @@ The :github git source is deprecated, and will be removed in Bundler 2.0. Change
git_source(:github) {|repo_name| "https://github.com/\#{repo_name}.git" }
EOS
- expect(Bundler::SharedHelpers).to receive(:major_deprecation).with(msg)
- expect(Bundler::SharedHelpers).to receive(:major_deprecation).with("The `github.https` setting will be removed")
+ expect(Bundler::SharedHelpers).to receive(:major_deprecation).with(2, msg)
+ expect(Bundler::SharedHelpers).to receive(:major_deprecation).with(2, "The `github.https` setting will be removed")
subject.gem("sparks", :github => "indirect/sparks")
github_uri = "https://github.com/indirect/sparks.git"
expect(subject.dependencies.first.source.uri).to eq(github_uri)
@@ -235,7 +238,7 @@ The :bitbucket git source is deprecated, and will be removed in Bundler 2.0. Add
end
EOS
- expect(Bundler::SharedHelpers).to receive(:major_deprecation).with(msg)
+ expect(Bundler::SharedHelpers).to receive(:major_deprecation).with(2, msg)
subject.gem("not-really-a-gem", :bitbucket => "mcorp/flatlab-rails")
end
end
@@ -247,7 +250,7 @@ The :bitbucket git source is deprecated, and will be removed in Bundler 2.0. Add
"in Bundler 2.0. Add this code to the top of your Gemfile to ensure it " \
"continues to work:\n\n git_source(:gist) {|repo_name| " \
"\"https://gist.github.com/\#{repo_name}.git\" }\n\n"
- expect(Bundler::SharedHelpers).to receive(:major_deprecation).with(msg)
+ expect(Bundler::SharedHelpers).to receive(:major_deprecation).with(2, msg)
subject.gem("not-really-a-gem", :gist => "1234")
end
end
@@ -264,7 +267,7 @@ The :bitbucket git source is deprecated, and will be removed in Bundler 2.0. Add
warnings.gsub!(/gems included.*?\[DEPRECATED/im, "[DEPRECATED")
- expect(warnings).to have_major_deprecation("use `bundle list` instead of `bundle show`")
+ expect(warnings).to have_major_deprecation a_string_including("use `bundle list` instead of `bundle show`")
end
end
diff --git a/spec/other/platform_spec.rb b/spec/other/platform_spec.rb
index 63831c89b6..fea5daf5ac 100644
--- a/spec/other/platform_spec.rb
+++ b/spec/other/platform_spec.rb
@@ -586,7 +586,7 @@ G
end
end
- context "bundle show" do
+ context "bundle info" do
before do
install_gemfile <<-G
source "file://#{gem_repo1}"
@@ -602,7 +602,7 @@ G
#{ruby_version_correct}
G
- bundle "show rails"
+ bundle "info rails --path"
expect(out).to eq(default_bundle_path("gems", "rails-2.3.2").to_s)
end
@@ -615,12 +615,12 @@ G
#{ruby_version_correct_engineless}
G
- bundle "show rails"
+ bundle "info rails --path"
expect(out).to eq(default_bundle_path("gems", "rails-2.3.2").to_s)
end
end
- it "fails if ruby version doesn't match" do
+ it "fails if ruby version doesn't match", :bundler => "< 2" do
gemfile <<-G
source "file://#{gem_repo1}"
gem "rails"
@@ -632,7 +632,7 @@ G
should_be_ruby_version_incorrect
end
- it "fails if engine doesn't match" do
+ it "fails if engine doesn't match", :bundler => "< 2" do
gemfile <<-G
source "file://#{gem_repo1}"
gem "rails"
@@ -644,7 +644,7 @@ G
should_be_engine_incorrect
end
- it "fails if engine version doesn't match" do
+ it "fails if engine version doesn't match", :bundler => "< 2" do
simulate_ruby_engine "jruby" do
gemfile <<-G
source "file://#{gem_repo1}"
@@ -658,7 +658,7 @@ G
end
end
- it "fails when patchlevel doesn't match" do
+ it "fails when patchlevel doesn't match", :bundler => "< 2" do
gemfile <<-G
source "file://#{gem_repo1}"
gem "rack"
diff --git a/spec/plugins/source/example_spec.rb b/spec/plugins/source/example_spec.rb
index 368c75702d..aa3163ad40 100644
--- a/spec/plugins/source/example_spec.rb
+++ b/spec/plugins/source/example_spec.rb
@@ -118,7 +118,7 @@ RSpec.describe "real source plugins" do
run <<-RUBY
puts Bundler.rubygems.find_name('a-path-gem').first.full_gem_path
RUBY
- expect(out).to eq(bundle("show a-path-gem"))
+ expect(out).to eq(bundle("info a-path-gem --path"))
end
it "installs the gem executables" do
diff --git a/spec/quality_spec.rb b/spec/quality_spec.rb
index dcc518dce4..d4f3ddaf9b 100644
--- a/spec/quality_spec.rb
+++ b/spec/quality_spec.rb
@@ -229,6 +229,7 @@ RSpec.describe "The library itself" do
Dir.chdir(root) do
exclusions = %w[
lib/bundler/capistrano.rb
+ lib/bundler/deployment.rb
lib/bundler/gem_tasks.rb
lib/bundler/vlad.rb
lib/bundler/templates/gems.rb
diff --git a/spec/realworld/parallel_spec.rb b/spec/realworld/parallel_spec.rb
index e8d9771b09..ed4430c68b 100644
--- a/spec/realworld/parallel_spec.rb
+++ b/spec/realworld/parallel_spec.rb
@@ -17,10 +17,10 @@ RSpec.describe "parallel", :realworld => true, :sometimes => true do
expect(out).to include("is not threadsafe")
end
- bundle "show activesupport"
+ bundle "info activesupport --path"
expect(out).to match(/activesupport/)
- bundle "show faker"
+ bundle "info faker --path"
expect(out).to match(/faker/)
end
@@ -46,10 +46,10 @@ RSpec.describe "parallel", :realworld => true, :sometimes => true do
expect(out).to include("is not threadsafe")
end
- bundle "show activesupport"
+ bundle "info activesupport --path"
expect(out).to match(/activesupport-3\.2\.\d+/)
- bundle "show faker"
+ bundle "info faker --path"
expect(out).to match(/faker/)
end
diff --git a/spec/runtime/with_clean_env_spec.rb b/spec/runtime/with_clean_env_spec.rb
index 5cd9f264c2..78eebaff79 100644
--- a/spec/runtime/with_clean_env_spec.rb
+++ b/spec/runtime/with_clean_env_spec.rb
@@ -3,8 +3,9 @@
RSpec.describe "Bundler.with_env helpers" do
describe "Bundler.original_env" do
before do
+ bundle "config path vendor/bundle"
gemfile ""
- bundle "install --path vendor/bundle"
+ bundle "install"
end
it "should return the PATH present before bundle was activated" do
@@ -55,10 +56,11 @@ RSpec.describe "Bundler.with_env helpers" do
end
end
- describe "Bundler.clean_env" do
+ describe "Bundler.clean_env", :bundler => "< 2" do
before do
+ bundle "config path vendor/bundle"
gemfile ""
- bundle "install --path vendor/bundle"
+ bundle "install"
end
it "should delete BUNDLE_PATH" do
@@ -107,7 +109,7 @@ RSpec.describe "Bundler.with_env helpers" do
end
end
- describe "Bundler.with_clean_env" do
+ describe "Bundler.with_clean_env", :bundler => "< 2" do
it "should set ENV to clean_env in the block" do
expected = Bundler.clean_env
actual = Bundler.with_clean_env { ENV.to_hash }
@@ -123,14 +125,14 @@ RSpec.describe "Bundler.with_env helpers" do
end
end
- describe "Bundler.clean_system", :ruby => ">= 1.9" do
+ describe "Bundler.clean_system", :ruby => ">= 1.9", :bundler => "< 2" do
it "runs system inside with_clean_env" do
Bundler.clean_system(%(echo 'if [ "$BUNDLE_PATH" = "" ]; then exit 42; else exit 1; fi' | /bin/sh))
expect($?.exitstatus).to eq(42)
end
end
- describe "Bundler.clean_exec", :ruby => ">= 1.9" do
+ describe "Bundler.clean_exec", :ruby => ">= 1.9", :bundler => "< 2" do
it "runs exec inside with_clean_env" do
pid = Kernel.fork do
Bundler.clean_exec(%(echo 'if [ "$BUNDLE_PATH" = "" ]; then exit 42; else exit 1; fi' | /bin/sh))