1 #! /usr/bin/env ruby -S rspec
2 module PuppetSpec::Compiler
3 def compile_to_catalog(string, node = Puppet::Node.new('foonode'))
5 Puppet::Parser::Compiler.compile(node)
8 def compile_to_ral(manifest)
9 catalog = compile_to_catalog(manifest)
15 def compile_to_relationship_graph(manifest, prioritizer = Puppet::Graph::SequentialPrioritizer.new)
16 ral = compile_to_ral(manifest)
17 graph = Puppet::Graph::RelationshipGraph.new(prioritizer)
18 graph.populate_from(ral)
22 if Puppet.version.to_f >= 3.3
23 def apply_compiled_manifest(manifest, prioritizer = Puppet::Graph::SequentialPrioritizer.new)
24 transaction = Puppet::Transaction.new(compile_to_ral(manifest),
25 Puppet::Transaction::Report.new("apply"),
28 transaction.report.finalize_report
33 def apply_compiled_manifest(manifest)
34 transaction = Puppet::Transaction.new(compile_to_ral(manifest), Puppet::Transaction::Report.new("apply"))
36 transaction.report.finalize_report
42 def order_resources_traversed_in(relationships)
44 relationships.traverse { |resource| order_seen << resource.ref }