summaryrefslogtreecommitdiff
path: root/lib/bundler/plugin.rb
diff options
context:
space:
mode:
authorAsutosh Palai <asupalai@gmail.com>2016-05-24 11:38:09 +0530
committerAsutosh Palai <asupalai@gmail.com>2016-05-24 21:15:01 +0530
commitc34633e591f35c3506bbec6515ee2ba33e7ee024 (patch)
tree616d8c93643b9b8d8fcfb6366fcd30fa6af4ddef /lib/bundler/plugin.rb
parent867e2d9c6cfc033f689340c2c592db9119dcaa8c (diff)
downloadbundler-c34633e591f35c3506bbec6515ee2ba33e7ee024.tar.gz
Added spec helper to build plugin
Diffstat (limited to 'lib/bundler/plugin.rb')
-rw-r--r--lib/bundler/plugin.rb12
1 files changed, 5 insertions, 7 deletions
diff --git a/lib/bundler/plugin.rb b/lib/bundler/plugin.rb
index ad20094db7..5c6ba5dd00 100644
--- a/lib/bundler/plugin.rb
+++ b/lib/bundler/plugin.rb
@@ -1,11 +1,10 @@
-#frozen_string_literal: true
+# frozen_string_literal: true
module Bundler
class Plugin
autoload :Index, "bundler/plugin/index"
class << self
-
# Installs a new plugin by the given name
#
#
@@ -34,10 +33,9 @@ module Bundler
# @param [Pathname] plugin_path the path plugin is installed at
#
# @raise [Error] if plugin.rb file is not found
- def validate_plugin! plugin_path
- unless File.file? plugin_path.join("plugin.rb")
- raise "plugin.rb was not found in the plugin gem!"
- end
+ def validate_plugin!(plugin_path)
+ plugin_file = plugin_path.join("plugin.rb")
+ raise "plugin.rb was not found in the plugin!" unless plugin_file.file?
end
# Runs the plugin.rb file, records the plugin actions it registers for and
@@ -45,7 +43,7 @@ module Bundler
#
# @param [String] name the name of the plugin
# @param [Pathname] path the path where the plugin is installed at
- def register_plugin name, path
+ def register_plugin(name, path)
require path.join("plugin.rb") # this shall latter be used to find the actions the plugin performs
index.register_plugin name, path.to_s