diff options
| author | Luke Kanies <luke@madstop.com> | 2005-08-23 16:09:14 +0000 |
|---|---|---|
| committer | Luke Kanies <luke@madstop.com> | 2005-08-23 16:09:14 +0000 |
| commit | 6029ef7812765775306ff8394005c326e359d886 (patch) | |
| tree | 32cbe5ea68e0e9fbdc0935d0b41e58fdfcba9e3d /bin/puppetdoc | |
| parent | e87eb58ce8dc40ba8c66233bf17cea61094e7647 (diff) | |
| download | puppet-6029ef7812765775306ff8394005c326e359d886.tar.gz puppet-6029ef7812765775306ff8394005c326e359d886.tar.xz puppet-6029ef7812765775306ff8394005c326e359d886.zip | |
Moving all files into a consolidated trunk. All tests pass except the known-failing certificate test, but there appear to be some errors that are incorrectly not resulting in failurs. I will track those down ASAP.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@576 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'bin/puppetdoc')
| -rwxr-xr-x | bin/puppetdoc | 129 |
1 files changed, 129 insertions, 0 deletions
diff --git a/bin/puppetdoc b/bin/puppetdoc new file mode 100755 index 000000000..e64ca0624 --- /dev/null +++ b/bin/puppetdoc @@ -0,0 +1,129 @@ +#!/usr/local/bin/ruby +#!/usr/bin/ruby -w + +#-------------------- +# produce documentation on all of the puppet types +# +# $Id$ + + +$:.unshift '../lib' + +require 'puppet' +require 'getoptlong' + +def tab(num) + return $tab * num +end + +result = GetoptLong.new( + [ "--logfile", "-l", GetoptLong::REQUIRED_ARGUMENT ], + [ "--debug", "-d", GetoptLong::NO_ARGUMENT ], + [ "--help", "-h", GetoptLong::NO_ARGUMENT ] +) + +debug = false +logfile = false + +$tab = " " + +result.each { |opt,arg| + case opt + when "--help" + puts "There is no help yet" + exit + when "--debug" + debug = true + when "--logfile" + logfile = arg + else + raise "Invalid option '#{opt}'" + end +} + +puts %{ +============== +Type Reference +============== + +} + +types = {} +Puppet::Type.eachtype { |type| + types[type.name] = type +} +puts %{ +--------------- +Meta-Parameters +--------------- + +} +Puppet::Type.eachmetaparam { |param| + puts "- **" + param.to_s + "**" + puts tab(1) + Puppet::Type.metaparamdoc(param).gsub(/\n\s*/,' ') +} + +puts %{ +----- +Types +----- + +- *namevar* is the parameter used to uniquely identify a type instance. + This is the parameter that gets assigned when a string is provided before + the colon in a type declaration. +- *states* are the aspects of a type that can be changed. +- *params* control how a type implements the state changes. + + +} + +types.sort { |a,b| + a.to_s <=> b.to_s +}.each { |name,type| + next if name == :puppet + next if name == :component + + puts " + +---------------- + +" + + puts " +%s +%s" % [name, "=" * (name.to_s.length + 4)] + #String.new('n%s\n') % name.to_s + #puts "**" + type.doc.gsub(/\n\s*/, ' ') + "**\n\n" + puts type.doc.gsub(/\n\s*/, ' ') + "\n\n" + type.buildstatehash + #puts tab(1) + "* namevar: %s" % type.namevar + puts "%s States\n'''''''''''''''''''''''''''''''" % name.to_s.capitalize + type.validstates.sort { |a,b| + a.to_s <=> b.to_s + }.each { |sname,state| + puts "- **%s**" % sname + puts tab(1) + state.doc.gsub(/\n\s*/,' ') + } + + puts "\n%s Parameters\n''''''''''''''''''''''''''''''" % name.to_s.capitalize + type.parameters.sort { |a,b| + a.to_s <=> b.to_s + }.each { |name,param| + print "- **%s**" % name + if type.namevar == name and name != :name + puts " (*namevar*)" + else + puts "" + end + puts tab(1) + type.paramdoc(name).gsub(/\n\s*/,' ') + } + puts "\n" +} + +puts " + +---------------- + +" + +puts "\n*This page autogenerated on %s*" % Time.now |
