diff options
author | David RodrÃguez <deivid.rodriguez@riseup.net> | 2019-04-10 17:02:02 +0200 |
---|---|---|
committer | David RodrÃguez <deivid.rodriguez@riseup.net> | 2019-04-11 15:29:38 +0200 |
commit | 147ff3f0f88bdf74791122ea31463c98a20bad06 (patch) | |
tree | 47753db00c678da578c65a45f2363d4e76561b61 | |
parent | b711410759259c863709a585117804ee8b69e2b7 (diff) | |
download | bundler-init_gems_rb.tar.gz |
Remove `prefer_gems_rb` settinginit_gems_rb
In my opinion, it's overkill to provide a setting for how little this
setting was doing. Both types of Gemfile are supported and work
regardless of this setting. The only difference this setting would make
is the warning message one would get when having _both_ types of
Gemfiles in the same project.
I changed things so that gems.rb is always looked up first, and the
warning message in case you have both always tells you to remove Gemfile
and Gemfile.lock.
-rw-r--r-- | lib/bundler/feature_flag.rb | 1 | ||||
-rw-r--r-- | lib/bundler/settings.rb | 1 | ||||
-rw-r--r-- | lib/bundler/shared_helpers.rb | 16 | ||||
-rw-r--r-- | man/bundle-config.ronn | 2 | ||||
-rw-r--r-- | spec/install/gemfile_spec.rb | 16 | ||||
-rw-r--r-- | spec/other/major_deprecation_spec.rb | 24 | ||||
-rw-r--r-- | spec/update/gemfile_spec.rb | 17 |
7 files changed, 7 insertions, 70 deletions
diff --git a/lib/bundler/feature_flag.rb b/lib/bundler/feature_flag.rb index 2b46fc0b1d..2be922ea60 100644 --- a/lib/bundler/feature_flag.rb +++ b/lib/bundler/feature_flag.rb @@ -44,7 +44,6 @@ module Bundler settings_flag(:only_update_to_newer_versions) { bundler_3_mode? } settings_flag(:path_relative_to_cwd) { bundler_3_mode? } settings_flag(:plugins) { @bundler_version >= Gem::Version.new("1.14") } - settings_flag(:prefer_gems_rb) { bundler_3_mode? } settings_flag(:print_only_version_number) { bundler_3_mode? } settings_flag(:setup_makes_kernel_gem_public) { !bundler_3_mode? } settings_flag(:skip_default_git_sources) { bundler_4_mode? } diff --git a/lib/bundler/settings.rb b/lib/bundler/settings.rb index bdd15fe675..5bc190865f 100644 --- a/lib/bundler/settings.rb +++ b/lib/bundler/settings.rb @@ -45,7 +45,6 @@ module Bundler path_relative_to_cwd path.system plugins - prefer_gems_rb prefer_patch print_only_version_number setup_makes_kernel_gem_public diff --git a/lib/bundler/shared_helpers.rb b/lib/bundler/shared_helpers.rb index 5d9e1c24e7..1b703c5cbc 100644 --- a/lib/bundler/shared_helpers.rb +++ b/lib/bundler/shared_helpers.rb @@ -149,13 +149,9 @@ module Bundler break gemfiles.size != 1 end return unless multiple_gemfiles - diagnosis = "Multiple gemfiles (gems.rb and Gemfile) detected." - advice = if Bundler.feature_flag.prefer_gems_rb? - "Make sure you remove Gemfile and Gemfile.lock since bundler is ignoring them in favor of gems.rb and gems.rb.locked." - else - "The gems.rb and gems.rb.locked files are currently ignored, but they will get used as soon as you delete your Gemfile and Gemfile.lock files." - end - Bundler.ui.warn [diagnosis, advice].join(" ") + message = "Multiple gemfiles (gems.rb and Gemfile) detected. " \ + "Make sure you remove Gemfile and Gemfile.lock since bundler is ignoring them in favor of gems.rb and gems.rb.locked." + Bundler.ui.warn message end def trap(signal, override = false, &block) @@ -235,13 +231,11 @@ module Bundler def find_gemfile(order_matters = false) given = ENV["BUNDLE_GEMFILE"] return given if given && !given.empty? - names = gemfile_names - names.reverse! if order_matters && Bundler.feature_flag.prefer_gems_rb? - find_file(*names) + find_file(*gemfile_names) end def gemfile_names - ["Gemfile", "gems.rb"] + ["gems.rb", "Gemfile"] end def find_file(*names) diff --git a/man/bundle-config.ronn b/man/bundle-config.ronn index 4e717b4b69..86c4e21819 100644 --- a/man/bundle-config.ronn +++ b/man/bundle-config.ronn @@ -232,8 +232,6 @@ learn more about their operation in [bundle install(1)](bundle-install.1.html). Makes `--path` relative to the CWD instead of the `Gemfile`. * `plugins` (`BUNDLE_PLUGINS`): Enable Bundler's experimental plugin system. -* `prefer_gems_rb` (`BUNDLE_PREFER_GEMS_RB`) - Prefer `gems.rb` to `Gemfile` when Bundler is searching for a Gemfile. * `prefer_patch` (BUNDLE_PREFER_PATCH): Prefer updating only to next patch version during updates. Makes `bundle update` calls equivalent to `bundler update --patch`. * `print_only_version_number` (`BUNDLE_PRINT_ONLY_VERSION_NUMBER`) diff --git a/spec/install/gemfile_spec.rb b/spec/install/gemfile_spec.rb index a9ab67951f..c26fbd74e7 100644 --- a/spec/install/gemfile_spec.rb +++ b/spec/install/gemfile_spec.rb @@ -68,22 +68,6 @@ RSpec.describe "bundle install" do end end - context "with prefer_gems_rb set" do - before { bundle! "config set prefer_gems_rb true" } - - it "prefers gems.rb to Gemfile" do - create_file("gems.rb", "gem 'bundler'") - create_file("Gemfile", "raise 'wrong Gemfile!'") - - bundle! :install - - expect(bundled_app("gems.rb")).to be_file - expect(bundled_app("Gemfile.lock")).not_to be_file - - expect(the_bundle).to include_gem "bundler #{Bundler::VERSION}" - end - end - context "with engine specified in symbol" do it "does not raise any error parsing Gemfile" do simulate_ruby_version "2.3.0" do diff --git a/spec/other/major_deprecation_spec.rb b/spec/other/major_deprecation_spec.rb index e017c46dfd..83944e4075 100644 --- a/spec/other/major_deprecation_spec.rb +++ b/spec/other/major_deprecation_spec.rb @@ -240,21 +240,7 @@ RSpec.describe "major deprecations" do expect(deprecations).to be_empty end - it "should print a proper warning, and use Gemfile", :bundler => "2" do - create_file "gems.rb" - install_gemfile! <<-G - source "file://#{gem_repo1}" - gem "rack" - G - - expect(warnings).to include( - "Multiple gemfiles (gems.rb and Gemfile) detected. The gems.rb and gems.rb.locked files are currently ignored, but they will get used as soon as you delete your Gemfile and Gemfile.lock files." - ) - - expect(the_bundle).to include_gem "rack 1.0" - end - - it "should print a proper warning, and use gems.rb", :bundler => "3" do + it "should print a proper warning, and use gems.rb" do create_file "gems.rb" install_gemfile! <<-G source "file://#{gem_repo1}" @@ -354,13 +340,7 @@ RSpec.describe "major deprecations" do RUBY end - it "should print a single deprecation warning", :bundler => "< 3" do - expect(warnings).to include( - "Multiple gemfiles (gems.rb and Gemfile) detected. The gems.rb and gems.rb.locked files are currently ignored, but they will get used as soon as you delete your Gemfile and Gemfile.lock files." - ) - end - - it "should print a single deprecation warning", :bundler => "3" do + it "should print a single deprecation warning" do expect(warnings).to include( "Multiple gemfiles (gems.rb and Gemfile) detected. Make sure you remove Gemfile and Gemfile.lock since bundler is ignoring them in favor of gems.rb and gems.rb.locked." ) diff --git a/spec/update/gemfile_spec.rb b/spec/update/gemfile_spec.rb index 190c871837..6c47c254cd 100644 --- a/spec/update/gemfile_spec.rb +++ b/spec/update/gemfile_spec.rb @@ -46,21 +46,4 @@ RSpec.describe "bundle update" do end end end - - context "with prefer_gems_rb set" do - before { bundle! "config set prefer_gems_rb true" } - - it "prefers gems.rb to Gemfile" do - create_file("gems.rb", "gem 'bundler'") - create_file("Gemfile", "raise 'wrong Gemfile!'") - - bundle! :install - bundle! :update, :all => true - - expect(bundled_app("gems.rb")).to be_file - expect(bundled_app("Gemfile.lock")).not_to be_file - - expect(the_bundle).to include_gem "bundler #{Bundler::VERSION}" - end - end end |