diff options
| author | Markus Roberts <Markus@reality.com> | 2010-07-09 18:12:17 -0700 |
|---|---|---|
| committer | Markus Roberts <Markus@reality.com> | 2010-07-09 18:12:17 -0700 |
| commit | 3180b9d9b2c844dade1d361326600f7001ec66dd (patch) | |
| tree | 98fe7c5ac7eb942aac9c39f019a17b0b3f5a57f4 /lib/puppet/reference | |
| parent | 543225970225de5697734bfaf0a6eee996802c04 (diff) | |
| download | puppet-3180b9d9b2c844dade1d361326600f7001ec66dd.tar.gz puppet-3180b9d9b2c844dade1d361326600f7001ec66dd.tar.xz puppet-3180b9d9b2c844dade1d361326600f7001ec66dd.zip | |
Code smell: Two space indentation
Replaced 106806 occurances of ^( +)(.*$) with
The ruby community almost universally (i.e. everyone but Luke, Markus, and the other eleven people
who learned ruby in the 1900s) uses two-space indentation.
3 Examples:
The code:
end
# Tell getopt which arguments are valid
def test_get_getopt_args
element = Setting.new :name => "foo", :desc => "anything", :settings => Puppet::Util::Settings.new
assert_equal([["--foo", GetoptLong::REQUIRED_ARGUMENT]], element.getopt_args, "Did not produce appropriate getopt args")
becomes:
end
# Tell getopt which arguments are valid
def test_get_getopt_args
element = Setting.new :name => "foo", :desc => "anything", :settings => Puppet::Util::Settings.new
assert_equal([["--foo", GetoptLong::REQUIRED_ARGUMENT]], element.getopt_args, "Did not produce appropriate getopt args")
The code:
assert_equal(str, val)
assert_instance_of(Float, result)
end
# Now test it with a passed object
becomes:
assert_equal(str, val)
assert_instance_of(Float, result)
end
# Now test it with a passed object
The code:
end
assert_nothing_raised do
klass[:Yay] = "boo"
klass["Cool"] = :yayness
end
becomes:
end
assert_nothing_raised do
klass[:Yay] = "boo"
klass["Cool"] = :yayness
end
Diffstat (limited to 'lib/puppet/reference')
| -rw-r--r-- | lib/puppet/reference/configuration.rb | 94 | ||||
| -rw-r--r-- | lib/puppet/reference/function.rb | 2 | ||||
| -rw-r--r-- | lib/puppet/reference/indirection.rb | 24 | ||||
| -rw-r--r-- | lib/puppet/reference/metaparameter.rb | 80 | ||||
| -rw-r--r-- | lib/puppet/reference/network.rb | 28 | ||||
| -rw-r--r-- | lib/puppet/reference/providers.rb | 194 | ||||
| -rw-r--r-- | lib/puppet/reference/report.rb | 2 | ||||
| -rw-r--r-- | lib/puppet/reference/type.rb | 172 |
8 files changed, 298 insertions, 298 deletions
diff --git a/lib/puppet/reference/configuration.rb b/lib/puppet/reference/configuration.rb index 2f60ecc65..bfa2cb802 100644 --- a/lib/puppet/reference/configuration.rb +++ b/lib/puppet/reference/configuration.rb @@ -1,44 +1,44 @@ config = Puppet::Util::Reference.newreference(:configuration, :depth => 1, :doc => "A reference for all configuration parameters") do - docs = {} - Puppet.settings.each do |name, object| - docs[name] = object + docs = {} + Puppet.settings.each do |name, object| + docs[name] = object + end + + str = "" + docs.sort { |a, b| + a[0].to_s <=> b[0].to_s + }.each do |name, object| + # Make each name an anchor + header = name.to_s + str += h(header, 3) + + # Print the doc string itself + begin + str += object.desc.gsub(/\n/, " ") + rescue => detail + puts detail.backtrace + puts detail + end + str += "\n\n" + + # Now print the data about the item. + str += "" + val = object.default + if name.to_s == "vardir" + val = "/var/lib/puppet" + elsif name.to_s == "confdir" + val = "/etc/puppet" end - str = "" - docs.sort { |a, b| - a[0].to_s <=> b[0].to_s - }.each do |name, object| - # Make each name an anchor - header = name.to_s - str += h(header, 3) - - # Print the doc string itself - begin - str += object.desc.gsub(/\n/, " ") - rescue => detail - puts detail.backtrace - puts detail - end - str += "\n\n" - - # Now print the data about the item. - str += "" - val = object.default - if name.to_s == "vardir" - val = "/var/lib/puppet" - elsif name.to_s == "confdir" - val = "/etc/puppet" - end - - # Leave out the section information; it was apparently confusing people. - #str += "- **Section**: #{object.section}\n" - unless val == "" - str += "- **Default**: #{val}\n" - end - str += "\n" + # Leave out the section information; it was apparently confusing people. + #str += "- **Section**: #{object.section}\n" + unless val == "" + str += "- **Default**: #{val}\n" end + str += "\n" + end - return str + return str end config.header = " @@ -57,14 +57,14 @@ These parameters can be supplied to the executables either as command-line options or in the configuration file. For instance, the command-line invocation below would set the configuration directory to ``/private/puppet``:: - $ puppet agent --confdir=/private/puppet + $ puppet agent --confdir=/private/puppet Note that boolean options are turned on and off with a slightly different syntax on the command line:: - $ puppet agent --storeconfigs + $ puppet agent --storeconfigs - $ puppet agent --no-storeconfigs + $ puppet agent --no-storeconfigs The invocations above will enable and disable, respectively, the storage of the client configuration. @@ -89,9 +89,9 @@ File Format The file follows INI-style formatting. Here is an example of a very simple ``puppet.conf`` file:: - [main] - confdir = /private/puppet - storeconfigs = true + [main] + confdir = /private/puppet + storeconfigs = true Note that boolean parameters must be explicitly specified as `true` or `false` as seen above. @@ -99,8 +99,8 @@ Note that boolean parameters must be explicitly specified as `true` or If you need to change file parameters (e.g., reset the mode or owner), do so within curly braces on the same line:: - [main] - myfile = /tmp/whatever {owner = root, mode = 644} + [main] + myfile = /tmp/whatever {owner = root, mode = 644} If you're starting out with a fresh configuration, you may wish to let the executable generate a template configuration file for you by invoking @@ -108,7 +108,7 @@ the executable in question with the `--genconfig` command. The executable will print a template configuration to standard output, which can be redirected to a file like so:: - $ puppet agent --genconfig > /etc/puppet/puppet.conf + $ puppet agent --genconfig > /etc/puppet/puppet.conf Note that this invocation will replace the contents of any pre-existing `puppet.conf` file, so make a backup of your present config if it contains @@ -119,12 +119,12 @@ argument, which will generate a manifest that can be used to manage all of Puppet's directories and files and prints it to standard output. This can likewise be redirected to a file:: - $ puppet agent --genmanifest > /etc/puppet/manifests/site.pp + $ puppet agent --genmanifest > /etc/puppet/manifests/site.pp Puppet can also create user and group accounts for itself (one `puppet` group and one `puppet` user) if it is invoked as `root` with the `--mkusers` argument:: - $ puppet agent --mkusers + $ puppet agent --mkusers Signals ------- diff --git a/lib/puppet/reference/function.rb b/lib/puppet/reference/function.rb index 0dc2f7967..1333e0d26 100644 --- a/lib/puppet/reference/function.rb +++ b/lib/puppet/reference/function.rb @@ -1,5 +1,5 @@ function = Puppet::Util::Reference.newreference :function, :doc => "All functions available in the parser" do - Puppet::Parser::Functions.functiondocs + Puppet::Parser::Functions.functiondocs end function.header = " There are two types of functions in Puppet: Statements and rvalues. diff --git a/lib/puppet/reference/indirection.rb b/lib/puppet/reference/indirection.rb index 13c014ed4..549299b36 100644 --- a/lib/puppet/reference/indirection.rb +++ b/lib/puppet/reference/indirection.rb @@ -4,24 +4,24 @@ require 'puppet/file_serving/content' require 'puppet/file_serving/metadata' reference = Puppet::Util::Reference.newreference :indirection, :doc => "Indirection types and their terminus classes" do - text = "" - Puppet::Indirector::Indirection.instances.sort { |a,b| a.to_s <=> b.to_s }.each do |indirection| - ind = Puppet::Indirector::Indirection.instance(indirection) - name = indirection.to_s.capitalize - text += indirection.to_s + "\n" + ("-" * name.length) + "\n\n" + text = "" + Puppet::Indirector::Indirection.instances.sort { |a,b| a.to_s <=> b.to_s }.each do |indirection| + ind = Puppet::Indirector::Indirection.instance(indirection) + name = indirection.to_s.capitalize + text += indirection.to_s + "\n" + ("-" * name.length) + "\n\n" - text += ind.doc + "\n\n" + text += ind.doc + "\n\n" - Puppet::Indirector::Terminus.terminus_classes(ind.name).sort { |a,b| a.to_s <=> b.to_s }.each do |terminus| - text += terminus.to_s + "\n" + ("+" * terminus.to_s.length) + "\n\n" + Puppet::Indirector::Terminus.terminus_classes(ind.name).sort { |a,b| a.to_s <=> b.to_s }.each do |terminus| + text += terminus.to_s + "\n" + ("+" * terminus.to_s.length) + "\n\n" - term_class = Puppet::Indirector::Terminus.terminus_class(ind.name, terminus) + term_class = Puppet::Indirector::Terminus.terminus_class(ind.name, terminus) - text += Puppet::Util::Docs.scrub(term_class.doc) + "\n\n" - end + text += Puppet::Util::Docs.scrub(term_class.doc) + "\n\n" end + end - text + text end reference.header = "This is the list of all indirections, their associated terminus classes, and how you select between them. diff --git a/lib/puppet/reference/metaparameter.rb b/lib/puppet/reference/metaparameter.rb index 9368de186..6a319f1c2 100644 --- a/lib/puppet/reference/metaparameter.rb +++ b/lib/puppet/reference/metaparameter.rb @@ -1,48 +1,48 @@ metaparameter = Puppet::Util::Reference.newreference :metaparameter, :doc => "All Puppet metaparameters and all their details" do - types = {} - Puppet::Type.loadall + types = {} + Puppet::Type.loadall - Puppet::Type.eachtype { |type| - next if type.name == :puppet - next if type.name == :component - types[type.name] = type - } + Puppet::Type.eachtype { |type| + next if type.name == :puppet + next if type.name == :component + types[type.name] = type + } - str = %{ - Metaparameters - -------------- - Metaparameters are parameters that work with any resource type; they are part of the - Puppet framework itself rather than being part of the implementation of any - given instance. Thus, any defined metaparameter can be used with any instance - in your manifest, including defined components. + str = %{ + Metaparameters + -------------- + Metaparameters are parameters that work with any resource type; they are part of the + Puppet framework itself rather than being part of the implementation of any + given instance. Thus, any defined metaparameter can be used with any instance + in your manifest, including defined components. - Available Metaparameters - ++++++++++++++++++++++++ - } - begin - params = [] - Puppet::Type.eachmetaparam { |param| - params << param - } + Available Metaparameters + ++++++++++++++++++++++++ + } + begin + params = [] + Puppet::Type.eachmetaparam { |param| + params << param + } - params.sort { |a,b| - a.to_s <=> b.to_s - }.each { |param| - str += paramwrap(param.to_s, scrub(Puppet::Type.metaparamdoc(param)), :level => 4) - #puts "<dt>#{param}</dt>" - #puts tab(1) + Puppet::Type.metaparamdoc(param).scrub.indent($tab)gsub(/\n\s*/,' ') - #puts "<dd>" - #puts indent(scrub(Puppet::Type.metaparamdoc(param)), $tab) - #puts scrub(Puppet::Type.metaparamdoc(param)) - #puts "</dd>" + params.sort { |a,b| + a.to_s <=> b.to_s + }.each { |param| + str += paramwrap(param.to_s, scrub(Puppet::Type.metaparamdoc(param)), :level => 4) + #puts "<dt>#{param}</dt>" + #puts tab(1) + Puppet::Type.metaparamdoc(param).scrub.indent($tab)gsub(/\n\s*/,' ') + #puts "<dd>" + #puts indent(scrub(Puppet::Type.metaparamdoc(param)), $tab) + #puts scrub(Puppet::Type.metaparamdoc(param)) + #puts "</dd>" - #puts "" - } - rescue => detail - puts detail.backtrace - puts "incorrect metaparams: #{detail}" - exit(1) - end + #puts "" + } + rescue => detail + puts detail.backtrace + puts "incorrect metaparams: #{detail}" + exit(1) + end - str + str end diff --git a/lib/puppet/reference/network.rb b/lib/puppet/reference/network.rb index 14b26dd70..a3bff656b 100644 --- a/lib/puppet/reference/network.rb +++ b/lib/puppet/reference/network.rb @@ -1,23 +1,23 @@ network = Puppet::Util::Reference.newreference :network, :depth => 2, :doc => "Available network handlers and clients" do - ret = "" - Puppet::Network::Handler.subclasses.sort { |a,b| a.to_s <=> b.to_s }.each do |name| - handler = Puppet::Network::Handler.handler(name) + ret = "" + Puppet::Network::Handler.subclasses.sort { |a,b| a.to_s <=> b.to_s }.each do |name| + handler = Puppet::Network::Handler.handler(name) - next if ! handler.doc or handler.doc == "" + next if ! handler.doc or handler.doc == "" - interface = handler.interface + interface = handler.interface - ret += h(name, 2) + ret += h(name, 2) - ret += scrub(handler.doc) - ret += "\n\n" - ret += option(:prefix, interface.prefix) - ret += option(:side, handler.side.to_s.capitalize) - ret += option(:methods, interface.methods.collect { |ary| ary[0] }.join(", ") ) - ret += "\n\n" - end + ret += scrub(handler.doc) + ret += "\n\n" + ret += option(:prefix, interface.prefix) + ret += option(:side, handler.side.to_s.capitalize) + ret += option(:methods, interface.methods.collect { |ary| ary[0] }.join(", ") ) + ret += "\n\n" + end - ret + ret end network.header = " diff --git a/lib/puppet/reference/providers.rb b/lib/puppet/reference/providers.rb index b19549350..a0f10633b 100644 --- a/lib/puppet/reference/providers.rb +++ b/lib/puppet/reference/providers.rb @@ -1,114 +1,114 @@ # This doesn't get stored in trac, since it changes every time. providers = Puppet::Util::Reference.newreference :providers, :title => "Provider Suitability Report", :depth => 1, :dynamic => true, :doc => "Which providers are valid for this machine" do - types = [] - Puppet::Type.loadall - Puppet::Type.eachtype do |klass| - next unless klass.providers.length > 0 - types << klass + types = [] + Puppet::Type.loadall + Puppet::Type.eachtype do |klass| + next unless klass.providers.length > 0 + types << klass + end + types.sort! { |a,b| a.name.to_s <=> b.name.to_s } + + command_line = Puppet::Util::CommandLine.new + types.reject! { |type| ! command_line.args.include?(type.name.to_s) } unless command_line.args.empty? + + ret = "Details about this host:\n\n" + + # Throw some facts in there, so we know where the report is from. + ["Ruby Version", "Puppet Version", "Operating System", "Operating System Release"].each do |label| + name = label.gsub(/\s+/, '') + value = Facter.value(name) + ret += option(label, value) + end + ret += "\n" + + count = 1 + + # Produce output for each type. + types.each do |type| + features = type.features + ret += "\n" # add a trailing newline + + # Now build up a table of provider suitability. + headers = %w{Provider Suitable?} + features.collect { |f| f.to_s }.sort + + table_data = {} + + functional = false + notes = [] + begin + default = type.defaultprovider.name + rescue Puppet::DevError + default = "none" end - types.sort! { |a,b| a.name.to_s <=> b.name.to_s } - - command_line = Puppet::Util::CommandLine.new - types.reject! { |type| ! command_line.args.include?(type.name.to_s) } unless command_line.args.empty? - - ret = "Details about this host:\n\n" - - # Throw some facts in there, so we know where the report is from. - ["Ruby Version", "Puppet Version", "Operating System", "Operating System Release"].each do |label| - name = label.gsub(/\s+/, '') - value = Facter.value(name) - ret += option(label, value) - end - ret += "\n" - - count = 1 - - # Produce output for each type. - types.each do |type| - features = type.features - ret += "\n" # add a trailing newline - - # Now build up a table of provider suitability. - headers = %w{Provider Suitable?} + features.collect { |f| f.to_s }.sort - - table_data = {} - - functional = false - notes = [] - begin - default = type.defaultprovider.name - rescue Puppet::DevError - default = "none" - end - type.providers.sort { |a,b| a.to_s <=> b.to_s }.each do |pname| - data = [] - table_data[pname] = data - provider = type.provider(pname) - - # Add the suitability note - if missing = provider.suitable?(false) and missing.empty? - data << "**X**" - suit = true - functional = true - else - data << "[#{count}]_" # A pointer to the appropriate footnote - suit = false + type.providers.sort { |a,b| a.to_s <=> b.to_s }.each do |pname| + data = [] + table_data[pname] = data + provider = type.provider(pname) + + # Add the suitability note + if missing = provider.suitable?(false) and missing.empty? + data << "**X**" + suit = true + functional = true + else + data << "[#{count}]_" # A pointer to the appropriate footnote + suit = false + end + + # Add a footnote with the details about why this provider is unsuitable, if that's the case + unless suit + details = ".. [#{count}]\n" + missing.each do |test, values| + case test + when :exists + details += " - Missing files #{values.join(", ")}\n" + when :variable + values.each do |name, facts| + if Puppet.settings.valid?(name) + details += " - Setting #{name} (currently #{Puppet.settings.value(name).inspect}) not in list #{facts.join(", ")}\n" + else + details += " - Fact #{name} (currently #{Facter.value(name).inspect}) not in list #{facts.join(", ")}\n" + end end + when :true + details += " - Got #{values} true tests that should have been false\n" + when :false + details += " - Got #{values} false tests that should have been true\n" + when :feature + details += " - Missing features #{values.collect { |f| f.to_s }.join(",")}\n" + end + end + notes << details - # Add a footnote with the details about why this provider is unsuitable, if that's the case - unless suit - details = ".. [#{count}]\n" - missing.each do |test, values| - case test - when :exists - details += " - Missing files #{values.join(", ")}\n" - when :variable - values.each do |name, facts| - if Puppet.settings.valid?(name) - details += " - Setting #{name} (currently #{Puppet.settings.value(name).inspect}) not in list #{facts.join(", ")}\n" - else - details += " - Fact #{name} (currently #{Facter.value(name).inspect}) not in list #{facts.join(", ")}\n" - end - end - when :true - details += " - Got #{values} true tests that should have been false\n" - when :false - details += " - Got #{values} false tests that should have been true\n" - when :feature - details += " - Missing features #{values.collect { |f| f.to_s }.join(",")}\n" - end - end - notes << details - - count += 1 - end + count += 1 + end - # Add a note for every feature - features.each do |feature| - if provider.features.include?(feature) - data << "**X**" - else - data << "" - end - end + # Add a note for every feature + features.each do |feature| + if provider.features.include?(feature) + data << "**X**" + else + data << "" end + end + end - ret += h(type.name.to_s + "_", 2) - - ret += ".. _#{type.name}: #{"http://reductivelabs.com/trac/puppet/wiki/TypeReference##{type.name}"}\n\n" - ret += option("Default provider", default) - ret += doctable(headers, table_data) + ret += h(type.name.to_s + "_", 2) - notes.each do |note| - ret += note + "\n" - end + ret += ".. _#{type.name}: #{"http://reductivelabs.com/trac/puppet/wiki/TypeReference##{type.name}"}\n\n" + ret += option("Default provider", default) + ret += doctable(headers, table_data) - ret += "\n" + notes.each do |note| + ret += note + "\n" end ret += "\n" + end + + ret += "\n" - ret + ret end providers.header = " Puppet resource types are usually backed by multiple implementations called ``providers``, diff --git a/lib/puppet/reference/report.rb b/lib/puppet/reference/report.rb index 2ea00b6d6..481ca2dc1 100644 --- a/lib/puppet/reference/report.rb +++ b/lib/puppet/reference/report.rb @@ -1,7 +1,7 @@ require 'puppet/reports' report = Puppet::Util::Reference.newreference :report, :doc => "All available transaction reports" do - Puppet::Reports.reportdocs + Puppet::Reports.reportdocs end report.header = " diff --git a/lib/puppet/reference/type.rb b/lib/puppet/reference/type.rb index c52e764d6..be8742edc 100644 --- a/lib/puppet/reference/type.rb +++ b/lib/puppet/reference/type.rb @@ -1,113 +1,113 @@ type = Puppet::Util::Reference.newreference :type, :doc => "All Puppet resource types and all their details" do - types = {} - Puppet::Type.loadall + types = {} + Puppet::Type.loadall - Puppet::Type.eachtype { |type| - next if type.name == :puppet - next if type.name == :component - types[type.name] = type - } + Puppet::Type.eachtype { |type| + next if type.name == :puppet + next if type.name == :component + types[type.name] = type + } - str = %{ + str = %{ - Resource Types - -------------- + Resource Types + -------------- - - The *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. In general, only developers will need to - worry about which parameter is the ``namevar``. + - The *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. In general, only developers will need to + worry about which parameter is the ``namevar``. - In the following code:: + In the following code:: - file { "/etc/passwd": - owner => root, - group => root, - mode => 644 - } + file { "/etc/passwd": + owner => root, + group => root, + mode => 644 + } - ``/etc/passwd`` is considered the title of the file object (used for things like - dependency handling), and because ``path`` is the namevar for ``file``, that - string is assigned to the ``path`` parameter. + ``/etc/passwd`` is considered the title of the file object (used for things like + dependency handling), and because ``path`` is the namevar for ``file``, that + string is assigned to the ``path`` parameter. - *Parameters* determine the specific configuration of the instance. They either - directly modify the system (internally, these are called properties) or they affect - how the instance behaves (e.g., adding a search path for ``exec`` instances or determining recursion on ``file`` instances). + directly modify the system (internally, these are called properties) or they affect + how the instance behaves (e.g., adding a search path for ``exec`` instances or determining recursion on ``file`` instances). - *Providers* provide low-level functionality for a given resource type. This is - usually in the form of calling out to external commands. + usually in the form of calling out to external commands. - When required binaries are specified for providers, fully qualifed paths - indicate that the binary must exist at that specific path and unqualified - binaries indicate that Puppet will search for the binary using the shell - path. + When required binaries are specified for providers, fully qualifed paths + indicate that the binary must exist at that specific path and unqualified + binaries indicate that Puppet will search for the binary using the shell + path. - *Features* are abilities that some providers might not support. You can use the list - of supported features to determine how a given provider can be used. + of supported features to determine how a given provider can be used. - Resource types define features they can use, and providers can be tested to see - which features they provide. + Resource types define features they can use, and providers can be tested to see + which features they provide. - } + } - types.sort { |a,b| - a.to_s <=> b.to_s - }.each { |name,type| + types.sort { |a,b| + a.to_s <=> b.to_s + }.each { |name,type| - str += " + str += " ---------------- " - str += h(name, 3) - str += scrub(type.doc) + "\n\n" - - # Handle the feature docs. - if featuredocs = type.featuredocs - str += h("Features", 4) - str += featuredocs - end - - docs = {} - type.validproperties.sort { |a,b| - a.to_s <=> b.to_s - }.reject { |sname| - property = type.propertybyname(sname) - property.nodoc - }.each { |sname| - property = type.propertybyname(sname) - - raise "Could not retrieve property #{sname} on type #{type.name}" unless property - - doc = nil - unless doc = property.doc - $stderr.puts "No docs for #{type}[#{sname}]" - next - end - doc = doc.dup - tmp = doc - tmp = scrub(tmp) - - docs[sname] = tmp - } - - str += h("Parameters", 4) + "\n" - type.parameters.sort { |a,b| - a.to_s <=> b.to_s - }.each { |name,param| - #docs[name] = indent(scrub(type.paramdoc(name)), $tab) - docs[name] = scrub(type.paramdoc(name)) - } - - additional_key_attributes = type.key_attributes - [:name] - docs.sort { |a, b| - a[0].to_s <=> b[0].to_s - }.each { |name, doc| - str += paramwrap(name, doc, :namevar => additional_key_attributes.include?(name)) - } - str += "\n" + str += h(name, 3) + str += scrub(type.doc) + "\n\n" + + # Handle the feature docs. + if featuredocs = type.featuredocs + str += h("Features", 4) + str += featuredocs + end + + docs = {} + type.validproperties.sort { |a,b| + a.to_s <=> b.to_s + }.reject { |sname| + property = type.propertybyname(sname) + property.nodoc + }.each { |sname| + property = type.propertybyname(sname) + + raise "Could not retrieve property #{sname} on type #{type.name}" unless property + + doc = nil + unless doc = property.doc + $stderr.puts "No docs for #{type}[#{sname}]" + next + end + doc = doc.dup + tmp = doc + tmp = scrub(tmp) + + docs[sname] = tmp + } + + str += h("Parameters", 4) + "\n" + type.parameters.sort { |a,b| + a.to_s <=> b.to_s + }.each { |name,param| + #docs[name] = indent(scrub(type.paramdoc(name)), $tab) + docs[name] = scrub(type.paramdoc(name)) + } + + additional_key_attributes = type.key_attributes - [:name] + docs.sort { |a, b| + a[0].to_s <=> b[0].to_s + }.each { |name, doc| + str += paramwrap(name, doc, :namevar => additional_key_attributes.include?(name)) } + str += "\n" + } - str + str end |
