summaryrefslogtreecommitdiffstats
path: root/lib/puppet/provider.rb
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-08-28 16:30:49 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-08-28 16:30:49 +0000
commitd45d22b7547a608c7821905024f530bbae1259d7 (patch)
tree018f311b26a7854271524beba90a778918bd7ee6 /lib/puppet/provider.rb
parente1aff4cd2f456bfc9567e9be5dd73b3c8ed14ec9 (diff)
downloadpuppet-d45d22b7547a608c7821905024f530bbae1259d7.tar.gz
puppet-d45d22b7547a608c7821905024f530bbae1259d7.tar.xz
puppet-d45d22b7547a608c7821905024f530bbae1259d7.zip
Adding a module specifically for making doc generation easier, and adding defaults info to provider docs.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1504 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet/provider.rb')
-rw-r--r--lib/puppet/provider.rb24
1 files changed, 13 insertions, 11 deletions
diff --git a/lib/puppet/provider.rb b/lib/puppet/provider.rb
index 1aff6b9fc..57dfc8409 100644
--- a/lib/puppet/provider.rb
+++ b/lib/puppet/provider.rb
@@ -6,7 +6,7 @@ class Puppet::Provider
class << self
# Include the util module so we have access to things like 'binary'
- include Puppet::Util
+ include Puppet::Util, Puppet::Util::Docs
attr_accessor :name, :model
attr_writer :doc
end
@@ -34,6 +34,7 @@ class Puppet::Provider
def self.commands(hash)
hash.each do |name, path|
name = symbolize(name)
+ @origcommands[name] = path
# Keep the short name if we couldn't find it.
unless path =~ /^\//
if tmp = binary(path)
@@ -77,25 +78,26 @@ class Puppet::Provider
@defaults.length
end
- # Specify a documentation string.
- def self.desc(str)
- @doc = str
+ dochook(:defaults) do
+ if @defaults.length > 0
+ return " Default for " + @defaults.collect do |f, v|
+ "``#{f}`` == ``#{v}``"
+ end.join(" and ") + "."
+ end
end
- def self.doc
- if defined? @commands and @commands.length > 0
- extra = " Required binaries: " + @commands.collect do |n, c|
+ dochook(:commands) do
+ if @origcommands.length > 0
+ return " Required binaries: " + @origcommands.collect do |n, c|
"``#{c}``"
- end.join(", ")
- @doc + extra
- else
- @doc
+ end.join(", ") + "."
end
end
def self.initvars
@defaults = {}
@commands = {}
+ @origcommands = {}
@confines = Hash.new do |hash, key|
hash[key] = []
end