(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:
parent
dabcdf7f06
commit
ebbc2936df
|
@ -2,5 +2,5 @@ require_relative 'handlers/base'
|
||||||
require_relative 'handlers/defined_type_handler'
|
require_relative 'handlers/defined_type_handler'
|
||||||
require_relative 'handlers/host_class_handler'
|
require_relative 'handlers/host_class_handler'
|
||||||
|
|
||||||
require_relative 'handlers/parser_function_handler'
|
require_relative 'handlers/puppet_3x_function_handler'
|
||||||
require_relative 'handlers/future_parser_function_handler'
|
require_relative 'handlers/puppet_4x_function_handler'
|
||||||
|
|
|
@ -4,7 +4,7 @@ require 'puppet/util/docs'
|
||||||
require_relative '../code_objects'
|
require_relative '../code_objects'
|
||||||
|
|
||||||
module Puppetx::PuppetLabs::Strings::YARD::Handlers
|
module Puppetx::PuppetLabs::Strings::YARD::Handlers
|
||||||
class ParserFunctionHandler < YARD::Handlers::Ruby::Base
|
class Puppet3xFunctionHandler < YARD::Handlers::Ruby::Base
|
||||||
include Puppetx::PuppetLabs::Strings::YARD::CodeObjects
|
include Puppetx::PuppetLabs::Strings::YARD::CodeObjects
|
||||||
|
|
||||||
handles method_call(:newfunction)
|
handles method_call(:newfunction)
|
||||||
|
@ -40,11 +40,11 @@ module Puppetx::PuppetLabs::Strings::YARD::Handlers
|
||||||
# @return [PuppetNamespaceObject]
|
# @return [PuppetNamespaceObject]
|
||||||
def function_namespace
|
def function_namespace
|
||||||
# NOTE: This tricky. If there is ever a Ruby class or module with the
|
# 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.
|
# is sufficiently uncommon.
|
||||||
obj = P(:root, 'ParserFunctions')
|
obj = P(:root, 'Puppet3xFunctions')
|
||||||
if obj.is_a? Proxy
|
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')
|
namespace_obj.add_tag YARD::Tags::Tag.new(:api, 'public')
|
||||||
|
|
||||||
register namespace_obj
|
register namespace_obj
|
|
@ -4,13 +4,13 @@ module Puppetx::PuppetLabs::Strings::YARD::Handlers
|
||||||
# Handles `dispatch` calls within a future parser function declaration. For
|
# Handles `dispatch` calls within a future parser function declaration. For
|
||||||
# now, it just treats any docstring as an `@overlaod` tag and attaches the
|
# now, it just treats any docstring as an `@overlaod` tag and attaches the
|
||||||
# overload to the parent function.
|
# overload to the parent function.
|
||||||
class FutureParserDispatchHandler < YARD::Handlers::Ruby::Base
|
class Puppet4xFunctionHandler < YARD::Handlers::Ruby::Base
|
||||||
include Puppetx::PuppetLabs::Strings::YARD::CodeObjects
|
include Puppetx::PuppetLabs::Strings::YARD::CodeObjects
|
||||||
|
|
||||||
handles method_call(:dispatch)
|
handles method_call(:dispatch)
|
||||||
|
|
||||||
process do
|
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
|
return unless statement.docstring
|
||||||
|
|
||||||
docstring = ::YARD::Docstring.new(statement.docstring, nil)
|
docstring = ::YARD::Docstring.new(statement.docstring, nil)
|
||||||
|
@ -21,7 +21,7 @@ module Puppetx::PuppetLabs::Strings::YARD::Handlers
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class FutureParserFunctionHandler < YARD::Handlers::Ruby::Base
|
class Puppet4xFunctionHandler < YARD::Handlers::Ruby::Base
|
||||||
include Puppetx::PuppetLabs::Strings::YARD::CodeObjects
|
include Puppetx::PuppetLabs::Strings::YARD::CodeObjects
|
||||||
|
|
||||||
handles method_call(:create_function)
|
handles method_call(:create_function)
|
||||||
|
@ -30,7 +30,7 @@ module Puppetx::PuppetLabs::Strings::YARD::Handlers
|
||||||
name = process_parameters
|
name = process_parameters
|
||||||
|
|
||||||
obj = MethodObject.new(function_namespace, name)
|
obj = MethodObject.new(function_namespace, name)
|
||||||
obj['future_parser_function'] = true
|
obj['puppet_4x_function'] = true
|
||||||
|
|
||||||
register obj
|
register obj
|
||||||
|
|
||||||
|
@ -48,11 +48,11 @@ module Puppetx::PuppetLabs::Strings::YARD::Handlers
|
||||||
# @return [PuppetNamespaceObject]
|
# @return [PuppetNamespaceObject]
|
||||||
def function_namespace
|
def function_namespace
|
||||||
# NOTE: This tricky. If there is ever a Ruby class or module with the
|
# 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.
|
# is sufficiently uncommon.
|
||||||
obj = P(:root, 'FutureParserFunctions')
|
obj = P(:root, 'Puppet4xFunctions')
|
||||||
if obj.is_a? Proxy
|
if obj.is_a? Proxy
|
||||||
namespace_obj = PuppetNamespaceObject.new(:root, 'FutureParserFunctions')
|
namespace_obj = PuppetNamespaceObject.new(:root, 'Puppet4xFunctions')
|
||||||
|
|
||||||
register namespace_obj
|
register namespace_obj
|
||||||
# FIXME: The docstring has to be cleared. Otherwise, the namespace
|
# FIXME: The docstring has to be cleared. Otherwise, the namespace
|
|
@ -1,21 +1,21 @@
|
||||||
<% unless P(:root, 'ParserFunctions').is_a?(CodeObjects::Proxy) %>
|
<% unless P(:root, 'Puppet3xFunctions').is_a?(CodeObjects::Proxy) %>
|
||||||
<li>
|
<li>
|
||||||
<a class='toggle'></a>
|
<a class='toggle'></a>
|
||||||
<%= link_object(P(:root, 'ParserFunctions'), 'Parser Functions', nil, false) %>
|
<%= link_object(P(:root, 'Puppet3xFunctions'), 'Puppet 3x Functions', nil, false) %>
|
||||||
<small class='search_info'>ParserFunctions</small>
|
<small class='search_info'>Puppet3xFunctions</small>
|
||||||
</li>
|
</li>
|
||||||
<ul>
|
<ul>
|
||||||
<%= namespace_list(:root => P(:root,'ParserFunctions'), :namespace_types => [:puppetnamespace, :method]) %>
|
<%= namespace_list(:root => P(:root,'Puppet3xFunctions'), :namespace_types => [:puppetnamespace, :method]) %>
|
||||||
</ul>
|
</ul>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% unless P(:root, 'FutureParserFunctions').is_a?(CodeObjects::Proxy) %>
|
<% unless P(:root, 'Puppet4xFunctions').is_a?(CodeObjects::Proxy) %>
|
||||||
<li>
|
<li>
|
||||||
<a class='toggle'></a>
|
<a class='toggle'></a>
|
||||||
<%= link_object(P(:root, 'FutureParserFunctions'), 'Future Parser Functions', nil, false) %>
|
<%= link_object(P(:root, 'Puppet4xFunctions'), 'Puppet 4x Functions', nil, false) %>
|
||||||
<small class='search_info'>FutureParserFunctions</small>
|
<small class='search_info'>Puppet4xFunctions</small>
|
||||||
</li>
|
</li>
|
||||||
<ul>
|
<ul>
|
||||||
<%= namespace_list(:root => P(:root,'FutureParserFunctions'), :namespace_types => [:puppetnamespace, :method]) %>
|
<%= namespace_list(:root => P(:root,'Puppet4xFunctions'), :namespace_types => [:puppetnamespace, :method]) %>
|
||||||
</ul>
|
</ul>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -51,7 +51,7 @@ describe Puppet::Face do
|
||||||
|
|
||||||
Puppet::Face[:strings, :current].yardoc
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
require 'spec_helper'
|
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'
|
require 'strings_spec/parsing'
|
||||||
|
|
||||||
describe "FutureParserDispatchHandler" do
|
describe "Pupet4xFunctionHandler" do
|
||||||
include StringsSpec::Parsing
|
include StringsSpec::Parsing
|
||||||
|
|
||||||
def the_method()
|
def the_method()
|
||||||
Registry.at("FutureParserFunctions#the_function")
|
Registry.at("Puppet4xFunctions#the_function")
|
||||||
end
|
end
|
||||||
|
|
||||||
def the_namespace()
|
def the_namespace()
|
||||||
Registry.at("FutureParserFunctions")
|
Registry.at("Puppet4xFunctions")
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should parse single-line documentation strings before a given function" do
|
it "should parse single-line documentation strings before a given function" do
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
require 'spec_helper'
|
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'
|
require 'strings_spec/parsing'
|
||||||
|
|
||||||
describe "ParserFunctionHanlder" do
|
describe "Puppet3xFunctionHanlder" do
|
||||||
include StringsSpec::Parsing
|
include StringsSpec::Parsing
|
||||||
|
|
||||||
def the_method()
|
def the_method()
|
||||||
Registry.at("ParserFunctions#the_function")
|
Registry.at("Puppet3xFunctions#the_function")
|
||||||
end
|
end
|
||||||
|
|
||||||
def the_namespace()
|
def the_namespace()
|
||||||
Registry.at("ParserFunctions")
|
Registry.at("Puppet3xFunctions")
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should parse single-line documentation strings before a given function" do
|
it "should parse single-line documentation strings before a given function" do
|
||||||
|
|
Loading…
Reference in New Issue