summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-11-09 20:32:39 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-11-09 20:32:39 +0000
commitf438bab057fac9e02e2d8f71276e7a7fbc933427 (patch)
tree62607ac368a023a3f1d62c8102da5ab66345251c /bin
parent1f548f943a804d2fdd7fdb838a1da6806f468344 (diff)
downloadpuppet-f438bab057fac9e02e2d8f71276e7a7fbc933427.tar.gz
puppet-f438bab057fac9e02e2d8f71276e7a7fbc933427.tar.xz
puppet-f438bab057fac9e02e2d8f71276e7a7fbc933427.zip
Refactoring the doc generator a big
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1842 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'bin')
-rwxr-xr-xbin/puppetdoc49
1 files changed, 17 insertions, 32 deletions
diff --git a/bin/puppetdoc b/bin/puppetdoc
index 9929edee5..1ee7406c2 100755
--- a/bin/puppetdoc
+++ b/bin/puppetdoc
@@ -45,8 +45,7 @@ require 'puppet'
require 'getoptlong'
result = GetoptLong.new(
- [ "--arguments", "-a", GetoptLong::NO_ARGUMENT ],
- [ "--types", "-t", GetoptLong::NO_ARGUMENT ],
+ [ "--mode", "-m", GetoptLong::REQUIRED_ARGUMENT ],
[ "--help", "-h", GetoptLong::NO_ARGUMENT ]
)
@@ -59,10 +58,8 @@ mode = :types
begin
result.each { |opt,arg|
case opt
- when "--arguments"
- mode = :arguments
- when "--types"
- mode = :types
+ when "--mode"
+ mode = arg.intern
when "--help"
if Puppet.feature.usage?
RDoc::usage && exit
@@ -77,31 +74,7 @@ rescue GetoptLong::InvalidOption => detail
exit(1)
end
-def scrub(text)
-
- # Stupid markdown
- #text = text.gsub("<%=", "&lt;%=")
- # For text with no carriage returns, there's nothing to do.
- if text !~ /\n/
- return text
- end
- indent = nil
-
- # If we can match an indentation, then just remove that same level of
- # indent from every line.
- if text =~ /^(\s+)/
- indent = $1
- begin
- return text.gsub(/^#{indent}/,'')
- rescue => detail
- puts detail.backtrace
- puts detail
- end
- else
- return text
- end
-
-end
+include Puppet::Util::Docs
# Indent every line in the chunk except those which begin with '..'.
def indent(text, tab)
@@ -120,7 +93,7 @@ def paramwrap(name, text, namevar = false)
end
# Print the docs for arguments
-def self.arguments
+def self.configref
puts %{---
inMenu: true
title: Configuration Reference
@@ -396,6 +369,18 @@ path.
}
end
+def self.reports
+ puts Puppet::Server::Report.reportdocs
+end
+
+def self.functions
+ puts Puppet::Parser::Functions.functiondocs
+end
+
+unless respond_to?(mode)
+ raise "Invalid mode %s" % mode
+end
+
send(mode)
puts "