# File lib/puppet/parser/collector.rb, line 10
10:   def evaluate
11:     # Shortcut if we're not using storeconfigs and they're trying to collect
12:     # exported resources.
13:     if form == :exported and Puppet[:storeconfigs] != true
14:       Puppet.warning "Not collecting exported resources without storeconfigs"
15:       return false
16:     end
17: 
18:     if self.resources
19:       unless objects = collect_resources and ! objects.empty?
20:         return false
21:       end
22:     else
23:       method = "collect_#{@form.to_s}"
24:       objects = send(method).each do |obj|
25:         obj.virtual = false
26:       end
27:       return false if objects.empty?
28:     end
29: 
30:     # we have an override for the collected resources
31:     if @overrides and !objects.empty?
32: 
33:       # force the resource to be always child of any other resource
34:       overrides[:source].meta_def(:child_of?) do
35:         true
36:       end
37: 
38:       # tell the compiler we have some override for him unless we already
39:       # overrided those resources
40:       objects.each do |res|
41:         unless @collected.include?(res.ref)
42: 
43:                 newres = Puppet::Parser::Resource.new(
44:         res.type, res.title,
45:             :parameters => overrides[:parameters],
46:             :file => overrides[:file],
47:             :line => overrides[:line],
48:             :source => overrides[:source],
49:         
50:             :scope => overrides[:scope]
51:           )
52: 
53:           scope.compiler.add_override(newres)
54:         end
55:       end
56:     end
57: 
58:     # filter out object that already have been collected by ourself
59:     objects.reject! { |o| @collected.include?(o.ref) }
60: 
61:     return false if objects.empty?
62: 
63:     # keep an eye on the resources we have collected
64:     objects.inject(@collected) { |c,o| c[o.ref]=o; c }
65: 
66:     # return our newly collected resources
67:     objects
68:   end