(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`.
This commit is contained in:
Hailee Kenney 2014-09-17 10:10:38 -07:00
parent dabcdf7f06
commit ebbc2936df
7 changed files with 30 additions and 30 deletions

View File

@ -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'

View File

@ -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

View File

@ -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

View File

@ -1,21 +1,21 @@
<% unless P(:root, 'ParserFunctions').is_a?(CodeObjects::Proxy) %>
<% unless P(:root, 'Puppet3xFunctions').is_a?(CodeObjects::Proxy) %>
<li>
<a class='toggle'></a>
<%= link_object(P(:root, 'ParserFunctions'), 'Parser Functions', nil, false) %>
<small class='search_info'>ParserFunctions</small>
<%= link_object(P(:root, 'Puppet3xFunctions'), 'Puppet 3x Functions', nil, false) %>
<small class='search_info'>Puppet3xFunctions</small>
</li>
<ul>
<%= namespace_list(:root => P(:root,'ParserFunctions'), :namespace_types => [:puppetnamespace, :method]) %>
<%= namespace_list(:root => P(:root,'Puppet3xFunctions'), :namespace_types => [:puppetnamespace, :method]) %>
</ul>
<% end %>
<% unless P(:root, 'FutureParserFunctions').is_a?(CodeObjects::Proxy) %>
<% unless P(:root, 'Puppet4xFunctions').is_a?(CodeObjects::Proxy) %>
<li>
<a class='toggle'></a>
<%= link_object(P(:root, 'FutureParserFunctions'), 'Future Parser Functions', nil, false) %>
<small class='search_info'>FutureParserFunctions</small>
<%= link_object(P(:root, 'Puppet4xFunctions'), 'Puppet 4x Functions', nil, false) %>
<small class='search_info'>Puppet4xFunctions</small>
</li>
<ul>
<%= namespace_list(:root => P(:root,'FutureParserFunctions'), :namespace_types => [:puppetnamespace, :method]) %>
<%= namespace_list(:root => P(:root,'Puppet4xFunctions'), :namespace_types => [:puppetnamespace, :method]) %>
</ul>
<% end %>

View File

@ -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

View File

@ -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

View File

@ -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