diff options
| author | Asutosh Palai <asupalai@gmail.com> | 2016-07-15 13:50:48 +0530 |
|---|---|---|
| committer | Asutosh Palai <asupalai@gmail.com> | 2016-07-21 09:53:08 +0530 |
| commit | 2b6400a6d8cbccf2e917d993dd50e4cc1269d9ad (patch) | |
| tree | 167e0f81aed75aac23362b02cc959eec0b190e9e /lib/bundler/plugin.rb | |
| parent | 2a138ed736b2210a21588db44b567dbdea6f7a18 (diff) | |
| download | bundler-2b6400a6d8cbccf2e917d993dd50e4cc1269d9ad.tar.gz | |
Adding app index for plugin
Diffstat (limited to 'lib/bundler/plugin.rb')
| -rw-r--r-- | lib/bundler/plugin.rb | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/lib/bundler/plugin.rb b/lib/bundler/plugin.rb index f5366d2a13..64cdf94a11 100644 --- a/lib/bundler/plugin.rb +++ b/lib/bundler/plugin.rb @@ -63,9 +63,25 @@ module Bundler @index ||= Index.new end - # The directory root to all plugin related data + # The directory root for all plugin related data + # + # Points to root in app_config_path if ran in an app else points to the one + # in user_bundle_path def root - @root ||= Bundler.user_bundle_path.join("plugin") + @root ||= if SharedHelpers.in_bundle? + local_root + else + global_root + end + end + + def local_root + Bundler.app_config_path.join("plugin") + end + + # The global directory root for all plugin related data + def global_root + Bundler.user_bundle_path.join("plugin") end # The cache directory for plugin stuffs @@ -128,6 +144,14 @@ module Bundler Index.new.installed?(plugin) end + # Used by specs + def reset! + instance_variables.each {|i| remove_instance_variable(i)} + + @sources = {} + @commands = {} + end + # Post installation processing and registering with index # # @param [Array<String>] plugins list to be installed |
