diff options
Diffstat (limited to 'lib/bundler/plugin/index.rb')
-rw-r--r-- | lib/bundler/plugin/index.rb | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/lib/bundler/plugin/index.rb b/lib/bundler/plugin/index.rb index 29d33be718..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 @@ -167,11 +175,11 @@ module Bundler # to be only String key value pairs) def save_index index = { - "commands" => @commands, - "hooks" => @hooks, - "load_paths" => @load_paths, + "commands" => @commands, + "hooks" => @hooks, + "load_paths" => @load_paths, "plugin_paths" => @plugin_paths, - "sources" => @sources, + "sources" => @sources, } require_relative "../yaml_serializer" |