diff --git a/lib/puppet_x/puppetlabs/strings/yard/handlers/provider_handler.rb b/lib/puppet_x/puppetlabs/strings/yard/handlers/provider_handler.rb index f4654a633..bd2cc221d 100644 --- a/lib/puppet_x/puppetlabs/strings/yard/handlers/provider_handler.rb +++ b/lib/puppet_x/puppetlabs/strings/yard/handlers/provider_handler.rb @@ -26,7 +26,7 @@ class PuppetX::PuppetLabs::Strings::YARD::Handlers::PuppetProviderHandler < YARD provider_name = statement[i+1].jump(:ident).source type_name = statement.jump(:symbol).first.source - obj = ProviderObject.new(:root, provider_name) + obj = ProviderObject.new(:root, "#{provider_name}_provider") docstring = nil features = [] @@ -83,6 +83,7 @@ class PuppetX::PuppetLabs::Strings::YARD::Handlers::PuppetProviderHandler < YARD obj.confines = confines obj.defaults = defaults obj.type_name = type_name + obj.header_name = provider_name register_docstring(obj, docstring, nil) register obj diff --git a/lib/puppet_x/puppetlabs/strings/yard/handlers/type_handler.rb b/lib/puppet_x/puppetlabs/strings/yard/handlers/type_handler.rb index 06c7d342e..ffc14096d 100644 --- a/lib/puppet_x/puppetlabs/strings/yard/handlers/type_handler.rb +++ b/lib/puppet_x/puppetlabs/strings/yard/handlers/type_handler.rb @@ -78,7 +78,7 @@ class PuppetX::PuppetLabs::Strings::YARD::Handlers::PuppetTypeHandler < YARD::Ha parameter_details = [] property_details = [] features = [] - obj = TypeObject.new(:root, name) do |o| + obj = TypeObject.new(:root, "#{name}_type") do |o| # FIXME: This block gets yielded twice for whatever reason parameter_details = [] property_details = [] @@ -137,6 +137,7 @@ class PuppetX::PuppetLabs::Strings::YARD::Handlers::PuppetTypeHandler < YARD::Ha obj.parameter_details = parameter_details obj.property_details = property_details obj.features = features + obj.header_name = name register obj # Register docstring after the object. If the object already has a diff --git a/lib/puppet_x/puppetlabs/strings/yard/templates/default/fulldoc/html/setup.rb b/lib/puppet_x/puppetlabs/strings/yard/templates/default/fulldoc/html/setup.rb index 2788460bb..7ab0dfefa 100644 --- a/lib/puppet_x/puppetlabs/strings/yard/templates/default/fulldoc/html/setup.rb +++ b/lib/puppet_x/puppetlabs/strings/yard/templates/default/fulldoc/html/setup.rb @@ -59,7 +59,13 @@ def namespace_list(opts = {}) end children.reject {|c| c.nil? }.sort_by {|child| child.path }.map do |child| if namespace_types.include? child.type - name = child.namespace.is_a?(CodeObjects::Proxy) ? child.path : child.name + if child.namespace.is_a?(CodeObjects::Proxy) + name = child.path + elsif child.is_a?(PuppetX::PuppetLabs::Strings::YARD::CodeObjects::TypeObject) || child.is_a?(PuppetX::PuppetLabs::Strings::YARD::CodeObjects::ProviderObject) + name = child.header_name + else + name = child.name + end has_children = child.respond_to?(:children) && run_verifier(child.children).any? {|o| o.is_a?(CodeObjects::NamespaceObject) } out << "
  • " out << " " if has_children diff --git a/lib/puppet_x/puppetlabs/strings/yard/templates/default/method_details/setup.rb b/lib/puppet_x/puppetlabs/strings/yard/templates/default/method_details/setup.rb index 99cdecbf0..94b383a78 100644 --- a/lib/puppet_x/puppetlabs/strings/yard/templates/default/method_details/setup.rb +++ b/lib/puppet_x/puppetlabs/strings/yard/templates/default/method_details/setup.rb @@ -8,7 +8,6 @@ def init item.name == object.name and item.namespace === PuppetX::PuppetLabs::Strings::YARD::CodeObjects::PuppetNamespaceObject end if parents.length == 0 -require 'pry'; binding.pry @template_helper = TemplateHelper.new @template_helper.check_parameters_match_docs object end diff --git a/lib/puppet_x/puppetlabs/strings/yard/templates/default/provider/setup.rb b/lib/puppet_x/puppetlabs/strings/yard/templates/default/provider/setup.rb index f9cf10c02..8acd72df6 100644 --- a/lib/puppet_x/puppetlabs/strings/yard/templates/default/provider/setup.rb +++ b/lib/puppet_x/puppetlabs/strings/yard/templates/default/provider/setup.rb @@ -10,6 +10,12 @@ def init @html_helper = HTMLHelper.new end +def header + @header_text = object.header_name + + erb(:header) +end + def command_details @command_details = object.commands erb(:command_details) diff --git a/lib/puppet_x/puppetlabs/strings/yard/templates/default/type/setup.rb b/lib/puppet_x/puppetlabs/strings/yard/templates/default/type/setup.rb index f9736b594..016e2692c 100644 --- a/lib/puppet_x/puppetlabs/strings/yard/templates/default/type/setup.rb +++ b/lib/puppet_x/puppetlabs/strings/yard/templates/default/type/setup.rb @@ -10,6 +10,12 @@ def init @html_helper = HTMLHelper.new end +def header + @header_text = object.header_name + + erb(:header) +end + def provider_details type_name = object.name.to_s @providers = YARD::Registry.all(:provider).select { |t| t.type_name == type_name } diff --git a/spec/unit/puppet_x/puppetlabs/strings/yard/type_handler_spec.rb b/spec/unit/puppet_x/puppetlabs/strings/yard/type_handler_spec.rb index 338ce5ce6..7c12f54e3 100644 --- a/spec/unit/puppet_x/puppetlabs/strings/yard/type_handler_spec.rb +++ b/spec/unit/puppet_x/puppetlabs/strings/yard/type_handler_spec.rb @@ -7,7 +7,7 @@ include StringsSpec::Parsing def the_type() - YARD::Registry.at("file") + YARD::Registry.at("file_type") end it "should have the proper docstring" do