diff options
author | Asutosh Palai <asupalai@gmail.com> | 2016-05-31 17:55:18 +0530 |
---|---|---|
committer | Asutosh Palai <asupalai@gmail.com> | 2016-05-31 18:01:10 +0530 |
commit | b1621fbc91587ae46f2ea0dc3be4e6b0d4858b48 (patch) | |
tree | 502af4eaf08687e749311ba49d8a3d4f9b276290 /lib | |
parent | 0b99d2896539d5be35d04630115504f524425240 (diff) | |
download | bundler-b1621fbc91587ae46f2ea0dc3be4e6b0d4858b48.tar.gz |
Added spec for plugin api
Diffstat (limited to 'lib')
-rw-r--r-- | lib/bundler/plugin.rb | 4 | ||||
-rw-r--r-- | lib/bundler/plugin/api.rb | 15 | ||||
-rw-r--r-- | lib/bundler/plugin/index.rb | 2 |
3 files changed, 14 insertions, 7 deletions
diff --git a/lib/bundler/plugin.rb b/lib/bundler/plugin.rb index fb577ad6bc..c888dbcd97 100644 --- a/lib/bundler/plugin.rb +++ b/lib/bundler/plugin.rb @@ -92,7 +92,6 @@ module Bundler # At present it only checks whether it contains plugin.rb file # # @param [Pathname] plugin_path the path plugin is installed at - # # @raise [Error] if plugin.rb file is not found def validate_plugin!(plugin_path) plugin_file = plugin_path.join(PLUGIN_FILE_NAME) @@ -116,6 +115,9 @@ module Bundler @commands = commands end + # Executes the plugin.rb file + # + # @param [String] name of the plugin def load_plugin(name) # Need to ensure before this that plugin root where the rest of gems # are installed to be on load path to support plugin deps. Currently not diff --git a/lib/bundler/plugin/api.rb b/lib/bundler/plugin/api.rb index 93b17fd8e8..ea9ff1ea12 100644 --- a/lib/bundler/plugin/api.rb +++ b/lib/bundler/plugin/api.rb @@ -8,6 +8,13 @@ module Bundler # interactions to methods of this class only. This will save them from breaking # when some internal change. # + # Currently we are delegating the methods defined in Bundler class to + # itself. So, this class acts as a buffer. + # + # If there is some change in the Bundler class that is incompatible to its + # previous behavior or if otherwise desired, we can reimplement(or implement) + # the method to preserve compatibility. + # # To use this, either the class can inherit this class or use it directly. # For example of both types of use, refer the file `spec/plugins/command.rb` # @@ -39,11 +46,9 @@ module Bundler Bundler.tmp(File.join(["plugin", name])) end - # The bundler settings - # - # @return [Bundler::Setting] setting object of bundler - def settings - Bundler.settings + def method_missing(name, *args, &blk) + super unless Bundler.respond_to?(name) + Bundler.send(name, *args, &blk) end end end diff --git a/lib/bundler/plugin/index.rb b/lib/bundler/plugin/index.rb index 5db8662bdc..26ba4ae3e2 100644 --- a/lib/bundler/plugin/index.rb +++ b/lib/bundler/plugin/index.rb @@ -24,7 +24,7 @@ module Bundler common = commands & @commands.keys raise "Command(s) #{common.join(", ")} are already registered" if common.any? - commands.each{|c| @commands[c] = name } + commands.each {|c| @commands[c] = name } save_index end |