diff options
author | Asutosh Palai <asupalai@gmail.com> | 2016-05-24 20:34:00 +0530 |
---|---|---|
committer | Asutosh Palai <asupalai@gmail.com> | 2016-05-24 21:15:01 +0530 |
commit | cb66151d1f8ebe788ed4a605e9bfc13f451dbe1f (patch) | |
tree | 51bd2c61fb7e84dda5599a32f44e61ab34da4a77 /lib/bundler/plugin.rb | |
parent | c34633e591f35c3506bbec6515ee2ba33e7ee024 (diff) | |
download | bundler-cb66151d1f8ebe788ed4a605e9bfc13f451dbe1f.tar.gz |
Structured the classes with private methods
Diffstat (limited to 'lib/bundler/plugin.rb')
-rw-r--r-- | lib/bundler/plugin.rb | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/lib/bundler/plugin.rb b/lib/bundler/plugin.rb index 5c6ba5dd..b32d3d87 100644 --- a/lib/bundler/plugin.rb +++ b/lib/bundler/plugin.rb @@ -14,7 +14,7 @@ module Bundler # @option options [String] :version (optional) the version of the plugin to install def install(name, options) require "bundler/plugin/installer.rb" - plugin_path = Pathname.new Installer.install(name, options) + plugin_path = Pathname.new Installer.new.install(name, options) validate_plugin! plugin_path @@ -26,6 +26,23 @@ module Bundler Bundler.ui.error "Failed to install plugin #{name}: #{e.message}\n #{e.backtrace.join("\n ")}" end + # The index object used to store the details about the plugin + def index + @index ||= Index.new + end + + # The directory root to all plugin related data + def root + @root ||= Bundler.user_bundle_path.join("plugin") + end + + # The cache directory for plugin stuffs + def cache + @cache ||= root.join("cache") + end + + private + # Checks if the gem is good to be a plugin # # At present it only checks whether it contains plugin.rb file @@ -48,21 +65,6 @@ module Bundler index.register_plugin name, path.to_s end - - # The index object used to store the details about the plugin - def index - @index ||= Index.new - end - - # The directory root to all plugin related data - def root - @root ||= Bundler.user_bundle_path.join("plugin") - end - - # The cache directory for plugin stuffs - def cache - @cache ||= root.join("cache") - end end end end |