15: def self.gemlist(hash)
16: command = [command(:gemcmd), "list"]
17:
18: if hash[:local]
19: command << "--local"
20: else
21: command << "--remote"
22: end
23:
24: if name = hash[:justme]
25: command << name
26: end
27:
28: begin
29: list = execute(command).split("\n").collect do |set|
30: if gemhash = gemsplit(set)
31: gemhash[:provider] = :gem
32: gemhash
33: else
34: nil
35: end
36: end.compact
37: rescue Puppet::ExecutionFailure => detail
38: raise Puppet::Error, "Could not list gems: %s" % detail
39: end
40:
41: if hash[:justme]
42: return list.shift
43: else
44: return list
45: end
46: end