# File lib/puppet/provider/package/sun.rb, line 16
16:     def self.instances
17:         packages = []
18:         hash = {}
19:         names = {
20:             "PKGINST" => :name,
21:             "NAME" => nil,
22:             "CATEGORY" => :category,
23:             "ARCH" => :platform,
24:             "VERSION" => :ensure,
25:             "BASEDIR" => :root,
26:             "HOTLINE" => nil,
27:             "EMAIL" => nil,
28:             "VENDOR" => :vendor,
29:             "DESC" => :description,
30:             "PSTAMP" => nil,
31:             "INSTDATE" => nil,
32:             "STATUS" => nil,
33:             "FILES" => nil
34:         }
35: 
36:         cmd = "#{command(:pkginfo)} -l"
37: 
38:         # list out all of the packages
39:         execpipe(cmd) { |process|
40:             # we're using the long listing, so each line is a separate
41:             # piece of information
42:             process.each { |line|
43:                 case line
44:                 when /^$/
45:                     hash[:provider] = :sun
46: 
47:                     packages << new(hash)
48:                     hash = {}
49:                 when /\s*(\w+):\s+(.+)/
50:                     name = $1
51:                     value = $2
52:                     if names.include?(name)
53:                         unless names[name].nil?
54:                             hash[names[name]] = value
55:                         end
56:                     end
57:                 when /\s+\d+.+/
58:                     # nothing; we're ignoring the FILES info
59:                 end
60:             }
61:         }
62:         return packages
63:     end