From 43c1e1eeae52c2ab739a2898e506bf98b561ca9b Mon Sep 17 00:00:00 2001 From: Andre Arko Date: Tue, 5 May 2015 14:42:41 -0700 Subject: do not deprecate gems.rb, lol --- lib/bundler/shared_helpers.rb | 14 +++++++++++--- spec/deprecation_spec.rb | 15 ++++++++++++--- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/lib/bundler/shared_helpers.rb b/lib/bundler/shared_helpers.rb index e06881494b..87a0205299 100644 --- a/lib/bundler/shared_helpers.rb +++ b/lib/bundler/shared_helpers.rb @@ -20,10 +20,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 @@ -149,6 +147,16 @@ module Bundler end 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 d7df05bb43..19c6514235 100644 --- a/spec/deprecation_spec.rb +++ b/spec/deprecation_spec.rb @@ -3,7 +3,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" @@ -11,7 +10,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 @@ -34,7 +43,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 -- cgit v1.2.1