diff options
-rw-r--r-- | lib/bundler.rb | 8 | ||||
-rw-r--r-- | lib/bundler/shared_helpers.rb | 8 |
2 files changed, 7 insertions, 9 deletions
diff --git a/lib/bundler.rb b/lib/bundler.rb index 0d9a523310..93093f2e32 100644 --- a/lib/bundler.rb +++ b/lib/bundler.rb @@ -274,13 +274,7 @@ module Bundler end def root - @root ||= begin - SharedHelpers.root - rescue GemfileNotFound - bundle_dir = default_bundle_dir - raise GemfileNotFound, "Could not locate Gemfile or .bundle/ directory" unless bundle_dir - bundle_dir.parent - end + @root ||= SharedHelpers.root end def app_config_path diff --git a/lib/bundler/shared_helpers.rb b/lib/bundler/shared_helpers.rb index 6e83bc5ff4..94e6875f00 100644 --- a/lib/bundler/shared_helpers.rb +++ b/lib/bundler/shared_helpers.rb @@ -12,8 +12,12 @@ module Bundler module SharedHelpers def root gemfile = find_gemfile - raise GemfileNotFound, "Could not locate Gemfile" unless gemfile - Pathname.new(gemfile).tap{|x| x.untaint if RUBY_VERSION < "2.7" }.expand_path.parent + return Pathname.new(gemfile).tap{|x| x.untaint if RUBY_VERSION < "2.7" }.expand_path.parent if gemfile + + bundle_dir = default_bundle_dir + raise GemfileNotFound, "Could not locate Gemfile or .bundle/ directory" unless bundle_dir + + bundle_dir.parent end def default_gemfile |