From ebbc2936df009e8c99103678804cf04ac076e1e8 Mon Sep 17 00:00:00 2001 From: Hailee Kenney Date: Wed, 17 Sep 2014 10:10:38 -0700 Subject: [PATCH] (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
  • <% 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
  • <% 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