summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Arko <andre@arko.net>2015-05-05 14:42:41 -0700
committerSamuel Giddins <segiddins@segiddins.me>2016-07-05 15:11:19 -0300
commit2ecbd10ea9be8da65859a6a19d54fe3e2185a075 (patch)
treec30b2e8f5eeb520c990b8cb4caedc82830267999
parent336585833fe152a93702b518d49b8c7dc9676fdc (diff)
downloadbundler-2ecbd10ea9be8da65859a6a19d54fe3e2185a075.tar.gz
do not deprecate gems.rb, lol
-rw-r--r--lib/bundler/shared_helpers.rb14
-rw-r--r--spec/deprecation_spec.rb15
2 files changed, 23 insertions, 6 deletions
diff --git a/lib/bundler/shared_helpers.rb b/lib/bundler/shared_helpers.rb
index e28e93100f..69f1e85e84 100644
--- a/lib/bundler/shared_helpers.rb
+++ b/lib/bundler/shared_helpers.rb
@@ -21,10 +21,8 @@ module Bundler
attr_accessor :gem_loaded
def default_gemfile
- Bundler.ui.deprecate("Gemfile and Gemfile.lock are " \
- "deprecated and will be replaced with gems.rb and " \
- "gems.locked in Bundler 2.0.0.\n")
gemfile = find_gemfile
+ deprecate_gemfile(gemfile)
raise GemfileNotFound, "Could not locate Gemfile" unless gemfile
Pathname.new(gemfile)
end
@@ -232,6 +230,16 @@ module Bundler
true
end
+ def deprecate_gemfile(gemfile)
+ if gemfile && File.basename(gemfile) == "Gemfile"
+ Bundler.respond_to?(:ui) && Bundler.ui.deprecate(
+ "Gemfile and Gemfile.lock are " \
+ "deprecated and will be replaced with gems.rb and " \
+ "gems.locked in Bundler 2.0.\n"
+ )
+ end
+ end
+
extend self
end
end
diff --git a/spec/deprecation_spec.rb b/spec/deprecation_spec.rb
index a559b5d995..d9bb5b6bb4 100644
--- a/spec/deprecation_spec.rb
+++ b/spec/deprecation_spec.rb
@@ -4,7 +4,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 calls `bundle :install, opts`
install_gemfile <<-G
source "file://#{gem_repo1}"
gem "rack"
@@ -12,7 +11,17 @@ describe "Bundler version 1.99" do
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.0.")
+ "Bundler 2.0.")
+ end
+
+ it "should not warn about gems.rb" do
+ create_file "gems.rb", <<-G
+ source "file://#{gem_repo1}"
+ gem "rack"
+ G
+
+ bundle :install
+ expect(err).to lack_errors
end
end
@@ -35,7 +44,7 @@ describe "Bundler version 1.99" do
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.0.")
+ "Bundler 2.0.")
end
end