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/index.rb | |
parent | c34633e591f35c3506bbec6515ee2ba33e7ee024 (diff) | |
download | bundler-cb66151d1f8ebe788ed4a605e9bfc13f451dbe1f.tar.gz |
Structured the classes with private methods
Diffstat (limited to 'lib/bundler/plugin/index.rb')
-rw-r--r-- | lib/bundler/plugin/index.rb | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/lib/bundler/plugin/index.rb b/lib/bundler/plugin/index.rb index 87a9de9acb..0fc70af27a 100644 --- a/lib/bundler/plugin/index.rb +++ b/lib/bundler/plugin/index.rb @@ -12,6 +12,24 @@ module Bundler load_index end + # This function is to be called when a new plugin is installed. This function shall add + # the functions of the plugin to existing maps and also the name to source location. + # + # @param [String] name of the plugin to be registered + # @param [String] path where the plugin is installed + def register_plugin(name, path) + @plugin_sources[name] = path + + save_index + end + + # Path where the index file is stored + def index_file + Plugin.root.join("index") + end + + private + # Reads the index file from the directory and initializes the instance variables. def load_index SharedHelpers.filesystem_access(index_file, :read) do |index_f| @@ -34,21 +52,5 @@ module Bundler File.open(index_f, "w") {|f| f.puts YAML.dump(index) } end end - - # This function is to be called when a new plugin is installed. This function shall add - # the functions of the plugin to existing maps and also the name to source location. - # - # @param [String] name of the plugin to be registered - # @param [String] path where the plugin is installed - def register_plugin(name, path) - @plugin_sources[name] = path - - save_index - end - - # Path where the index file is stored - def index_file - Plugin.root.join("index") - end end end |