diff options
author | Jesse Wolfe <jes5199@gmail.com> | 2010-08-12 13:53:13 -0700 |
---|---|---|
committer | Jesse Wolfe <jes5199@gmail.com> | 2010-08-12 13:53:29 -0700 |
commit | 1f3070c4bc77b38e3dd6170cf6a58bee7ec337ac (patch) | |
tree | 3c6495838d1b876528cb4522de3484c44749140d /lib/puppet/util/reference.rb | |
parent | d5db8db116aff58215ab0feebd7ec02086040f51 (diff) | |
parent | 0f56c1b02d40f1f8552d933dd78b24745937b137 (diff) | |
download | puppet-1f3070c4bc77b38e3dd6170cf6a58bee7ec337ac.tar.gz puppet-1f3070c4bc77b38e3dd6170cf6a58bee7ec337ac.tar.xz puppet-1f3070c4bc77b38e3dd6170cf6a58bee7ec337ac.zip |
Merge branch 'next'
This synchronizes the 2.7 master branch with 2.6.1RC2
Diffstat (limited to 'lib/puppet/util/reference.rb')
-rw-r--r-- | lib/puppet/util/reference.rb | 55 |
1 files changed, 3 insertions, 52 deletions
diff --git a/lib/puppet/util/reference.rb b/lib/puppet/util/reference.rb index 62bab643e..4f2058e69 100644 --- a/lib/puppet/util/reference.rb +++ b/lib/puppet/util/reference.rb @@ -15,7 +15,7 @@ class Puppet::Util::Reference end def self.modes - %w{pdf trac text markdown} + %w{pdf text} end def self.newreference(name, options = {}, &block) @@ -32,7 +32,7 @@ class Puppet::Util::Reference section = reference(name) or raise "Could not find section #{name}" depth = section.depth if section.depth < depth end - text = ".. contents:: :depth: 2\n\n" + text = "{:toc}\n\n" end def self.pdf(text) @@ -67,32 +67,6 @@ class Puppet::Util::Reference end - def self.markdown(name, text) - puts "Creating markdown for #{name} reference." - dir = "/tmp/#{Puppet::PUPPETVERSION}" - FileUtils.mkdir(dir) unless File.directory?(dir) - Puppet::Util.secure_open(dir + "/#{name}.rst", "w") do |f| - f.puts text - end - pandoc = %x{which pandoc} - if $CHILD_STATUS != 0 or pandoc =~ /no / - pandoc = %x{which pandoc} - end - if $CHILD_STATUS != 0 or pandoc =~ /no / - raise "Could not find pandoc" - end - pandoc.chomp! - cmd = %{#{pandoc} -s -r rst -w markdown #{dir}/#{name}.rst -o #{dir}/#{name}.mdwn} - output = %x{#{cmd}} - unless $CHILD_STATUS == 0 - $stderr.puts "Pandoc failed to create #{name} reference." - $stderr.puts output - exit(1) - end - - File.unlink(dir + "/#{name}.rst") - end - def self.references instance_loader(:reference).loadall loaded_instances(:reference).sort { |a,b| a.to_s <=> b.to_s } @@ -167,7 +141,7 @@ class Puppet::Util::Reference # First the header text = h(@title, 1) text += "\n\n**This page is autogenerated; any changes will get overwritten** *(last generated on #{Time.now.to_s})*\n\n" - text += ".. contents:: :depth: #{@depth}\n\n" if withcontents + text += "{:toc}\n\n" if withcontents text += @header @@ -181,27 +155,4 @@ class Puppet::Util::Reference def to_text(withcontents = true) strip_trac(to_rest(withcontents)) end - - def to_trac(with_contents = true) - "{{{\n#!rst\n#{self.to_rest(with_contents)}\n}}}" - end - - def trac - Puppet::Util.secure_open("/tmp/puppetdoc.txt", "w") do |f| - f.puts self.to_trac - end - - puts "Writing #{@name} reference to trac as #{@page}" - cmd = %{sudo trac-admin /opt/rl/trac/puppet wiki import %s /tmp/puppetdoc.txt} % self.page - output = %x{#{cmd}} - unless $CHILD_STATUS == 0 - $stderr.puts "trac-admin failed" - $stderr.puts output - exit(1) - end - unless output =~ /^\s+/ - $stderr.puts output - end - end end - |