37: def self.pdf(text)
38: puts "creating pdf"
39: File.open("/tmp/puppetdoc.txt", "w") do |f|
40: f.puts text
41: end
42: rst2latex = %x{which rst2latex}
43: if $? != 0 or rst2latex =~ /no /
44: rst2latex = %x{which rst2latex.py}
45: end
46: if $? != 0 or rst2latex =~ /no /
47: raise "Could not find rst2latex"
48: end
49: rst2latex.chomp!
50: cmd = %{#{rst2latex} /tmp/puppetdoc.txt > /tmp/puppetdoc.tex}
51: output = %x{#{cmd}}
52: unless $? == 0
53: $stderr.puts "rst2latex failed"
54: $stderr.puts output
55: exit(1)
56: end
57: $stderr.puts output
58:
59:
60: Dir.chdir("/tmp") do
61: %x{texi2pdf puppetdoc.tex >/dev/null 2>/dev/null}
62: end
63:
64: end