summaryrefslogtreecommitdiff
path: root/lib/bundler/cli/config.rb
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2022-02-28 10:32:28 +0900
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2022-02-28 11:39:20 +0900
commitff3d7b720ec21e4856aac0b3c493bc78cbac83d4 (patch)
tree5954bdfc783adb6060337b0f7dbb1589984e6291 /lib/bundler/cli/config.rb
parent02ead4a82eff7dd48153d6457929fe48f50e28df (diff)
Merge RubyGems and Bundler master
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/5606
Diffstat (limited to 'lib/bundler/cli/config.rb')
-rw-r--r--lib/bundler/cli/config.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/bundler/cli/config.rb b/lib/bundler/cli/config.rb
index 8d2aba0916..e1222c75dd 100644
--- a/lib/bundler/cli/config.rb
+++ b/lib/bundler/cli/config.rb
@@ -180,7 +180,7 @@ module Bundler
scopes = %w[global local].select {|s| options[s] }
case scopes.size
when 0
- @scope = "global"
+ @scope = inside_app? ? "local" : "global"
@explicit_scope = false
when 1
@scope = scopes.first
@@ -189,6 +189,15 @@ module Bundler
"The options #{scopes.join " and "} were specified. Please only use one of the switches at a time."
end
end
+
+ private
+
+ def inside_app?
+ Bundler.root
+ true
+ rescue GemfileNotFound
+ false
+ end
end
end
end