From 62dd38d5d624e66b2dd117dfc848987cf0238597 Mon Sep 17 00:00:00 2001 From: Bundlerbot Date: Tue, 5 Nov 2019 15:08:35 +0000 Subject: [PATCH] Merge #7398 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 7398: Remove unnecessary lines from `bundler/setup` r=deivid-rodriguez a=deivid-rodriguez ### What was the end-user problem that led to this PR? These lines in the `bundler/setup` file are not necessary. ### What was your diagnosis of the problem? Bundler no longer needs to be in the `$LOAD_PATH` once a version of itself has been loaded. In any case, the `Metadata` source takes care of adding `bundler` to the index: https://github.com/bundler/bundler/blob/e70643c1be3a4417bd537d7e63470265465e693e/lib/bundler/source/metadata.rb#L13-L30 and then that spec is added to the resolution here: https://github.com/bundler/bundler/blob/e70643c1be3a4417bd537d7e63470265465e693e/lib/bundler/definition.rb#L180-L184 And from the resulting set of specs, the `$LOAD_PATH` is setup: https://github.com/bundler/bundler/blob/e70643c1be3a4417bd537d7e63470265465e693e/lib/bundler/runtime.rb#L25-L38 So `bundler` will be present in the `$LOAD_PATH` anyways, and the lines being removed here will never be useful. ### What is your fix for the problem, implemented in this PR? My fix is to remove these lines to make the code easier to follow. Co-authored-by: David Rodríguez (cherry picked from commit bf7df421ee6311fcc17e6dc46d204236f33b4b3f) --- lib/bundler/setup.rb | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib/bundler/setup.rb b/lib/bundler/setup.rb index b9a2f8f1dac..70a0968f4b0 100644 --- a/lib/bundler/setup.rb +++ b/lib/bundler/setup.rb @@ -19,8 +19,4 @@ else Bundler.ui.silence { Bundler.setup } end - - # Add bundler to the load path after disabling system gems - bundler_lib = File.expand_path("../..", __FILE__) - $LOAD_PATH.unshift(bundler_lib) unless $LOAD_PATH.include?(bundler_lib) end