Differentiate between identically named repositories

This commit is contained in:
Adam Sanderson 2011-01-01 14:07:07 -07:00
parent 320133c4a5
commit b16af67f73
2 changed files with 14 additions and 3 deletions

View File

@ -18,8 +18,19 @@ module Qwandry
packages.concat(repo.scan(pattern)) packages.concat(repo.scan(pattern))
end end
differentiate packages
packages packages
end end
def differentiate(packages)
named_groups = Hash.new{|h,k| h[k] = []}
packages.each{|p| named_groups[p.name] << p }
named_groups.each do |name, packages|
if packages.length > 1
packages.each{|p| p.name = "#{p.name} (#{p.paths.first})"}
end
end
end
# Launches a Package or path represented by a String. Unless `editor` will # Launches a Package or path represented by a String. Unless `editor` will
# check against the environment by default. # check against the environment by default.

View File

@ -1,8 +1,8 @@
module Qwandry module Qwandry
class Package class Package
attr_reader :name attr_accessor :name
attr_reader :paths attr_accessor :paths
attr_reader :repository attr_reader :repository
def initialize(name, paths, repository) def initialize(name, paths, repository)
@name = name @name = name