summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAsutosh Palai <asupalai@gmail.com>2016-08-04 21:48:34 +0530
committerAsutosh Palai <asupalai@gmail.com>2016-08-16 09:48:27 +0530
commit7a82c290fef0f6ef2f14127e3a186da41da95666 (patch)
tree0a614048f48a60648f315ebf7578909fbabcca01
parent7a0c4b01e54b94a70a738f122e8d6a936755524f (diff)
downloadbundler-7a82c290fef0f6ef2f14127e3a186da41da95666.tar.gz
Added doc comments
-rw-r--r--lib/bundler/plugin.rb8
-rw-r--r--lib/bundler/plugin/index.rb1
2 files changed, 9 insertions, 0 deletions
diff --git a/lib/bundler/plugin.rb b/lib/bundler/plugin.rb
index bf1996e36a..1782d47e6e 100644
--- a/lib/bundler/plugin.rb
+++ b/lib/bundler/plugin.rb
@@ -145,10 +145,18 @@ module Bundler
src.new(locked_opts.merge("uri" => locked_opts["remote"]))
end
+ # To be called via the API to register a hooks and corresponding block that
+ # will be called to handle the hook
def add_hook(event, &block)
@hooks_by_event[event.to_s] << block
end
+ # Runs all the hooks that are registered for the passed event
+ #
+ # It passes the passed arguments and block to the block registered with
+ # the api.
+ #
+ # @param [String] event
def hook(event, *args, &arg_blk)
plugins = index.hook_plugins(event)
return unless plugins.any?
diff --git a/lib/bundler/plugin/index.rb b/lib/bundler/plugin/index.rb
index 0b4769f542..7f89d26178 100644
--- a/lib/bundler/plugin/index.rb
+++ b/lib/bundler/plugin/index.rb
@@ -101,6 +101,7 @@ module Bundler
@sources[name]
end
+ # Returns the list of plugin names handling the passed event
def hook_plugins(event)
@hooks[event] || []
end