377: def parse_fact(container)
378: comments = ""
379: current_fact = nil
380: File.open(@input_file_name) do |of|
381: of.each do |line|
382:
383: if line =~ /^[ \t]*# ?(.*)$/
384: comments += $1 + "\n"
385: elsif line =~ /^[ \t]*Facter.add\(['"](.*?)['"]\)/
386: current_fact = Fact.new($1,{})
387: look_for_directives_in(container, comments) unless comments.empty?
388: current_fact.comment = comments
389: container.add_fact(current_fact)
390: current_fact.record_location(@top_level)
391: comments = ""
392: Puppet.debug "rdoc: found custom fact #{current_fact.name}"
393: elsif line =~ /^[ \t]*confine[ \t]*:(.*?)[ \t]*=>[ \t]*(.*)$/
394: current_fact.confine = { :type => $1, :value => $2 } unless current_fact.nil?
395: else
396: comments =""
397: end
398: end
399: end
400: end