summaryrefslogtreecommitdiff
path: root/lib/bundler/plugin/index.rb
diff options
context:
space:
mode:
authorAsutosh Palai <asupalai@gmail.com>2016-06-06 23:19:53 +0530
committerAsutosh Palai <asupalai@gmail.com>2016-06-06 23:19:55 +0530
commita11695e7c6e1c7bc7359c2c68f5f835a8117b7f3 (patch)
tree5105b41326d86bcfd1f3d7b3e4b2f77b4eb849a4 /lib/bundler/plugin/index.rb
parent214d3d0c33751b206c37dd618db2f0deede1744c (diff)
downloadbundler-a11695e7c6e1c7bc7359c2c68f5f835a8117b7f3.tar.gz
Added Error class for command conflict error
Diffstat (limited to 'lib/bundler/plugin/index.rb')
-rw-r--r--lib/bundler/plugin/index.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/bundler/plugin/index.rb b/lib/bundler/plugin/index.rb
index b276bfdf4f..19874a8f74 100644
--- a/lib/bundler/plugin/index.rb
+++ b/lib/bundler/plugin/index.rb
@@ -6,6 +6,13 @@ module Bundler
# now a stub class).
module Plugin
class Index
+ class CommandConflict < PluginError
+ def initialize(plugin, commands)
+ msg = "Command(s) `#{commands.join("`, `")}` declared by #{plugin} are already registered."
+ super msg
+ end
+ end
+
def initialize
@plugin_paths = {}
@commands = {}
@@ -23,7 +30,7 @@ module Bundler
@plugin_paths[name] = path
common = commands & @commands.keys
- raise "Command(s) #{common.join(", ")} are already registered" if common.any?
+ raise CommandConflict.new(name, common) if common.any?
commands.each {|c| @commands[c] = name }
save_index