From ec0e26e3392cbe4d746d512e798ebdc6ee4d8449 Mon Sep 17 00:00:00 2001 From: Hailee Kenney Date: Wed, 10 Sep 2014 17:07:33 -0700 Subject: [PATCH 1/3] (PDOC-3) Rename face to strings instead of yardoc Since we don't want the name of the tool to reflect the fact that it is using yard internally (this is an implementation detail), rename the face to `strings`. Now when one wishes to generate documentation, `puppet strings` will be used rather than `puppet yardoc`. --- README.md | 6 ++-- lib/puppet/application/strings.rb | 4 +++ lib/puppet/application/yardoc.rb | 4 --- lib/puppet/face/{yardoc.rb => strings.rb} | 10 +++---- lib/puppetx/{yardoc.rb => strings.rb} | 2 +- .../pops/yard_statement.rb | 4 +-- .../pops/yard_transformer.rb | 4 +-- .../{yardoc => strings}/yard/code_objects.rb | 0 .../yard/code_objects/defined_type_object.rb | 2 +- .../yard/code_objects/host_class_object.rb | 2 +- .../code_objects/puppet_namespace_object.rb | 4 +-- .../{yardoc => strings}/yard/handlers.rb | 0 .../{yardoc => strings}/yard/handlers/base.rb | 6 ++-- .../yard/handlers/defined_type_handler.rb | 2 +- .../future_parser_function_handler.rb | 6 ++-- .../yard/handlers/host_class_handler.rb | 2 +- .../yard/handlers/parser_function_handler.rb | 4 +-- .../yard/monkey_patches.rb | 0 .../{yardoc => strings}/yard/parser.rb | 6 ++-- .../{yardoc => strings}/yard/plugin.rb | 4 +-- .../definedtype/html/parameter_details.erb | 0 .../default/definedtype/html/setup.rb | 0 .../templates/default/definedtype/setup.rb | 0 .../default/fulldoc/html/full_list_class.erb | 0 .../html/full_list_puppet_manifest.erb | 0 .../fulldoc/html/full_list_puppet_plugin.erb | 0 .../templates/default/fulldoc/html/setup.rb | 0 .../default/hostclass/html/box_info.erb | 0 .../templates/default/hostclass/html/setup.rb | 0 .../default/hostclass/html/subclasses.erb | 0 .../yard/templates/default/hostclass/setup.rb | 0 .../templates/default/layout/html/setup.rb | 0 .../default/puppetnamespace/html/setup.rb | 0 .../default/puppetnamespace/setup.rb | 0 metadata.json | 6 ++-- spec/spec_helper.rb | 2 +- spec/unit/puppet/face_spec.rb | 30 +++++++++---------- spec/unit/puppetx/yardoc/pops_spec.rb | 10 +++---- .../yardoc/yard/defined_type_handler_spec.rb | 2 +- .../future_parser_function_handler_spec.rb | 2 +- .../yardoc/yard/host_class_handler_spec.rb | 2 +- .../yard/parser_function_handler_spec.rb | 2 +- 42 files changed, 64 insertions(+), 64 deletions(-) create mode 100644 lib/puppet/application/strings.rb delete mode 100644 lib/puppet/application/yardoc.rb rename lib/puppet/face/{yardoc.rb => strings.rb} (94%) rename lib/puppetx/{yardoc.rb => strings.rb} (92%) rename lib/puppetx/{yardoc => strings}/pops/yard_statement.rb (97%) rename lib/puppetx/{yardoc => strings}/pops/yard_transformer.rb (95%) rename lib/puppetx/{yardoc => strings}/yard/code_objects.rb (100%) rename lib/puppetx/{yardoc => strings}/yard/code_objects/defined_type_object.rb (85%) rename lib/puppetx/{yardoc => strings}/yard/code_objects/host_class_object.rb (95%) rename lib/puppetx/{yardoc => strings}/yard/code_objects/puppet_namespace_object.rb (94%) rename lib/puppetx/{yardoc => strings}/yard/handlers.rb (100%) rename lib/puppetx/{yardoc => strings}/yard/handlers/base.rb (75%) rename lib/puppetx/{yardoc => strings}/yard/handlers/defined_type_handler.rb (90%) rename lib/puppetx/{yardoc => strings}/yard/handlers/future_parser_function_handler.rb (96%) rename lib/puppetx/{yardoc => strings}/yard/handlers/host_class_handler.rb (93%) rename lib/puppetx/{yardoc => strings}/yard/handlers/parser_function_handler.rb (97%) rename lib/puppetx/{yardoc => strings}/yard/monkey_patches.rb (100%) rename lib/puppetx/{yardoc => strings}/yard/parser.rb (81%) rename lib/puppetx/{yardoc => strings}/yard/plugin.rb (89%) rename lib/puppetx/{yardoc => strings}/yard/templates/default/definedtype/html/parameter_details.erb (100%) rename lib/puppetx/{yardoc => strings}/yard/templates/default/definedtype/html/setup.rb (100%) rename lib/puppetx/{yardoc => strings}/yard/templates/default/definedtype/setup.rb (100%) rename lib/puppetx/{yardoc => strings}/yard/templates/default/fulldoc/html/full_list_class.erb (100%) rename lib/puppetx/{yardoc => strings}/yard/templates/default/fulldoc/html/full_list_puppet_manifest.erb (100%) rename lib/puppetx/{yardoc => strings}/yard/templates/default/fulldoc/html/full_list_puppet_plugin.erb (100%) rename lib/puppetx/{yardoc => strings}/yard/templates/default/fulldoc/html/setup.rb (100%) rename lib/puppetx/{yardoc => strings}/yard/templates/default/hostclass/html/box_info.erb (100%) rename lib/puppetx/{yardoc => strings}/yard/templates/default/hostclass/html/setup.rb (100%) rename lib/puppetx/{yardoc => strings}/yard/templates/default/hostclass/html/subclasses.erb (100%) rename lib/puppetx/{yardoc => strings}/yard/templates/default/hostclass/setup.rb (100%) rename lib/puppetx/{yardoc => strings}/yard/templates/default/layout/html/setup.rb (100%) rename lib/puppetx/{yardoc => strings}/yard/templates/default/puppetnamespace/html/setup.rb (100%) rename lib/puppetx/{yardoc => strings}/yard/templates/default/puppetnamespace/setup.rb (100%) diff --git a/README.md b/README.md index 37cfb50..9367728 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -Puppet YARDoc +Puppet Strings ============= A Puppet Face and plugin built on the [YARD Documentation Tool](http://yardoc.org/) and Puppet Future Parser. @@ -23,13 +23,13 @@ Usage Documenting a module: cd /path/to/module - puppet yardoc + puppet strings This processes `README` and everything in `manifests/**/*.pp`. Documenting specific manifests: - puppet yardoc some_manifest.pp [another_if_you_feel_like_it.pp] + puppet strings some_manifest.pp [another_if_you_feel_like_it.pp] Processing is delegated to the `yardoc` tool so some options listed in `yard help doc` are available. However, Puppet Faces do not support passing arbitrary options through a face so these options must be specified in a `.yardopts` file. diff --git a/lib/puppet/application/strings.rb b/lib/puppet/application/strings.rb new file mode 100644 index 0000000..119b003 --- /dev/null +++ b/lib/puppet/application/strings.rb @@ -0,0 +1,4 @@ +require 'puppet/application/face_base' + +class Puppet::Application::Strings < Puppet::Application::FaceBase +end diff --git a/lib/puppet/application/yardoc.rb b/lib/puppet/application/yardoc.rb deleted file mode 100644 index 0133b57..0000000 --- a/lib/puppet/application/yardoc.rb +++ /dev/null @@ -1,4 +0,0 @@ -require 'puppet/application/face_base' - -class Puppet::Application::Yardoc < Puppet::Application::FaceBase -end diff --git a/lib/puppet/face/yardoc.rb b/lib/puppet/face/strings.rb similarity index 94% rename from lib/puppet/face/yardoc.rb rename to lib/puppet/face/strings.rb index d394335..36b2014 100644 --- a/lib/puppet/face/yardoc.rb +++ b/lib/puppet/face/strings.rb @@ -1,6 +1,6 @@ require 'puppet/face' -Puppet::Face.define(:yardoc, '0.0.1') do +Puppet::Face.define(:strings, '0.0.1') do summary "Generate Puppet documentation with YARD." def check_required_features @@ -54,7 +54,7 @@ Puppet::Face.define(:yardoc, '0.0.1') do yard_args = (args.empty? ? MODULE_SOURCEFILES : args) merge_puppet_args!(yard_args) - require 'puppetx/yardoc/yard/plugin' + require 'puppetx/strings/yard/plugin' # Hand off to YARD for further processing. YARD::CLI::Yardoc.run(*yard_args) @@ -71,7 +71,7 @@ Puppet::Face.define(:yardoc, '0.0.1') do when_invoked do |*args| check_required_features - require 'puppetx/yardoc/yard/plugin' + require 'puppetx/strings/yard/plugin' opts = args.pop # NOTE: The retrun value of the `module` Face seems to have changed in @@ -105,13 +105,13 @@ Puppet::Face.define(:yardoc, '0.0.1') do when_invoked do |*args| check_required_features - require 'puppetx/yardoc/yard/plugin' + require 'puppetx/strings/yard/plugin' opts = args.pop # FIXME: This is pretty inefficient as it forcibly re-generates the YARD # indicies each time the server is started. However, it ensures things are # generated properly. - module_list = Puppet::Face[:yardoc, :current].modules + module_list = Puppet::Face[:strings, :current].modules module_tuples = module_list.map do |mod| name = (mod.forge_name || mod.name).gsub('/', '-') diff --git a/lib/puppetx/yardoc.rb b/lib/puppetx/strings.rb similarity index 92% rename from lib/puppetx/yardoc.rb rename to lib/puppetx/strings.rb index 2f6d2af..bcd21c5 100644 --- a/lib/puppetx/yardoc.rb +++ b/lib/puppetx/strings.rb @@ -1,7 +1,7 @@ require 'puppetx' # Nothing to see here except forward declarations. -module Puppetx::Yardoc +module Puppetx::Strings # This submodule contains bits that interface with the YARD plugin system. module YARD end diff --git a/lib/puppetx/yardoc/pops/yard_statement.rb b/lib/puppetx/strings/pops/yard_statement.rb similarity index 97% rename from lib/puppetx/yardoc/pops/yard_statement.rb rename to lib/puppetx/strings/pops/yard_statement.rb index 9c6b030..4da0723 100644 --- a/lib/puppetx/yardoc/pops/yard_statement.rb +++ b/lib/puppetx/strings/pops/yard_statement.rb @@ -1,9 +1,9 @@ require 'ostruct' require 'puppet/pops' -require_relative '../../yardoc' +require_relative '../../strings' -module Puppetx::Yardoc::Pops +module Puppetx::Strings::Pops # An adapter class that conforms a Pops model instance + adapters to the # interface expected by YARD handlers. # diff --git a/lib/puppetx/yardoc/pops/yard_transformer.rb b/lib/puppetx/strings/pops/yard_transformer.rb similarity index 95% rename from lib/puppetx/yardoc/pops/yard_transformer.rb rename to lib/puppetx/strings/pops/yard_transformer.rb index 6560b07..5227b30 100644 --- a/lib/puppetx/yardoc/pops/yard_transformer.rb +++ b/lib/puppetx/strings/pops/yard_transformer.rb @@ -1,9 +1,9 @@ require 'puppet/pops' -require_relative '../../yardoc' +require_relative '../../strings' require_relative 'yard_statement' -module Puppetx::Yardoc::Pops +module Puppetx::Strings::Pops # Loosely based on the TreeDumper classes in Pops::Model. The responsibility of # this class is to walk a Pops::Model and output objects that can be consumed # by YARD handlers. diff --git a/lib/puppetx/yardoc/yard/code_objects.rb b/lib/puppetx/strings/yard/code_objects.rb similarity index 100% rename from lib/puppetx/yardoc/yard/code_objects.rb rename to lib/puppetx/strings/yard/code_objects.rb diff --git a/lib/puppetx/yardoc/yard/code_objects/defined_type_object.rb b/lib/puppetx/strings/yard/code_objects/defined_type_object.rb similarity index 85% rename from lib/puppetx/yardoc/yard/code_objects/defined_type_object.rb rename to lib/puppetx/strings/yard/code_objects/defined_type_object.rb index 0e6db15..541f521 100644 --- a/lib/puppetx/yardoc/yard/code_objects/defined_type_object.rb +++ b/lib/puppetx/strings/yard/code_objects/defined_type_object.rb @@ -2,7 +2,7 @@ require 'puppet/pops' require_relative 'puppet_namespace_object' -module Puppetx::Yardoc::YARD::CodeObjects +module Puppetx::Strings::YARD::CodeObjects class DefinedTypeObject < PuppetNamespaceObject # A list of parameters attached to this class. # @return [Array] diff --git a/lib/puppetx/yardoc/yard/code_objects/host_class_object.rb b/lib/puppetx/strings/yard/code_objects/host_class_object.rb similarity index 95% rename from lib/puppetx/yardoc/yard/code_objects/host_class_object.rb rename to lib/puppetx/strings/yard/code_objects/host_class_object.rb index d8b138f..f4f64ab 100644 --- a/lib/puppetx/yardoc/yard/code_objects/host_class_object.rb +++ b/lib/puppetx/strings/yard/code_objects/host_class_object.rb @@ -1,6 +1,6 @@ require_relative 'defined_type_object' -module Puppetx::Yardoc::YARD::CodeObjects +module Puppetx::Strings::YARD::CodeObjects class HostClassObject < DefinedTypeObject # The {HostClassObject} that this class inherits from, if any. # @return [HostClassObject, Proxy, nil] diff --git a/lib/puppetx/yardoc/yard/code_objects/puppet_namespace_object.rb b/lib/puppetx/strings/yard/code_objects/puppet_namespace_object.rb similarity index 94% rename from lib/puppetx/yardoc/yard/code_objects/puppet_namespace_object.rb rename to lib/puppetx/strings/yard/code_objects/puppet_namespace_object.rb index 2aa4a90..b84aa33 100644 --- a/lib/puppetx/yardoc/yard/code_objects/puppet_namespace_object.rb +++ b/lib/puppetx/strings/yard/code_objects/puppet_namespace_object.rb @@ -1,8 +1,8 @@ require 'yard' -require_relative '../../../yardoc' +require_relative '../../../strings' -module Puppetx::Yardoc::YARD::CodeObjects +module Puppetx::Strings::YARD::CodeObjects class PuppetNamespaceObject < YARD::CodeObjects::NamespaceObject # NOTE: `YARD::Registry#resolve` requires a method with this signature to # be present on all subclasses of `NamespaceObject`. diff --git a/lib/puppetx/yardoc/yard/handlers.rb b/lib/puppetx/strings/yard/handlers.rb similarity index 100% rename from lib/puppetx/yardoc/yard/handlers.rb rename to lib/puppetx/strings/yard/handlers.rb diff --git a/lib/puppetx/yardoc/yard/handlers/base.rb b/lib/puppetx/strings/yard/handlers/base.rb similarity index 75% rename from lib/puppetx/yardoc/yard/handlers/base.rb rename to lib/puppetx/strings/yard/handlers/base.rb index 0e50359..85d41e0 100644 --- a/lib/puppetx/yardoc/yard/handlers/base.rb +++ b/lib/puppetx/strings/yard/handlers/base.rb @@ -1,15 +1,15 @@ require 'yard' require 'puppet/pops' -require_relative '../../../yardoc' +require_relative '../../../strings' require_relative '../code_objects' -module Puppetx::Yardoc::YARD::Handlers +module Puppetx::Strings::YARD::Handlers class Base < YARD::Handlers::Base # Easy access to Pops model objects for handler matching. include Puppet::Pops::Model # Easy access to custom code objects from which documentation is generated. - include Puppetx::Yardoc::YARD::CodeObjects + include Puppetx::Strings::YARD::CodeObjects def self.handles?(statement) handlers.any? {|h| h == statement.type} diff --git a/lib/puppetx/yardoc/yard/handlers/defined_type_handler.rb b/lib/puppetx/strings/yard/handlers/defined_type_handler.rb similarity index 90% rename from lib/puppetx/yardoc/yard/handlers/defined_type_handler.rb rename to lib/puppetx/strings/yard/handlers/defined_type_handler.rb index e21f67d..99247e0 100644 --- a/lib/puppetx/yardoc/yard/handlers/defined_type_handler.rb +++ b/lib/puppetx/strings/yard/handlers/defined_type_handler.rb @@ -1,6 +1,6 @@ require_relative 'base' -module Puppetx::Yardoc::YARD::Handlers +module Puppetx::Strings::YARD::Handlers class DefinedTypeHandler < Base handles ResourceTypeDefinition diff --git a/lib/puppetx/yardoc/yard/handlers/future_parser_function_handler.rb b/lib/puppetx/strings/yard/handlers/future_parser_function_handler.rb similarity index 96% rename from lib/puppetx/yardoc/yard/handlers/future_parser_function_handler.rb rename to lib/puppetx/strings/yard/handlers/future_parser_function_handler.rb index adf262a..850a2be 100644 --- a/lib/puppetx/yardoc/yard/handlers/future_parser_function_handler.rb +++ b/lib/puppetx/strings/yard/handlers/future_parser_function_handler.rb @@ -1,11 +1,11 @@ require_relative '../code_objects' -module Puppetx::Yardoc::YARD::Handlers +module Puppetx::Strings::YARD::Handlers # Handles `dispatch` calls within a future parser function declaration. For # now, it just treats any docstring as an `@overlaod` tag and attaches the # overload to the parent function. class FutureParserDispatchHandler < YARD::Handlers::Ruby::Base - include Puppetx::Yardoc::YARD::CodeObjects + include Puppetx::Strings::YARD::CodeObjects handles method_call(:dispatch) @@ -22,7 +22,7 @@ module Puppetx::Yardoc::YARD::Handlers end class FutureParserFunctionHandler < YARD::Handlers::Ruby::Base - include Puppetx::Yardoc::YARD::CodeObjects + include Puppetx::Strings::YARD::CodeObjects handles method_call(:create_function) diff --git a/lib/puppetx/yardoc/yard/handlers/host_class_handler.rb b/lib/puppetx/strings/yard/handlers/host_class_handler.rb similarity index 93% rename from lib/puppetx/yardoc/yard/handlers/host_class_handler.rb rename to lib/puppetx/strings/yard/handlers/host_class_handler.rb index 12c1b2c..827d60d 100644 --- a/lib/puppetx/yardoc/yard/handlers/host_class_handler.rb +++ b/lib/puppetx/strings/yard/handlers/host_class_handler.rb @@ -1,6 +1,6 @@ require_relative 'base' -module Puppetx::Yardoc::YARD::Handlers +module Puppetx::Strings::YARD::Handlers class HostClassHandler < Base handles HostClassDefinition diff --git a/lib/puppetx/yardoc/yard/handlers/parser_function_handler.rb b/lib/puppetx/strings/yard/handlers/parser_function_handler.rb similarity index 97% rename from lib/puppetx/yardoc/yard/handlers/parser_function_handler.rb rename to lib/puppetx/strings/yard/handlers/parser_function_handler.rb index 15e60af..153405b 100644 --- a/lib/puppetx/yardoc/yard/handlers/parser_function_handler.rb +++ b/lib/puppetx/strings/yard/handlers/parser_function_handler.rb @@ -3,9 +3,9 @@ require 'puppet/util/docs' require_relative '../code_objects' -module Puppetx::Yardoc::YARD::Handlers +module Puppetx::Strings::YARD::Handlers class ParserFunctionHandler < YARD::Handlers::Ruby::Base - include Puppetx::Yardoc::YARD::CodeObjects + include Puppetx::Strings::YARD::CodeObjects handles method_call(:newfunction) diff --git a/lib/puppetx/yardoc/yard/monkey_patches.rb b/lib/puppetx/strings/yard/monkey_patches.rb similarity index 100% rename from lib/puppetx/yardoc/yard/monkey_patches.rb rename to lib/puppetx/strings/yard/monkey_patches.rb diff --git a/lib/puppetx/yardoc/yard/parser.rb b/lib/puppetx/strings/yard/parser.rb similarity index 81% rename from lib/puppetx/yardoc/yard/parser.rb rename to lib/puppetx/strings/yard/parser.rb index 2d815b3..037e49a 100644 --- a/lib/puppetx/yardoc/yard/parser.rb +++ b/lib/puppetx/strings/yard/parser.rb @@ -1,10 +1,10 @@ require 'yard' require 'puppet/pops' -require_relative '../../yardoc' +require_relative '../../strings' require_relative '../pops/yard_transformer' -module Puppetx::Yardoc::YARD +module Puppetx::Strings::YARD class PuppetParser < YARD::Parser::Base attr_reader :file, :source @@ -13,7 +13,7 @@ module Puppetx::Yardoc::YARD @file = filename @parser = Puppet::Pops::Parser::Parser.new() - @transformer = Puppetx::Yardoc::Pops::YARDTransformer.new() + @transformer = Puppetx::Strings::Pops::YARDTransformer.new() end def parse diff --git a/lib/puppetx/yardoc/yard/plugin.rb b/lib/puppetx/strings/yard/plugin.rb similarity index 89% rename from lib/puppetx/yardoc/yard/plugin.rb rename to lib/puppetx/strings/yard/plugin.rb index 9d5e062..9ee1430 100644 --- a/lib/puppetx/yardoc/yard/plugin.rb +++ b/lib/puppetx/strings/yard/plugin.rb @@ -10,10 +10,10 @@ require_relative 'parser' require_relative 'handlers' YARD::Parser::SourceParser.register_parser_type(:puppet, - Puppetx::Yardoc::YARD::PuppetParser, + Puppetx::Strings::YARD::PuppetParser, ['pp']) YARD::Handlers::Processor.register_handler_namespace(:puppet, - Puppetx::Yardoc::YARD::Handlers) + Puppetx::Strings::YARD::Handlers) # FIXME: Might not be the best idea to have the template code on the Ruby # LOAD_PATH as the contents of this directory really aren't library code. diff --git a/lib/puppetx/yardoc/yard/templates/default/definedtype/html/parameter_details.erb b/lib/puppetx/strings/yard/templates/default/definedtype/html/parameter_details.erb similarity index 100% rename from lib/puppetx/yardoc/yard/templates/default/definedtype/html/parameter_details.erb rename to lib/puppetx/strings/yard/templates/default/definedtype/html/parameter_details.erb diff --git a/lib/puppetx/yardoc/yard/templates/default/definedtype/html/setup.rb b/lib/puppetx/strings/yard/templates/default/definedtype/html/setup.rb similarity index 100% rename from lib/puppetx/yardoc/yard/templates/default/definedtype/html/setup.rb rename to lib/puppetx/strings/yard/templates/default/definedtype/html/setup.rb diff --git a/lib/puppetx/yardoc/yard/templates/default/definedtype/setup.rb b/lib/puppetx/strings/yard/templates/default/definedtype/setup.rb similarity index 100% rename from lib/puppetx/yardoc/yard/templates/default/definedtype/setup.rb rename to lib/puppetx/strings/yard/templates/default/definedtype/setup.rb diff --git a/lib/puppetx/yardoc/yard/templates/default/fulldoc/html/full_list_class.erb b/lib/puppetx/strings/yard/templates/default/fulldoc/html/full_list_class.erb similarity index 100% rename from lib/puppetx/yardoc/yard/templates/default/fulldoc/html/full_list_class.erb rename to lib/puppetx/strings/yard/templates/default/fulldoc/html/full_list_class.erb diff --git a/lib/puppetx/yardoc/yard/templates/default/fulldoc/html/full_list_puppet_manifest.erb b/lib/puppetx/strings/yard/templates/default/fulldoc/html/full_list_puppet_manifest.erb similarity index 100% rename from lib/puppetx/yardoc/yard/templates/default/fulldoc/html/full_list_puppet_manifest.erb rename to lib/puppetx/strings/yard/templates/default/fulldoc/html/full_list_puppet_manifest.erb diff --git a/lib/puppetx/yardoc/yard/templates/default/fulldoc/html/full_list_puppet_plugin.erb b/lib/puppetx/strings/yard/templates/default/fulldoc/html/full_list_puppet_plugin.erb similarity index 100% rename from lib/puppetx/yardoc/yard/templates/default/fulldoc/html/full_list_puppet_plugin.erb rename to lib/puppetx/strings/yard/templates/default/fulldoc/html/full_list_puppet_plugin.erb diff --git a/lib/puppetx/yardoc/yard/templates/default/fulldoc/html/setup.rb b/lib/puppetx/strings/yard/templates/default/fulldoc/html/setup.rb similarity index 100% rename from lib/puppetx/yardoc/yard/templates/default/fulldoc/html/setup.rb rename to lib/puppetx/strings/yard/templates/default/fulldoc/html/setup.rb diff --git a/lib/puppetx/yardoc/yard/templates/default/hostclass/html/box_info.erb b/lib/puppetx/strings/yard/templates/default/hostclass/html/box_info.erb similarity index 100% rename from lib/puppetx/yardoc/yard/templates/default/hostclass/html/box_info.erb rename to lib/puppetx/strings/yard/templates/default/hostclass/html/box_info.erb diff --git a/lib/puppetx/yardoc/yard/templates/default/hostclass/html/setup.rb b/lib/puppetx/strings/yard/templates/default/hostclass/html/setup.rb similarity index 100% rename from lib/puppetx/yardoc/yard/templates/default/hostclass/html/setup.rb rename to lib/puppetx/strings/yard/templates/default/hostclass/html/setup.rb diff --git a/lib/puppetx/yardoc/yard/templates/default/hostclass/html/subclasses.erb b/lib/puppetx/strings/yard/templates/default/hostclass/html/subclasses.erb similarity index 100% rename from lib/puppetx/yardoc/yard/templates/default/hostclass/html/subclasses.erb rename to lib/puppetx/strings/yard/templates/default/hostclass/html/subclasses.erb diff --git a/lib/puppetx/yardoc/yard/templates/default/hostclass/setup.rb b/lib/puppetx/strings/yard/templates/default/hostclass/setup.rb similarity index 100% rename from lib/puppetx/yardoc/yard/templates/default/hostclass/setup.rb rename to lib/puppetx/strings/yard/templates/default/hostclass/setup.rb diff --git a/lib/puppetx/yardoc/yard/templates/default/layout/html/setup.rb b/lib/puppetx/strings/yard/templates/default/layout/html/setup.rb similarity index 100% rename from lib/puppetx/yardoc/yard/templates/default/layout/html/setup.rb rename to lib/puppetx/strings/yard/templates/default/layout/html/setup.rb diff --git a/lib/puppetx/yardoc/yard/templates/default/puppetnamespace/html/setup.rb b/lib/puppetx/strings/yard/templates/default/puppetnamespace/html/setup.rb similarity index 100% rename from lib/puppetx/yardoc/yard/templates/default/puppetnamespace/html/setup.rb rename to lib/puppetx/strings/yard/templates/default/puppetnamespace/html/setup.rb diff --git a/lib/puppetx/yardoc/yard/templates/default/puppetnamespace/setup.rb b/lib/puppetx/strings/yard/templates/default/puppetnamespace/setup.rb similarity index 100% rename from lib/puppetx/yardoc/yard/templates/default/puppetnamespace/setup.rb rename to lib/puppetx/strings/yard/templates/default/puppetnamespace/setup.rb diff --git a/metadata.json b/metadata.json index f9edfc9..7f53c8f 100644 --- a/metadata.json +++ b/metadata.json @@ -1,10 +1,10 @@ { - "name": "sharpie-puppet_yardoc", + "name": "puppetlabs-strings", "version": "0.0.1", - "author": "Charlie Sharpsteen", + "author": "Puppet Labs", "summary": "Puppet documentation via YARD", "license": "Apache 2.0", - "source": "", + "source": "https://github.com/puppetlabs/puppetlabs-strings", "project_page": null, "issues_url": null, "requirements": [ diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 7e24a2f..c4d2ee9 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -6,7 +6,7 @@ require 'puppet' require 'rspec' # This is neeeded so we can access a Registry if YARD creates one -require 'puppetx/yardoc/yard/plugin' +require 'puppetx/strings/yard/plugin' include YARD RSpec.configure do |config| diff --git a/spec/unit/puppet/face_spec.rb b/spec/unit/puppet/face_spec.rb index 3eaf42a..037ae44 100644 --- a/spec/unit/puppet/face_spec.rb +++ b/spec/unit/puppet/face_spec.rb @@ -1,5 +1,5 @@ require 'spec_helper' -require 'puppet/face/yardoc' +require 'puppet/face/strings' require 'rspec-html-matchers' require 'tmpdir' require 'stringio' @@ -9,26 +9,26 @@ describe Puppet::Face do describe "YARDoc action" do it "should raise an error if yard is absent" do Puppet.features.stubs(:yard?).returns(false) - expect{Puppet::Face[:yardoc, :current].yardoc}.to raise_error(RuntimeError, "The 'yard' gem must be installed in order to use this face.") + expect{Puppet::Face[:strings, :current].yardoc}.to raise_error(RuntimeError, "The 'yard' gem must be installed in order to use this face.") end it "should raise an error if rgen is absent" do Puppet.features.stubs(:rgen?).returns(false) - expect{Puppet::Face[:yardoc, :current].yardoc}.to raise_error(RuntimeError, "The 'rgen' gem must be installed in order to use this face.") + expect{Puppet::Face[:strings, :current].yardoc}.to raise_error(RuntimeError, "The 'rgen' gem must be installed in order to use this face.") end it "should raise an error if the Ruby verion is less than 1.9", :if => RUBY_VERSION.match(/^1\.8/) do - expect{Puppet::Face[:yardoc, :current].yardoc}.to raise_error(RuntimeError, "This face requires Ruby 1.9 or greater.") + expect{Puppet::Face[:strings, :current].yardoc}.to raise_error(RuntimeError, "This face requires Ruby 1.9 or greater.") end it "should invoke Yardoc with MODULE_SOURCEFILES if no arguments are provided" do YARD::CLI::Yardoc.expects(:run).with('manifests/**/*.pp', 'lib/**/*.rb') - Puppet::Face[:yardoc, :current].yardoc + Puppet::Face[:strings, :current].yardoc end it "should invoke Yardoc with provided arguments" do YARD::CLI::Yardoc.expects(:run).with('--debug', 'some_file.rb') - Puppet::Face[:yardoc, :current].yardoc('--debug', 'some_file.rb') + Puppet::Face[:strings, :current].yardoc('--debug', 'some_file.rb') end describe "when generating HTML for documentation" do @@ -39,7 +39,7 @@ describe Puppet::Face do using_module('test') do |tmp| Dir.chdir('test') - Puppet::Face[:yardoc, :current].yardoc + Puppet::Face[:strings, :current].yardoc expect(read_html(tmp, 'test', 'test.html')).to have_tag('.docstring .discussion', :text => /This class/) end @@ -49,7 +49,7 @@ describe Puppet::Face do using_module('test') do |tmp| Dir.chdir('test') - Puppet::Face[:yardoc, :current].yardoc + Puppet::Face[:strings, :current].yardoc expect(read_html(tmp, 'test', 'ParserFunctions.html')).to have_tag('.docstring .discussion', :text => /documentation for `function3x`/) end @@ -59,7 +59,7 @@ describe Puppet::Face do using_module('test') do |tmp| Dir.chdir('test') - Puppet::Face[:yardoc, :current].yardoc + Puppet::Face[:strings, :current].yardoc expect(read_html(tmp, 'test', 'test.html')).to have_tag('.docstring .discussion', :text => /This class/) end @@ -70,32 +70,32 @@ describe Puppet::Face do describe "modules action" do it "should raise an error if yard is absent" do Puppet.features.stubs(:yard?).returns(false) - expect{Puppet::Face[:yardoc, :current].modules}.to raise_error(RuntimeError, "The 'yard' gem must be installed in order to use this face.") + expect{Puppet::Face[:strings, :current].modules}.to raise_error(RuntimeError, "The 'yard' gem must be installed in order to use this face.") end it "should raise an error if rgen is absent" do Puppet.features.stubs(:rgen?).returns(false) - expect{Puppet::Face[:yardoc, :current].modules}.to raise_error(RuntimeError, "The 'rgen' gem must be installed in order to use this face.") + expect{Puppet::Face[:strings, :current].modules}.to raise_error(RuntimeError, "The 'rgen' gem must be installed in order to use this face.") end it "should raise an error if the Ruby version is less than 1.9", :if => RUBY_VERSION.match(/^1\.8/) do - expect{Puppet::Face[:yardoc, :current].modules}.to raise_error(RuntimeError, "This face requires Ruby 1.9 or greater.") + expect{Puppet::Face[:strings, :current].modules}.to raise_error(RuntimeError, "This face requires Ruby 1.9 or greater.") end end describe "server action" do it "should raise an error if yard is absent" do Puppet.features.stubs(:yard?).returns(false) - expect{Puppet::Face[:yardoc, :current].server}.to raise_error(RuntimeError, "The 'yard' gem must be installed in order to use this face.") + expect{Puppet::Face[:strings, :current].server}.to raise_error(RuntimeError, "The 'yard' gem must be installed in order to use this face.") end it "should raise an error if rgen is absent" do Puppet.features.stubs(:rgen?).returns(false) - expect{Puppet::Face[:yardoc, :current].server}.to raise_error(RuntimeError, "The 'rgen' gem must be installed in order to use this face.") + expect{Puppet::Face[:strings, :current].server}.to raise_error(RuntimeError, "The 'rgen' gem must be installed in order to use this face.") end it "should raise an error if the Ruby version is less than 1.9", :if => RUBY_VERSION.match(/^1\.8/) do - expect{Puppet::Face[:yardoc, :current].server}.to raise_error(RuntimeError, "This face requires Ruby 1.9 or greater.") + expect{Puppet::Face[:strings, :current].server}.to raise_error(RuntimeError, "This face requires Ruby 1.9 or greater.") end end diff --git a/spec/unit/puppetx/yardoc/pops_spec.rb b/spec/unit/puppetx/yardoc/pops_spec.rb index 7b14ee9..5e5c017 100644 --- a/spec/unit/puppetx/yardoc/pops_spec.rb +++ b/spec/unit/puppetx/yardoc/pops_spec.rb @@ -1,13 +1,13 @@ require 'spec_helper' -require 'puppetx/yardoc/pops/yard_statement' +require 'puppetx/strings/pops/yard_statement' -describe Puppetx::Yardoc::Pops do +describe Puppetx::Strings::Pops do let(:parser) {Puppet::Pops::Parser::Parser.new()} describe "YARDstatement class" do let(:manifest) {"#hello world\nclass foo { }"} let(:model) {parser.parse_string(manifest).current.definitions.first} - let(:test_statement) {Puppetx::Yardoc::Pops::YARDStatement.new(model)} + let(:test_statement) {Puppetx::Strings::Pops::YARDStatement.new(model)} describe "when creating a new instance of YARDStatement" do it "should extract comments from the source code" do @@ -19,13 +19,13 @@ describe Puppetx::Yardoc::Pops do describe "YARDTransfomer class" do let(:manifest) {"#hello world\nclass foo($bar) { }"} let(:manifest_default) {"#hello world\nclass foo($bar = 3) { }"} - let(:transformer) {Puppetx::Yardoc::Pops::YARDTransformer.new} + let(:transformer) {Puppetx::Strings::Pops::YARDTransformer.new} describe "transform method" do it "should perform the correct transformation with parameter defaults" do model = parser.parse_string(manifest_default).current.definitions.first statements = transformer.transform(model) - expect(statements.parameters[0][0].class).to be(Puppetx::Yardoc::Pops::YARDStatement) + expect(statements.parameters[0][0].class).to be(Puppetx::Strings::Pops::YARDStatement) end it "should perform the correct transofmration without parameter defaults" do diff --git a/spec/unit/puppetx/yardoc/yard/defined_type_handler_spec.rb b/spec/unit/puppetx/yardoc/yard/defined_type_handler_spec.rb index 7d347f2..39467e5 100644 --- a/spec/unit/puppetx/yardoc/yard/defined_type_handler_spec.rb +++ b/spec/unit/puppetx/yardoc/yard/defined_type_handler_spec.rb @@ -1,5 +1,5 @@ require 'spec_helper' -require 'puppetx/yardoc/yard/handlers/defined_type_handler' +require 'puppetx/strings/yard/handlers/defined_type_handler' require 'strings_spec/parsing' diff --git a/spec/unit/puppetx/yardoc/yard/future_parser_function_handler_spec.rb b/spec/unit/puppetx/yardoc/yard/future_parser_function_handler_spec.rb index c62bee7..dd42540 100644 --- a/spec/unit/puppetx/yardoc/yard/future_parser_function_handler_spec.rb +++ b/spec/unit/puppetx/yardoc/yard/future_parser_function_handler_spec.rb @@ -1,5 +1,5 @@ require 'spec_helper' -require 'puppetx/yardoc/yard/handlers/future_parser_function_handler' +require 'puppetx/strings/yard/handlers/future_parser_function_handler' require 'strings_spec/parsing' describe "FutureParserDispatchHandler" do diff --git a/spec/unit/puppetx/yardoc/yard/host_class_handler_spec.rb b/spec/unit/puppetx/yardoc/yard/host_class_handler_spec.rb index e594373..0cdb88c 100644 --- a/spec/unit/puppetx/yardoc/yard/host_class_handler_spec.rb +++ b/spec/unit/puppetx/yardoc/yard/host_class_handler_spec.rb @@ -1,5 +1,5 @@ require 'spec_helper' -require 'puppetx/yardoc/yard/handlers/host_class_handler' +require 'puppetx/strings/yard/handlers/host_class_handler' require 'strings_spec/parsing' describe "HostClassDefintion" do diff --git a/spec/unit/puppetx/yardoc/yard/parser_function_handler_spec.rb b/spec/unit/puppetx/yardoc/yard/parser_function_handler_spec.rb index b84141e..22b91e3 100644 --- a/spec/unit/puppetx/yardoc/yard/parser_function_handler_spec.rb +++ b/spec/unit/puppetx/yardoc/yard/parser_function_handler_spec.rb @@ -1,5 +1,5 @@ require 'spec_helper' -require 'puppetx/yardoc/yard/handlers/parser_function_handler' +require 'puppetx/strings/yard/handlers/parser_function_handler' require 'strings_spec/parsing' describe "ParserFunctionHanlder" do From dabcdf7f06e043209ac4a2bcf72df64f065648a1 Mon Sep 17 00:00:00 2001 From: Hailee Kenney Date: Tue, 16 Sep 2014 09:07:59 -0700 Subject: [PATCH 2/3] (PDOC-3) Add puppetlabs directory In order to keep with conventions around directory structure, add a puppetlabs directory and rename modules accordingly. --- lib/puppet/face/strings.rb | 6 +++--- lib/puppetx/puppetlabs/strings.rb | 16 ++++++++++++++++ .../strings/pops/yard_statement.rb | 2 +- .../strings/pops/yard_transformer.rb | 2 +- .../strings/yard/code_objects.rb | 0 .../yard/code_objects/defined_type_object.rb | 2 +- .../yard/code_objects/host_class_object.rb | 2 +- .../yard/code_objects/puppet_namespace_object.rb | 2 +- .../{ => puppetlabs}/strings/yard/handlers.rb | 0 .../strings/yard/handlers/base.rb | 4 ++-- .../yard/handlers/defined_type_handler.rb | 2 +- .../handlers/future_parser_function_handler.rb | 6 +++--- .../strings/yard/handlers/host_class_handler.rb | 2 +- .../yard/handlers/parser_function_handler.rb | 4 ++-- .../strings/yard/monkey_patches.rb | 0 .../{ => puppetlabs}/strings/yard/parser.rb | 4 ++-- .../{ => puppetlabs}/strings/yard/plugin.rb | 4 ++-- .../definedtype/html/parameter_details.erb | 0 .../templates/default/definedtype/html/setup.rb | 0 .../yard/templates/default/definedtype/setup.rb | 0 .../default/fulldoc/html/full_list_class.erb | 0 .../fulldoc/html/full_list_puppet_manifest.erb | 0 .../fulldoc/html/full_list_puppet_plugin.erb | 0 .../yard/templates/default/fulldoc/html/setup.rb | 0 .../default/hostclass/html/box_info.erb | 0 .../templates/default/hostclass/html/setup.rb | 0 .../default/hostclass/html/subclasses.erb | 0 .../yard/templates/default/hostclass/setup.rb | 0 .../yard/templates/default/layout/html/setup.rb | 0 .../default/puppetnamespace/html/setup.rb | 0 .../templates/default/puppetnamespace/setup.rb | 0 lib/puppetx/strings.rb | 13 ------------- spec/spec_helper.rb | 2 +- .../{yardoc => puppetlabs/strings}/pops_spec.rb | 10 +++++----- .../strings}/yard/defined_type_handler_spec.rb | 2 +- .../yard/future_parser_function_handler_spec.rb | 2 +- .../strings}/yard/host_class_handler_spec.rb | 2 +- .../yard/parser_function_handler_spec.rb | 2 +- 38 files changed, 47 insertions(+), 44 deletions(-) create mode 100644 lib/puppetx/puppetlabs/strings.rb rename lib/puppetx/{ => puppetlabs}/strings/pops/yard_statement.rb (98%) rename lib/puppetx/{ => puppetlabs}/strings/pops/yard_transformer.rb (96%) rename lib/puppetx/{ => puppetlabs}/strings/yard/code_objects.rb (100%) rename lib/puppetx/{ => puppetlabs}/strings/yard/code_objects/defined_type_object.rb (82%) rename lib/puppetx/{ => puppetlabs}/strings/yard/code_objects/host_class_object.rb (94%) rename lib/puppetx/{ => puppetlabs}/strings/yard/code_objects/puppet_namespace_object.rb (96%) rename lib/puppetx/{ => puppetlabs}/strings/yard/handlers.rb (100%) rename lib/puppetx/{ => puppetlabs}/strings/yard/handlers/base.rb (78%) rename lib/puppetx/{ => puppetlabs}/strings/yard/handlers/defined_type_handler.rb (88%) rename lib/puppetx/{ => puppetlabs}/strings/yard/handlers/future_parser_function_handler.rb (95%) rename lib/puppetx/{ => puppetlabs}/strings/yard/handlers/host_class_handler.rb (91%) rename lib/puppetx/{ => puppetlabs}/strings/yard/handlers/parser_function_handler.rb (97%) rename lib/puppetx/{ => puppetlabs}/strings/yard/monkey_patches.rb (100%) rename lib/puppetx/{ => puppetlabs}/strings/yard/parser.rb (83%) rename lib/puppetx/{ => puppetlabs}/strings/yard/plugin.rb (86%) rename lib/puppetx/{ => puppetlabs}/strings/yard/templates/default/definedtype/html/parameter_details.erb (100%) rename lib/puppetx/{ => puppetlabs}/strings/yard/templates/default/definedtype/html/setup.rb (100%) rename lib/puppetx/{ => puppetlabs}/strings/yard/templates/default/definedtype/setup.rb (100%) rename lib/puppetx/{ => puppetlabs}/strings/yard/templates/default/fulldoc/html/full_list_class.erb (100%) rename lib/puppetx/{ => puppetlabs}/strings/yard/templates/default/fulldoc/html/full_list_puppet_manifest.erb (100%) rename lib/puppetx/{ => puppetlabs}/strings/yard/templates/default/fulldoc/html/full_list_puppet_plugin.erb (100%) rename lib/puppetx/{ => puppetlabs}/strings/yard/templates/default/fulldoc/html/setup.rb (100%) rename lib/puppetx/{ => puppetlabs}/strings/yard/templates/default/hostclass/html/box_info.erb (100%) rename lib/puppetx/{ => puppetlabs}/strings/yard/templates/default/hostclass/html/setup.rb (100%) rename lib/puppetx/{ => puppetlabs}/strings/yard/templates/default/hostclass/html/subclasses.erb (100%) rename lib/puppetx/{ => puppetlabs}/strings/yard/templates/default/hostclass/setup.rb (100%) rename lib/puppetx/{ => puppetlabs}/strings/yard/templates/default/layout/html/setup.rb (100%) rename lib/puppetx/{ => puppetlabs}/strings/yard/templates/default/puppetnamespace/html/setup.rb (100%) rename lib/puppetx/{ => puppetlabs}/strings/yard/templates/default/puppetnamespace/setup.rb (100%) delete mode 100644 lib/puppetx/strings.rb rename spec/unit/puppetx/{yardoc => puppetlabs/strings}/pops_spec.rb (79%) rename spec/unit/puppetx/{yardoc => puppetlabs/strings}/yard/defined_type_handler_spec.rb (95%) rename spec/unit/puppetx/{yardoc => puppetlabs/strings}/yard/future_parser_function_handler_spec.rb (95%) rename spec/unit/puppetx/{yardoc => puppetlabs/strings}/yard/host_class_handler_spec.rb (94%) rename spec/unit/puppetx/{yardoc => puppetlabs/strings}/yard/parser_function_handler_spec.rb (95%) diff --git a/lib/puppet/face/strings.rb b/lib/puppet/face/strings.rb index 36b2014..15a67c6 100644 --- a/lib/puppet/face/strings.rb +++ b/lib/puppet/face/strings.rb @@ -54,7 +54,7 @@ Puppet::Face.define(:strings, '0.0.1') do yard_args = (args.empty? ? MODULE_SOURCEFILES : args) merge_puppet_args!(yard_args) - require 'puppetx/strings/yard/plugin' + require 'puppetx/puppetlabs/strings/yard/plugin' # Hand off to YARD for further processing. YARD::CLI::Yardoc.run(*yard_args) @@ -71,7 +71,7 @@ Puppet::Face.define(:strings, '0.0.1') do when_invoked do |*args| check_required_features - require 'puppetx/strings/yard/plugin' + require 'puppetx/puppetlabs/strings/yard/plugin' opts = args.pop # NOTE: The retrun value of the `module` Face seems to have changed in @@ -105,7 +105,7 @@ Puppet::Face.define(:strings, '0.0.1') do when_invoked do |*args| check_required_features - require 'puppetx/strings/yard/plugin' + require 'puppetx/puppetlabs/strings/yard/plugin' opts = args.pop # FIXME: This is pretty inefficient as it forcibly re-generates the YARD diff --git a/lib/puppetx/puppetlabs/strings.rb b/lib/puppetx/puppetlabs/strings.rb new file mode 100644 index 0000000..73e63d3 --- /dev/null +++ b/lib/puppetx/puppetlabs/strings.rb @@ -0,0 +1,16 @@ +require 'puppetx' + +# Nothing to see here except forward declarations. +module Puppetx::PuppetLabs + module Strings + + # This submodule contains bits that interface with the YARD plugin system. + module YARD + end + + # This submodule contains bits that operate on the Pops module produced by + # the Future parser. + module Pops + end + end +end diff --git a/lib/puppetx/strings/pops/yard_statement.rb b/lib/puppetx/puppetlabs/strings/pops/yard_statement.rb similarity index 98% rename from lib/puppetx/strings/pops/yard_statement.rb rename to lib/puppetx/puppetlabs/strings/pops/yard_statement.rb index 4da0723..317ea4b 100644 --- a/lib/puppetx/strings/pops/yard_statement.rb +++ b/lib/puppetx/puppetlabs/strings/pops/yard_statement.rb @@ -3,7 +3,7 @@ require 'puppet/pops' require_relative '../../strings' -module Puppetx::Strings::Pops +module Puppetx::PuppetLabs::Strings::Pops # An adapter class that conforms a Pops model instance + adapters to the # interface expected by YARD handlers. # diff --git a/lib/puppetx/strings/pops/yard_transformer.rb b/lib/puppetx/puppetlabs/strings/pops/yard_transformer.rb similarity index 96% rename from lib/puppetx/strings/pops/yard_transformer.rb rename to lib/puppetx/puppetlabs/strings/pops/yard_transformer.rb index 5227b30..5d1d82a 100644 --- a/lib/puppetx/strings/pops/yard_transformer.rb +++ b/lib/puppetx/puppetlabs/strings/pops/yard_transformer.rb @@ -3,7 +3,7 @@ require 'puppet/pops' require_relative '../../strings' require_relative 'yard_statement' -module Puppetx::Strings::Pops +module Puppetx::PuppetLabs::Strings::Pops # Loosely based on the TreeDumper classes in Pops::Model. The responsibility of # this class is to walk a Pops::Model and output objects that can be consumed # by YARD handlers. diff --git a/lib/puppetx/strings/yard/code_objects.rb b/lib/puppetx/puppetlabs/strings/yard/code_objects.rb similarity index 100% rename from lib/puppetx/strings/yard/code_objects.rb rename to lib/puppetx/puppetlabs/strings/yard/code_objects.rb diff --git a/lib/puppetx/strings/yard/code_objects/defined_type_object.rb b/lib/puppetx/puppetlabs/strings/yard/code_objects/defined_type_object.rb similarity index 82% rename from lib/puppetx/strings/yard/code_objects/defined_type_object.rb rename to lib/puppetx/puppetlabs/strings/yard/code_objects/defined_type_object.rb index 541f521..f6a4c7f 100644 --- a/lib/puppetx/strings/yard/code_objects/defined_type_object.rb +++ b/lib/puppetx/puppetlabs/strings/yard/code_objects/defined_type_object.rb @@ -2,7 +2,7 @@ require 'puppet/pops' require_relative 'puppet_namespace_object' -module Puppetx::Strings::YARD::CodeObjects +module Puppetx::PuppetLabs::Strings::YARD::CodeObjects class DefinedTypeObject < PuppetNamespaceObject # A list of parameters attached to this class. # @return [Array] diff --git a/lib/puppetx/strings/yard/code_objects/host_class_object.rb b/lib/puppetx/puppetlabs/strings/yard/code_objects/host_class_object.rb similarity index 94% rename from lib/puppetx/strings/yard/code_objects/host_class_object.rb rename to lib/puppetx/puppetlabs/strings/yard/code_objects/host_class_object.rb index f4f64ab..3d94267 100644 --- a/lib/puppetx/strings/yard/code_objects/host_class_object.rb +++ b/lib/puppetx/puppetlabs/strings/yard/code_objects/host_class_object.rb @@ -1,6 +1,6 @@ require_relative 'defined_type_object' -module Puppetx::Strings::YARD::CodeObjects +module Puppetx::PuppetLabs::Strings::YARD::CodeObjects class HostClassObject < DefinedTypeObject # The {HostClassObject} that this class inherits from, if any. # @return [HostClassObject, Proxy, nil] diff --git a/lib/puppetx/strings/yard/code_objects/puppet_namespace_object.rb b/lib/puppetx/puppetlabs/strings/yard/code_objects/puppet_namespace_object.rb similarity index 96% rename from lib/puppetx/strings/yard/code_objects/puppet_namespace_object.rb rename to lib/puppetx/puppetlabs/strings/yard/code_objects/puppet_namespace_object.rb index b84aa33..1dd0517 100644 --- a/lib/puppetx/strings/yard/code_objects/puppet_namespace_object.rb +++ b/lib/puppetx/puppetlabs/strings/yard/code_objects/puppet_namespace_object.rb @@ -2,7 +2,7 @@ require 'yard' require_relative '../../../strings' -module Puppetx::Strings::YARD::CodeObjects +module Puppetx::PuppetLabs::Strings::YARD::CodeObjects class PuppetNamespaceObject < YARD::CodeObjects::NamespaceObject # NOTE: `YARD::Registry#resolve` requires a method with this signature to # be present on all subclasses of `NamespaceObject`. diff --git a/lib/puppetx/strings/yard/handlers.rb b/lib/puppetx/puppetlabs/strings/yard/handlers.rb similarity index 100% rename from lib/puppetx/strings/yard/handlers.rb rename to lib/puppetx/puppetlabs/strings/yard/handlers.rb diff --git a/lib/puppetx/strings/yard/handlers/base.rb b/lib/puppetx/puppetlabs/strings/yard/handlers/base.rb similarity index 78% rename from lib/puppetx/strings/yard/handlers/base.rb rename to lib/puppetx/puppetlabs/strings/yard/handlers/base.rb index 85d41e0..f0be1f6 100644 --- a/lib/puppetx/strings/yard/handlers/base.rb +++ b/lib/puppetx/puppetlabs/strings/yard/handlers/base.rb @@ -4,12 +4,12 @@ require 'puppet/pops' require_relative '../../../strings' require_relative '../code_objects' -module Puppetx::Strings::YARD::Handlers +module Puppetx::PuppetLabs::Strings::YARD::Handlers class Base < YARD::Handlers::Base # Easy access to Pops model objects for handler matching. include Puppet::Pops::Model # Easy access to custom code objects from which documentation is generated. - include Puppetx::Strings::YARD::CodeObjects + include Puppetx::PuppetLabs::Strings::YARD::CodeObjects def self.handles?(statement) handlers.any? {|h| h == statement.type} diff --git a/lib/puppetx/strings/yard/handlers/defined_type_handler.rb b/lib/puppetx/puppetlabs/strings/yard/handlers/defined_type_handler.rb similarity index 88% rename from lib/puppetx/strings/yard/handlers/defined_type_handler.rb rename to lib/puppetx/puppetlabs/strings/yard/handlers/defined_type_handler.rb index 99247e0..9b4ac50 100644 --- a/lib/puppetx/strings/yard/handlers/defined_type_handler.rb +++ b/lib/puppetx/puppetlabs/strings/yard/handlers/defined_type_handler.rb @@ -1,6 +1,6 @@ require_relative 'base' -module Puppetx::Strings::YARD::Handlers +module Puppetx::PuppetLabs::Strings::YARD::Handlers class DefinedTypeHandler < Base handles ResourceTypeDefinition diff --git a/lib/puppetx/strings/yard/handlers/future_parser_function_handler.rb b/lib/puppetx/puppetlabs/strings/yard/handlers/future_parser_function_handler.rb similarity index 95% rename from lib/puppetx/strings/yard/handlers/future_parser_function_handler.rb rename to lib/puppetx/puppetlabs/strings/yard/handlers/future_parser_function_handler.rb index 850a2be..f87bf31 100644 --- a/lib/puppetx/strings/yard/handlers/future_parser_function_handler.rb +++ b/lib/puppetx/puppetlabs/strings/yard/handlers/future_parser_function_handler.rb @@ -1,11 +1,11 @@ require_relative '../code_objects' -module Puppetx::Strings::YARD::Handlers +module Puppetx::PuppetLabs::Strings::YARD::Handlers # Handles `dispatch` calls within a future parser function declaration. For # now, it just treats any docstring as an `@overlaod` tag and attaches the # overload to the parent function. class FutureParserDispatchHandler < YARD::Handlers::Ruby::Base - include Puppetx::Strings::YARD::CodeObjects + include Puppetx::PuppetLabs::Strings::YARD::CodeObjects handles method_call(:dispatch) @@ -22,7 +22,7 @@ module Puppetx::Strings::YARD::Handlers end class FutureParserFunctionHandler < YARD::Handlers::Ruby::Base - include Puppetx::Strings::YARD::CodeObjects + include Puppetx::PuppetLabs::Strings::YARD::CodeObjects handles method_call(:create_function) diff --git a/lib/puppetx/strings/yard/handlers/host_class_handler.rb b/lib/puppetx/puppetlabs/strings/yard/handlers/host_class_handler.rb similarity index 91% rename from lib/puppetx/strings/yard/handlers/host_class_handler.rb rename to lib/puppetx/puppetlabs/strings/yard/handlers/host_class_handler.rb index 827d60d..7a1e395 100644 --- a/lib/puppetx/strings/yard/handlers/host_class_handler.rb +++ b/lib/puppetx/puppetlabs/strings/yard/handlers/host_class_handler.rb @@ -1,6 +1,6 @@ require_relative 'base' -module Puppetx::Strings::YARD::Handlers +module Puppetx::PuppetLabs::Strings::YARD::Handlers class HostClassHandler < Base handles HostClassDefinition diff --git a/lib/puppetx/strings/yard/handlers/parser_function_handler.rb b/lib/puppetx/puppetlabs/strings/yard/handlers/parser_function_handler.rb similarity index 97% rename from lib/puppetx/strings/yard/handlers/parser_function_handler.rb rename to lib/puppetx/puppetlabs/strings/yard/handlers/parser_function_handler.rb index 153405b..8e41995 100644 --- a/lib/puppetx/strings/yard/handlers/parser_function_handler.rb +++ b/lib/puppetx/puppetlabs/strings/yard/handlers/parser_function_handler.rb @@ -3,9 +3,9 @@ require 'puppet/util/docs' require_relative '../code_objects' -module Puppetx::Strings::YARD::Handlers +module Puppetx::PuppetLabs::Strings::YARD::Handlers class ParserFunctionHandler < YARD::Handlers::Ruby::Base - include Puppetx::Strings::YARD::CodeObjects + include Puppetx::PuppetLabs::Strings::YARD::CodeObjects handles method_call(:newfunction) diff --git a/lib/puppetx/strings/yard/monkey_patches.rb b/lib/puppetx/puppetlabs/strings/yard/monkey_patches.rb similarity index 100% rename from lib/puppetx/strings/yard/monkey_patches.rb rename to lib/puppetx/puppetlabs/strings/yard/monkey_patches.rb diff --git a/lib/puppetx/strings/yard/parser.rb b/lib/puppetx/puppetlabs/strings/yard/parser.rb similarity index 83% rename from lib/puppetx/strings/yard/parser.rb rename to lib/puppetx/puppetlabs/strings/yard/parser.rb index 037e49a..50923bd 100644 --- a/lib/puppetx/strings/yard/parser.rb +++ b/lib/puppetx/puppetlabs/strings/yard/parser.rb @@ -4,7 +4,7 @@ require 'puppet/pops' require_relative '../../strings' require_relative '../pops/yard_transformer' -module Puppetx::Strings::YARD +module Puppetx::PuppetLabs::Strings::YARD class PuppetParser < YARD::Parser::Base attr_reader :file, :source @@ -13,7 +13,7 @@ module Puppetx::Strings::YARD @file = filename @parser = Puppet::Pops::Parser::Parser.new() - @transformer = Puppetx::Strings::Pops::YARDTransformer.new() + @transformer = Puppetx::PuppetLabs::Strings::Pops::YARDTransformer.new() end def parse diff --git a/lib/puppetx/strings/yard/plugin.rb b/lib/puppetx/puppetlabs/strings/yard/plugin.rb similarity index 86% rename from lib/puppetx/strings/yard/plugin.rb rename to lib/puppetx/puppetlabs/strings/yard/plugin.rb index 9ee1430..58fd0da 100644 --- a/lib/puppetx/strings/yard/plugin.rb +++ b/lib/puppetx/puppetlabs/strings/yard/plugin.rb @@ -10,10 +10,10 @@ require_relative 'parser' require_relative 'handlers' YARD::Parser::SourceParser.register_parser_type(:puppet, - Puppetx::Strings::YARD::PuppetParser, + Puppetx::PuppetLabs::Strings::YARD::PuppetParser, ['pp']) YARD::Handlers::Processor.register_handler_namespace(:puppet, - Puppetx::Strings::YARD::Handlers) + Puppetx::PuppetLabs::Strings::YARD::Handlers) # FIXME: Might not be the best idea to have the template code on the Ruby # LOAD_PATH as the contents of this directory really aren't library code. diff --git a/lib/puppetx/strings/yard/templates/default/definedtype/html/parameter_details.erb b/lib/puppetx/puppetlabs/strings/yard/templates/default/definedtype/html/parameter_details.erb similarity index 100% rename from lib/puppetx/strings/yard/templates/default/definedtype/html/parameter_details.erb rename to lib/puppetx/puppetlabs/strings/yard/templates/default/definedtype/html/parameter_details.erb diff --git a/lib/puppetx/strings/yard/templates/default/definedtype/html/setup.rb b/lib/puppetx/puppetlabs/strings/yard/templates/default/definedtype/html/setup.rb similarity index 100% rename from lib/puppetx/strings/yard/templates/default/definedtype/html/setup.rb rename to lib/puppetx/puppetlabs/strings/yard/templates/default/definedtype/html/setup.rb diff --git a/lib/puppetx/strings/yard/templates/default/definedtype/setup.rb b/lib/puppetx/puppetlabs/strings/yard/templates/default/definedtype/setup.rb similarity index 100% rename from lib/puppetx/strings/yard/templates/default/definedtype/setup.rb rename to lib/puppetx/puppetlabs/strings/yard/templates/default/definedtype/setup.rb diff --git a/lib/puppetx/strings/yard/templates/default/fulldoc/html/full_list_class.erb b/lib/puppetx/puppetlabs/strings/yard/templates/default/fulldoc/html/full_list_class.erb similarity index 100% rename from lib/puppetx/strings/yard/templates/default/fulldoc/html/full_list_class.erb rename to lib/puppetx/puppetlabs/strings/yard/templates/default/fulldoc/html/full_list_class.erb diff --git a/lib/puppetx/strings/yard/templates/default/fulldoc/html/full_list_puppet_manifest.erb b/lib/puppetx/puppetlabs/strings/yard/templates/default/fulldoc/html/full_list_puppet_manifest.erb similarity index 100% rename from lib/puppetx/strings/yard/templates/default/fulldoc/html/full_list_puppet_manifest.erb rename to lib/puppetx/puppetlabs/strings/yard/templates/default/fulldoc/html/full_list_puppet_manifest.erb diff --git a/lib/puppetx/strings/yard/templates/default/fulldoc/html/full_list_puppet_plugin.erb b/lib/puppetx/puppetlabs/strings/yard/templates/default/fulldoc/html/full_list_puppet_plugin.erb similarity index 100% rename from lib/puppetx/strings/yard/templates/default/fulldoc/html/full_list_puppet_plugin.erb rename to lib/puppetx/puppetlabs/strings/yard/templates/default/fulldoc/html/full_list_puppet_plugin.erb diff --git a/lib/puppetx/strings/yard/templates/default/fulldoc/html/setup.rb b/lib/puppetx/puppetlabs/strings/yard/templates/default/fulldoc/html/setup.rb similarity index 100% rename from lib/puppetx/strings/yard/templates/default/fulldoc/html/setup.rb rename to lib/puppetx/puppetlabs/strings/yard/templates/default/fulldoc/html/setup.rb diff --git a/lib/puppetx/strings/yard/templates/default/hostclass/html/box_info.erb b/lib/puppetx/puppetlabs/strings/yard/templates/default/hostclass/html/box_info.erb similarity index 100% rename from lib/puppetx/strings/yard/templates/default/hostclass/html/box_info.erb rename to lib/puppetx/puppetlabs/strings/yard/templates/default/hostclass/html/box_info.erb diff --git a/lib/puppetx/strings/yard/templates/default/hostclass/html/setup.rb b/lib/puppetx/puppetlabs/strings/yard/templates/default/hostclass/html/setup.rb similarity index 100% rename from lib/puppetx/strings/yard/templates/default/hostclass/html/setup.rb rename to lib/puppetx/puppetlabs/strings/yard/templates/default/hostclass/html/setup.rb diff --git a/lib/puppetx/strings/yard/templates/default/hostclass/html/subclasses.erb b/lib/puppetx/puppetlabs/strings/yard/templates/default/hostclass/html/subclasses.erb similarity index 100% rename from lib/puppetx/strings/yard/templates/default/hostclass/html/subclasses.erb rename to lib/puppetx/puppetlabs/strings/yard/templates/default/hostclass/html/subclasses.erb diff --git a/lib/puppetx/strings/yard/templates/default/hostclass/setup.rb b/lib/puppetx/puppetlabs/strings/yard/templates/default/hostclass/setup.rb similarity index 100% rename from lib/puppetx/strings/yard/templates/default/hostclass/setup.rb rename to lib/puppetx/puppetlabs/strings/yard/templates/default/hostclass/setup.rb diff --git a/lib/puppetx/strings/yard/templates/default/layout/html/setup.rb b/lib/puppetx/puppetlabs/strings/yard/templates/default/layout/html/setup.rb similarity index 100% rename from lib/puppetx/strings/yard/templates/default/layout/html/setup.rb rename to lib/puppetx/puppetlabs/strings/yard/templates/default/layout/html/setup.rb diff --git a/lib/puppetx/strings/yard/templates/default/puppetnamespace/html/setup.rb b/lib/puppetx/puppetlabs/strings/yard/templates/default/puppetnamespace/html/setup.rb similarity index 100% rename from lib/puppetx/strings/yard/templates/default/puppetnamespace/html/setup.rb rename to lib/puppetx/puppetlabs/strings/yard/templates/default/puppetnamespace/html/setup.rb diff --git a/lib/puppetx/strings/yard/templates/default/puppetnamespace/setup.rb b/lib/puppetx/puppetlabs/strings/yard/templates/default/puppetnamespace/setup.rb similarity index 100% rename from lib/puppetx/strings/yard/templates/default/puppetnamespace/setup.rb rename to lib/puppetx/puppetlabs/strings/yard/templates/default/puppetnamespace/setup.rb diff --git a/lib/puppetx/strings.rb b/lib/puppetx/strings.rb deleted file mode 100644 index bcd21c5..0000000 --- a/lib/puppetx/strings.rb +++ /dev/null @@ -1,13 +0,0 @@ -require 'puppetx' - -# Nothing to see here except forward declarations. -module Puppetx::Strings - # This submodule contains bits that interface with the YARD plugin system. - module YARD - end - - # This submodule contains bits that operate on the Pops module produced by - # the Future parser. - module Pops - end -end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index c4d2ee9..725c4f6 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -6,7 +6,7 @@ require 'puppet' require 'rspec' # This is neeeded so we can access a Registry if YARD creates one -require 'puppetx/strings/yard/plugin' +require 'puppetx/puppetlabs/strings/yard/plugin' include YARD RSpec.configure do |config| diff --git a/spec/unit/puppetx/yardoc/pops_spec.rb b/spec/unit/puppetx/puppetlabs/strings/pops_spec.rb similarity index 79% rename from spec/unit/puppetx/yardoc/pops_spec.rb rename to spec/unit/puppetx/puppetlabs/strings/pops_spec.rb index 5e5c017..d3a9d26 100644 --- a/spec/unit/puppetx/yardoc/pops_spec.rb +++ b/spec/unit/puppetx/puppetlabs/strings/pops_spec.rb @@ -1,13 +1,13 @@ require 'spec_helper' -require 'puppetx/strings/pops/yard_statement' +require 'puppetx/puppetlabs/strings/pops/yard_statement' -describe Puppetx::Strings::Pops do +describe Puppetx::PuppetLabs::Strings::Pops do let(:parser) {Puppet::Pops::Parser::Parser.new()} describe "YARDstatement class" do let(:manifest) {"#hello world\nclass foo { }"} let(:model) {parser.parse_string(manifest).current.definitions.first} - let(:test_statement) {Puppetx::Strings::Pops::YARDStatement.new(model)} + let(:test_statement) {Puppetx::PuppetLabs::Strings::Pops::YARDStatement.new(model)} describe "when creating a new instance of YARDStatement" do it "should extract comments from the source code" do @@ -19,13 +19,13 @@ describe Puppetx::Strings::Pops do describe "YARDTransfomer class" do let(:manifest) {"#hello world\nclass foo($bar) { }"} let(:manifest_default) {"#hello world\nclass foo($bar = 3) { }"} - let(:transformer) {Puppetx::Strings::Pops::YARDTransformer.new} + let(:transformer) {Puppetx::PuppetLabs::Strings::Pops::YARDTransformer.new} describe "transform method" do it "should perform the correct transformation with parameter defaults" do model = parser.parse_string(manifest_default).current.definitions.first statements = transformer.transform(model) - expect(statements.parameters[0][0].class).to be(Puppetx::Strings::Pops::YARDStatement) + expect(statements.parameters[0][0].class).to be(Puppetx::PuppetLabs::Strings::Pops::YARDStatement) end it "should perform the correct transofmration without parameter defaults" do diff --git a/spec/unit/puppetx/yardoc/yard/defined_type_handler_spec.rb b/spec/unit/puppetx/puppetlabs/strings/yard/defined_type_handler_spec.rb similarity index 95% rename from spec/unit/puppetx/yardoc/yard/defined_type_handler_spec.rb rename to spec/unit/puppetx/puppetlabs/strings/yard/defined_type_handler_spec.rb index 39467e5..ce42c2c 100644 --- a/spec/unit/puppetx/yardoc/yard/defined_type_handler_spec.rb +++ b/spec/unit/puppetx/puppetlabs/strings/yard/defined_type_handler_spec.rb @@ -1,5 +1,5 @@ require 'spec_helper' -require 'puppetx/strings/yard/handlers/defined_type_handler' +require 'puppetx/puppetlabs/strings/yard/handlers/defined_type_handler' require 'strings_spec/parsing' diff --git a/spec/unit/puppetx/yardoc/yard/future_parser_function_handler_spec.rb b/spec/unit/puppetx/puppetlabs/strings/yard/future_parser_function_handler_spec.rb similarity index 95% rename from spec/unit/puppetx/yardoc/yard/future_parser_function_handler_spec.rb rename to spec/unit/puppetx/puppetlabs/strings/yard/future_parser_function_handler_spec.rb index dd42540..0207197 100644 --- a/spec/unit/puppetx/yardoc/yard/future_parser_function_handler_spec.rb +++ b/spec/unit/puppetx/puppetlabs/strings/yard/future_parser_function_handler_spec.rb @@ -1,5 +1,5 @@ require 'spec_helper' -require 'puppetx/strings/yard/handlers/future_parser_function_handler' +require 'puppetx/puppetlabs/strings/yard/handlers/future_parser_function_handler' require 'strings_spec/parsing' describe "FutureParserDispatchHandler" do diff --git a/spec/unit/puppetx/yardoc/yard/host_class_handler_spec.rb b/spec/unit/puppetx/puppetlabs/strings/yard/host_class_handler_spec.rb similarity index 94% rename from spec/unit/puppetx/yardoc/yard/host_class_handler_spec.rb rename to spec/unit/puppetx/puppetlabs/strings/yard/host_class_handler_spec.rb index 0cdb88c..2897f72 100644 --- a/spec/unit/puppetx/yardoc/yard/host_class_handler_spec.rb +++ b/spec/unit/puppetx/puppetlabs/strings/yard/host_class_handler_spec.rb @@ -1,5 +1,5 @@ require 'spec_helper' -require 'puppetx/strings/yard/handlers/host_class_handler' +require 'puppetx/puppetlabs/strings/yard/handlers/host_class_handler' require 'strings_spec/parsing' describe "HostClassDefintion" do diff --git a/spec/unit/puppetx/yardoc/yard/parser_function_handler_spec.rb b/spec/unit/puppetx/puppetlabs/strings/yard/parser_function_handler_spec.rb similarity index 95% rename from spec/unit/puppetx/yardoc/yard/parser_function_handler_spec.rb rename to spec/unit/puppetx/puppetlabs/strings/yard/parser_function_handler_spec.rb index 22b91e3..4ff08d7 100644 --- a/spec/unit/puppetx/yardoc/yard/parser_function_handler_spec.rb +++ b/spec/unit/puppetx/puppetlabs/strings/yard/parser_function_handler_spec.rb @@ -1,5 +1,5 @@ require 'spec_helper' -require 'puppetx/strings/yard/handlers/parser_function_handler' +require 'puppetx/puppetlabs/strings/yard/handlers/parser_function_handler' require 'strings_spec/parsing' describe "ParserFunctionHanlder" do From ebbc2936df009e8c99103678804cf04ac076e1e8 Mon Sep 17 00:00:00 2001 From: Hailee Kenney Date: Wed, 17 Sep 2014 10:10:38 -0700 Subject: [PATCH 3/3] (PDOC-3) Rename FutureParser and ParserFunctions Prior to this commit, the handlers and code objects which dealt with puppet functions were referred to as `FutureParserFunctions` and `ParseFunctions`. This naming convention will not make very much sense going forward when the future parser becomes the primary parser. Therefor, rename `FutureParserFunctions` to `Puppet4xFunctions` and `ParserFunctions` to `Puppet3xFunctions`. --- lib/puppetx/puppetlabs/strings/yard/handlers.rb | 4 ++-- ..._handler.rb => puppet_3x_function_handler.rb} | 8 ++++---- ..._handler.rb => puppet_4x_function_handler.rb} | 14 +++++++------- .../fulldoc/html/full_list_puppet_plugin.erb | 16 ++++++++-------- spec/unit/puppet/face_spec.rb | 2 +- .../yard/future_parser_function_handler_spec.rb | 8 ++++---- .../strings/yard/parser_function_handler_spec.rb | 8 ++++---- 7 files changed, 30 insertions(+), 30 deletions(-) rename lib/puppetx/puppetlabs/strings/yard/handlers/{parser_function_handler.rb => puppet_3x_function_handler.rb} (93%) rename lib/puppetx/puppetlabs/strings/yard/handlers/{future_parser_function_handler.rb => puppet_4x_function_handler.rb} (88%) diff --git a/lib/puppetx/puppetlabs/strings/yard/handlers.rb b/lib/puppetx/puppetlabs/strings/yard/handlers.rb index 71a966b..3e3f694 100644 --- a/lib/puppetx/puppetlabs/strings/yard/handlers.rb +++ b/lib/puppetx/puppetlabs/strings/yard/handlers.rb @@ -2,5 +2,5 @@ require_relative 'handlers/base' require_relative 'handlers/defined_type_handler' require_relative 'handlers/host_class_handler' -require_relative 'handlers/parser_function_handler' -require_relative 'handlers/future_parser_function_handler' +require_relative 'handlers/puppet_3x_function_handler' +require_relative 'handlers/puppet_4x_function_handler' diff --git a/lib/puppetx/puppetlabs/strings/yard/handlers/parser_function_handler.rb b/lib/puppetx/puppetlabs/strings/yard/handlers/puppet_3x_function_handler.rb similarity index 93% rename from lib/puppetx/puppetlabs/strings/yard/handlers/parser_function_handler.rb rename to lib/puppetx/puppetlabs/strings/yard/handlers/puppet_3x_function_handler.rb index 8e41995..8c174cf 100644 --- a/lib/puppetx/puppetlabs/strings/yard/handlers/parser_function_handler.rb +++ b/lib/puppetx/puppetlabs/strings/yard/handlers/puppet_3x_function_handler.rb @@ -4,7 +4,7 @@ require 'puppet/util/docs' require_relative '../code_objects' module Puppetx::PuppetLabs::Strings::YARD::Handlers - class ParserFunctionHandler < YARD::Handlers::Ruby::Base + class Puppet3xFunctionHandler < YARD::Handlers::Ruby::Base include Puppetx::PuppetLabs::Strings::YARD::CodeObjects handles method_call(:newfunction) @@ -40,11 +40,11 @@ module Puppetx::PuppetLabs::Strings::YARD::Handlers # @return [PuppetNamespaceObject] def function_namespace # NOTE: This tricky. If there is ever a Ruby class or module with the - # name ::ParserFunctions, then there will be a clash. Hopefully the name + # name ::Puppet3xFunctions, then there will be a clash. Hopefully the name # is sufficiently uncommon. - obj = P(:root, 'ParserFunctions') + obj = P(:root, 'Puppet3xFunctions') if obj.is_a? Proxy - namespace_obj = PuppetNamespaceObject.new(:root, 'ParserFunctions') + namespace_obj = PuppetNamespaceObject.new(:root, 'Puppet3xFunctions') namespace_obj.add_tag YARD::Tags::Tag.new(:api, 'public') register namespace_obj diff --git a/lib/puppetx/puppetlabs/strings/yard/handlers/future_parser_function_handler.rb b/lib/puppetx/puppetlabs/strings/yard/handlers/puppet_4x_function_handler.rb similarity index 88% rename from lib/puppetx/puppetlabs/strings/yard/handlers/future_parser_function_handler.rb rename to lib/puppetx/puppetlabs/strings/yard/handlers/puppet_4x_function_handler.rb index f87bf31..f52edb8 100644 --- a/lib/puppetx/puppetlabs/strings/yard/handlers/future_parser_function_handler.rb +++ b/lib/puppetx/puppetlabs/strings/yard/handlers/puppet_4x_function_handler.rb @@ -4,13 +4,13 @@ module Puppetx::PuppetLabs::Strings::YARD::Handlers # Handles `dispatch` calls within a future parser function declaration. For # now, it just treats any docstring as an `@overlaod` tag and attaches the # overload to the parent function. - class FutureParserDispatchHandler < YARD::Handlers::Ruby::Base + class Puppet4xFunctionHandler < YARD::Handlers::Ruby::Base include Puppetx::PuppetLabs::Strings::YARD::CodeObjects handles method_call(:dispatch) process do - return unless owner.is_a?(MethodObject) && owner['future_parser_function'] + return unless owner.is_a?(MethodObject) && owner['puppet_4x_function'] return unless statement.docstring docstring = ::YARD::Docstring.new(statement.docstring, nil) @@ -21,7 +21,7 @@ module Puppetx::PuppetLabs::Strings::YARD::Handlers end end - class FutureParserFunctionHandler < YARD::Handlers::Ruby::Base + class Puppet4xFunctionHandler < YARD::Handlers::Ruby::Base include Puppetx::PuppetLabs::Strings::YARD::CodeObjects handles method_call(:create_function) @@ -30,7 +30,7 @@ module Puppetx::PuppetLabs::Strings::YARD::Handlers name = process_parameters obj = MethodObject.new(function_namespace, name) - obj['future_parser_function'] = true + obj['puppet_4x_function'] = true register obj @@ -48,11 +48,11 @@ module Puppetx::PuppetLabs::Strings::YARD::Handlers # @return [PuppetNamespaceObject] def function_namespace # NOTE: This tricky. If there is ever a Ruby class or module with the - # name ::ParserFunctions, then there will be a clash. Hopefully the name + # name ::Puppet4xFunctions, then there will be a clash. Hopefully the name # is sufficiently uncommon. - obj = P(:root, 'FutureParserFunctions') + obj = P(:root, 'Puppet4xFunctions') if obj.is_a? Proxy - namespace_obj = PuppetNamespaceObject.new(:root, 'FutureParserFunctions') + namespace_obj = PuppetNamespaceObject.new(:root, 'Puppet4xFunctions') register namespace_obj # FIXME: The docstring has to be cleared. Otherwise, the namespace diff --git a/lib/puppetx/puppetlabs/strings/yard/templates/default/fulldoc/html/full_list_puppet_plugin.erb b/lib/puppetx/puppetlabs/strings/yard/templates/default/fulldoc/html/full_list_puppet_plugin.erb index ffa7eec..241b6cc 100644 --- a/lib/puppetx/puppetlabs/strings/yard/templates/default/fulldoc/html/full_list_puppet_plugin.erb +++ b/lib/puppetx/puppetlabs/strings/yard/templates/default/fulldoc/html/full_list_puppet_plugin.erb @@ -1,21 +1,21 @@ -<% unless P(:root, 'ParserFunctions').is_a?(CodeObjects::Proxy) %> +<% unless P(:root, 'Puppet3xFunctions').is_a?(CodeObjects::Proxy) %>
  • - <%= link_object(P(:root, 'ParserFunctions'), 'Parser Functions', nil, false) %> - ParserFunctions + <%= link_object(P(:root, 'Puppet3xFunctions'), 'Puppet 3x Functions', nil, false) %> + Puppet3xFunctions
    • - <%= namespace_list(:root => P(:root,'ParserFunctions'), :namespace_types => [:puppetnamespace, :method]) %> + <%= namespace_list(:root => P(:root,'Puppet3xFunctions'), :namespace_types => [:puppetnamespace, :method]) %>
    <% end %> -<% unless P(:root, 'FutureParserFunctions').is_a?(CodeObjects::Proxy) %> +<% unless P(:root, 'Puppet4xFunctions').is_a?(CodeObjects::Proxy) %>
  • - <%= link_object(P(:root, 'FutureParserFunctions'), 'Future Parser Functions', nil, false) %> - FutureParserFunctions + <%= link_object(P(:root, 'Puppet4xFunctions'), 'Puppet 4x Functions', nil, false) %> + Puppet4xFunctions
    • - <%= namespace_list(:root => P(:root,'FutureParserFunctions'), :namespace_types => [:puppetnamespace, :method]) %> + <%= namespace_list(:root => P(:root,'Puppet4xFunctions'), :namespace_types => [:puppetnamespace, :method]) %>
    <% end %> diff --git a/spec/unit/puppet/face_spec.rb b/spec/unit/puppet/face_spec.rb index 037ae44..e033a8a 100644 --- a/spec/unit/puppet/face_spec.rb +++ b/spec/unit/puppet/face_spec.rb @@ -51,7 +51,7 @@ describe Puppet::Face do Puppet::Face[:strings, :current].yardoc - expect(read_html(tmp, 'test', 'ParserFunctions.html')).to have_tag('.docstring .discussion', :text => /documentation for `function3x`/) + expect(read_html(tmp, 'test', 'Puppet3xFunctions.html')).to have_tag('.docstring .discussion', :text => /documentation for `function3x`/) end end diff --git a/spec/unit/puppetx/puppetlabs/strings/yard/future_parser_function_handler_spec.rb b/spec/unit/puppetx/puppetlabs/strings/yard/future_parser_function_handler_spec.rb index 0207197..c82b552 100644 --- a/spec/unit/puppetx/puppetlabs/strings/yard/future_parser_function_handler_spec.rb +++ b/spec/unit/puppetx/puppetlabs/strings/yard/future_parser_function_handler_spec.rb @@ -1,16 +1,16 @@ require 'spec_helper' -require 'puppetx/puppetlabs/strings/yard/handlers/future_parser_function_handler' +require 'puppetx/puppetlabs/strings/yard/handlers/puppet_4x_function_handler' require 'strings_spec/parsing' -describe "FutureParserDispatchHandler" do +describe "Pupet4xFunctionHandler" do include StringsSpec::Parsing def the_method() - Registry.at("FutureParserFunctions#the_function") + Registry.at("Puppet4xFunctions#the_function") end def the_namespace() - Registry.at("FutureParserFunctions") + Registry.at("Puppet4xFunctions") end it "should parse single-line documentation strings before a given function" do diff --git a/spec/unit/puppetx/puppetlabs/strings/yard/parser_function_handler_spec.rb b/spec/unit/puppetx/puppetlabs/strings/yard/parser_function_handler_spec.rb index 4ff08d7..dd2e1f1 100644 --- a/spec/unit/puppetx/puppetlabs/strings/yard/parser_function_handler_spec.rb +++ b/spec/unit/puppetx/puppetlabs/strings/yard/parser_function_handler_spec.rb @@ -1,16 +1,16 @@ require 'spec_helper' -require 'puppetx/puppetlabs/strings/yard/handlers/parser_function_handler' +require 'puppetx/puppetlabs/strings/yard/handlers/puppet_3x_function_handler' require 'strings_spec/parsing' -describe "ParserFunctionHanlder" do +describe "Puppet3xFunctionHanlder" do include StringsSpec::Parsing def the_method() - Registry.at("ParserFunctions#the_function") + Registry.at("Puppet3xFunctions#the_function") end def the_namespace() - Registry.at("ParserFunctions") + Registry.at("Puppet3xFunctions") end it "should parse single-line documentation strings before a given function" do