summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/bundler/cli.rb8
-rw-r--r--spec/commands/check_spec.rb55
-rw-r--r--spec/other/major_deprecation_spec.rb24
3 files changed, 58 insertions, 29 deletions
diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb
index 8b055dc902..f2735fb654 100644
--- a/lib/bundler/cli.rb
+++ b/lib/bundler/cli.rb
@@ -156,6 +156,8 @@ module Bundler
"Specify a different path than the system default ($BUNDLE_PATH or $GEM_HOME).#{" Bundler will remember this value for future installs on this machine" unless Bundler.feature_flag.forget_cli_options?}"
map "c" => "check"
def check
+ remembered_flag_deprecation("path")
+
require_relative "cli/check"
Check.new(options).run
end
@@ -205,7 +207,7 @@ module Bundler
method_option "no-prune", :type => :boolean, :banner =>
"Don't remove stale gems from the cache."
method_option "path", :type => :string, :banner =>
- "Specify a different path than the system default ($BUNDLE_PATH or $GEM_HOME). Bundler will remember this value for future installs on this machine"
+ "Specify a different path than the system default ($BUNDLE_PATH or $GEM_HOME).#{" Bundler will remember this value for future installs on this machine" unless Bundler.feature_flag.forget_cli_options?}"
method_option "quiet", :type => :boolean, :banner =>
"Only output warnings and errors."
method_option "shebang", :type => :string, :banner =>
@@ -422,7 +424,7 @@ module Bundler
method_option "no-install", :type => :boolean, :banner => "Don't install the gems, only the package."
method_option "no-prune", :type => :boolean, :banner => "Don't remove stale gems from the cache."
method_option "path", :type => :string, :banner =>
- "Specify a different path than the system default ($BUNDLE_PATH or $GEM_HOME). Bundler will remember this value for future installs on this machine"
+ "Specify a different path than the system default ($BUNDLE_PATH or $GEM_HOME).#{" Bundler will remember this value for future installs on this machine" unless Bundler.feature_flag.forget_cli_options?}"
method_option "quiet", :type => :boolean, :banner => "Only output warnings and errors."
method_option "frozen", :type => :boolean, :banner =>
"Do not allow the Gemfile.lock to be updated after this package operation's install"
@@ -789,7 +791,7 @@ module Bundler
Bundler::SharedHelpers.major_deprecation 2,\
"The `#{flag_name}` flag is deprecated because it relies on being " \
"remembered accross bundler invokations, which bundler will no longer " \
- "do in future versions. Instead please use `bundle config #{name} " \
+ "do in future versions. Instead please use `bundle config set #{name} " \
"'#{value}'`, and stop using this flag"
end
end
diff --git a/spec/commands/check_spec.rb b/spec/commands/check_spec.rb
index cde5878570..c755ef2804 100644
--- a/spec/commands/check_spec.rb
+++ b/spec/commands/check_spec.rb
@@ -239,37 +239,42 @@ RSpec.describe "bundle check" do
end
context "--path", :bundler => "< 3" do
- before do
- gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- gem "rails"
- G
- bundle "install --path vendor/bundle"
+ context "after installing gems in the proper directory" do
+ before do
+ gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
+ gem "rails"
+ G
+ bundle "install --path vendor/bundle"
+
+ FileUtils.rm_rf(bundled_app(".bundle"))
+ end
- FileUtils.rm_rf(bundled_app(".bundle"))
- end
+ it "returns success" do
+ bundle! "check --path vendor/bundle"
+ expect(out).to include("The Gemfile's dependencies are satisfied")
+ end
- it "returns success" do
- bundle! "check --path vendor/bundle"
- expect(out).to include("The Gemfile's dependencies are satisfied")
+ it "should write to .bundle/config" do
+ bundle "check --path vendor/bundle"
+ bundle! "check"
+ end
end
- it "should write to .bundle/config", :bundler => "< 3" do
- bundle "check --path vendor/bundle"
- bundle! "check"
- end
- end
+ context "after installing gems on a different directory" do
+ before do
+ install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
+ gem "rails"
+ G
- context "--path vendor/bundle after installing gems in the default directory" do
- it "returns false" do
- install_gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- gem "rails"
- G
+ bundle "check --path vendor/bundle"
+ end
- bundle "check --path vendor/bundle"
- expect(exitstatus).to eq(1) if exitstatus
- expect(err).to match(/The following gems are missing/)
+ it "returns false" do
+ expect(exitstatus).to eq(1) if exitstatus
+ expect(err).to match(/The following gems are missing/)
+ end
end
end
diff --git a/spec/other/major_deprecation_spec.rb b/spec/other/major_deprecation_spec.rb
index 260a2cc55b..d1e3cf87f4 100644
--- a/spec/other/major_deprecation_spec.rb
+++ b/spec/other/major_deprecation_spec.rb
@@ -95,6 +95,28 @@ RSpec.describe "major deprecations" do
end
end
+ context "bundle check --path" do
+ before do
+ install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
+ gem "rack"
+ G
+
+ bundle "check --path vendor/bundle"
+ end
+
+ it "should print a deprecation warning", :bundler => "2" do
+ expect(deprecations).to include(
+ "The `--path` flag is deprecated because it relies on being " \
+ "remembered accross bundler invokations, which bundler will no " \
+ "longer do in future versions. Instead please use `bundle config set " \
+ "path 'vendor/bundle'`, and stop using this flag"
+ )
+ end
+
+ pending "should fail with a helpful error", :bundler => "3"
+ end
+
describe "bundle config" do
describe "old list interface" do
before do
@@ -290,7 +312,7 @@ RSpec.describe "major deprecations" do
"The `#{flag_name}` flag is deprecated because it relies on " \
"being remembered accross bundler invokations, which bundler " \
"will no longer do in future versions. Instead please use " \
- "`bundle config #{name} '#{value}'`, and stop using this flag"
+ "`bundle config set #{name} '#{value}'`, and stop using this flag"
)
end