# File lib/puppet/provider/package/ports.rb, line 30
30:     def latest
31:         cmd = ["-v", @resource[:name]]
32: 
33:         begin
34:             output = portversion(*cmd)
35:         rescue Puppet::ExecutionFailure
36:             raise Puppet::Error.new(output)
37:         end
38:         line = output.split("\n").pop
39: 
40:         unless line =~ /^(\S+)\s+(\S)\s+(.+)$/
41:             # There's no "latest" version, so just return a placeholder
42:             return :latest
43:         end
44: 
45:         pkgstuff = $1
46:         match = $2
47:         info = $3
48: 
49:         unless pkgstuff =~ /^(\S+)-([^-\s]+)$/
50:             raise Puppet::Error,
51:                 "Could not match package info '%s'" % pkgstuff
52:         end
53: 
54:         name, version = $1, $2
55: 
56:         if match == "=" or match == ">"
57:             # we're up to date or more recent
58:             return version
59:         end
60: 
61:         # Else, we need to be updated; we need to pull out the new version
62: 
63:         unless info =~ /\((\w+) has (.+)\)/
64:             raise Puppet::Error,
65:                 "Could not match version info '%s'" % info
66:         end
67: 
68:         source, newversion = $1, $2
69: 
70:         debug "Newer version in %s" % source
71:         return newversion
72:     end