summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Lance <stefan@lances.net>2015-06-27 10:08:52 -0400
committerSamuel E. Giddins <segiddins@segiddins.me>2015-07-16 08:35:41 -0700
commitf806564a9d5752044fa7f89b33d1ea386d01c9dc (patch)
tree9f087d7283f4712c9c3db2638807ea8427d8f740
parent18ccd1d80f969e0e778535806f9414cf94e9166e (diff)
downloadbundler-f806564a9d5752044fa7f89b33d1ea386d01c9dc.tar.gz
Add deprecation warning & spec for not autoremembering flags
-rw-r--r--lib/bundler/cli.rb7
-rw-r--r--lib/bundler/settings.rb6
-rw-r--r--spec/deprecation_spec.rb23
3 files changed, 24 insertions, 12 deletions
diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb
index cdccdf8e3e..d20b121a7e 100644
--- a/lib/bundler/cli.rb
+++ b/lib/bundler/cli.rb
@@ -15,7 +15,6 @@ module Bundler
def initialize(*args)
super
-
custom_gemfile = options[:gemfile] || Bundler.settings[:gemfile]
ENV["BUNDLE_GEMFILE"] = File.expand_path(custom_gemfile) if custom_gemfile
@@ -27,6 +26,7 @@ module Bundler
raise InvalidOption, e.message
ensure
self.options ||= {}
+ Bundler.settings[:given_flags] = given_flags?
Bundler.ui = UI::Shell.new(options)
Bundler.ui.level = "debug" if options["verbose"]
end
@@ -408,6 +408,11 @@ module Bundler
private
+
+ def given_flags?
+ !self.options.empty?
+ end
+
# Automatically invoke `bundle install` and resume if
# Bundler.settings[:auto_install] exists. This is set through config cmd
# `bundle config auto_install 1`.
diff --git a/lib/bundler/settings.rb b/lib/bundler/settings.rb
index a4f2a9cf84..61515a1787 100644
--- a/lib/bundler/settings.rb
+++ b/lib/bundler/settings.rb
@@ -27,6 +27,12 @@ module Bundler
end
def []=(key, value)
+ if self[:given_flags]
+ Bundler.ui.deprecate "Starting in Bundler 2.0, flags passed to commands "\
+ "will no longer be automatically remembered. Instead please set flags " \
+ "you want remembered between commands using `bundle config "\
+ "<setting name> <setting value>`."
+ end
local_config_file or raise GemfileNotFound, "Could not locate Gemfile"
set_key(key, value, @local_config, local_config_file)
end
diff --git a/spec/deprecation_spec.rb b/spec/deprecation_spec.rb
index 19c6514235..7ef0351b59 100644
--- a/spec/deprecation_spec.rb
+++ b/spec/deprecation_spec.rb
@@ -2,17 +2,6 @@ require "spec_helper"
describe "Bundler version 1.99" do
context "when bundle is run" do
- it "should print a single deprecation warning" do
- install_gemfile <<-G
- source "file://#{gem_repo1}"
- gem "rack"
- G
-
- expect(err).to eq("DEPRECATION: Gemfile and Gemfile.lock are " \
- "deprecated and will be replaced with gems.rb and gems.locked in " \
- "Bundler 2.0.")
- end
-
it "should not warn about gems.rb" do
create_file "gems.rb", <<-G
source "file://#{gem_repo1}"
@@ -22,6 +11,18 @@ describe "Bundler version 1.99" do
bundle :install
expect(err).to lack_errors
end
+
+ context "with flags" do
+ it "should print a deprecation warning about autoremembering flags" do
+ install_gemfile <<-G, :path => "vendor/bundle"
+ source "file://#{gem_repo1}"
+ gem "rack"
+ G
+
+ expect(err).to include("DEPRECATION")
+ expect(err).to include("flags passed to commands will no longer be automatically remembered.")
+ end
+ end
end
context "when Bundler.setup is run in a ruby script" do