summaryrefslogtreecommitdiff
path: root/lib/bundler/plugin/index.rb
diff options
context:
space:
mode:
authorAsutosh Palai <asupalai@gmail.com>2016-06-16 21:05:36 +0530
committerAsutosh Palai <asupalai@gmail.com>2016-07-03 09:40:59 +0530
commitdefd15ba97236b56f0c3c1a754cf8f4ae846bc3a (patch)
tree216eb317e988e8dbd2971a07d57453877c292e68 /lib/bundler/plugin/index.rb
parent16a51aa6f58f12471bfa96aeb48b11bc73b76025 (diff)
downloadbundler-defd15ba97236b56f0c3c1a754cf8f4ae846bc3a.tar.gz
Added source conflict error class
Diffstat (limited to 'lib/bundler/plugin/index.rb')
-rw-r--r--lib/bundler/plugin/index.rb11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/bundler/plugin/index.rb b/lib/bundler/plugin/index.rb
index 1b123e2a74..096390bac9 100644
--- a/lib/bundler/plugin/index.rb
+++ b/lib/bundler/plugin/index.rb
@@ -13,6 +13,13 @@ module Bundler
end
end
+ class SourceConflict < PluginError
+ def initialize(plugin, sources)
+ msg = "Source(s) `#{sources.join("`, `")}` declared by #{plugin} are already registered."
+ super msg
+ end
+ end
+
def initialize
@plugin_paths = {}
@commands = {}
@@ -32,8 +39,8 @@ module Bundler
raise CommandConflict.new(name, common) unless common.empty?
commands.each {|c| @commands[c] = name }
- com = sources & @sources.keys
- raise "Source(s) #{com.join(", ")} are already registered" if com.any?
+ common = sources & @sources.keys
+ raise SourceConflict.new(name, common) unless common.empty?
sources.each {|k| @sources[k] = name }
@plugin_paths[name] = path