# 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:             hash[names[name]] = value unless names[name].nil?
54:           end
55:         when /\s+\d+.+/
56:           # nothing; we're ignoring the FILES info
57:         end
58:       }
59:     }
60:     packages
61:   end