summaryrefslogtreecommitdiff
path: root/lib/bundler/plugin/index.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/bundler/plugin/index.rb')
-rw-r--r--lib/bundler/plugin/index.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/bundler/plugin/index.rb b/lib/bundler/plugin/index.rb
index 6fbd036f38..c2ab8f90da 100644
--- a/lib/bundler/plugin/index.rb
+++ b/lib/bundler/plugin/index.rb
@@ -136,6 +136,14 @@ module Bundler
@hooks[event] || []
end
+ # This plugin is installed inside the .bundle/plugin directory,
+ # and thus is managed solely by Bundler
+ def installed_in_plugin_root?(name)
+ return false unless (path = installed?(name))
+
+ path.start_with?("#{Plugin.root}/")
+ end
+
private
# Reads the index file from the directory and initializes the instance
@@ -146,7 +154,7 @@ module Bundler
# @param [Boolean] is the index file global index
def load_index(index_file, global = false)
SharedHelpers.filesystem_access(index_file, :read) do |index_f|
- valid_file = index_f && index_f.exist? && !index_f.size.zero?
+ valid_file = index_f&.exist? && !index_f.size.zero?
break unless valid_file
data = index_f.read