(PDOC-3) Add puppetlabs directory
In order to keep with conventions around directory structure, add a puppetlabs directory and rename modules accordingly.
This commit is contained in:
parent
ec0e26e339
commit
dabcdf7f06
|
@ -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
|
||||
|
|
|
@ -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
|
|
@ -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.
|
||||
#
|
|
@ -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.
|
|
@ -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<Array(String, String)>]
|
|
@ -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]
|
|
@ -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`.
|
|
@ -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}
|
|
@ -1,6 +1,6 @@
|
|||
require_relative 'base'
|
||||
|
||||
module Puppetx::Strings::YARD::Handlers
|
||||
module Puppetx::PuppetLabs::Strings::YARD::Handlers
|
||||
class DefinedTypeHandler < Base
|
||||
handles ResourceTypeDefinition
|
||||
|
|
@ -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)
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
require_relative 'base'
|
||||
|
||||
module Puppetx::Strings::YARD::Handlers
|
||||
module Puppetx::PuppetLabs::Strings::YARD::Handlers
|
||||
class HostClassHandler < Base
|
||||
handles HostClassDefinition
|
||||
|
|
@ -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)
|
||||
|
|
@ -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
|
|
@ -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.
|
|
@ -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
|
|
@ -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|
|
||||
|
|
|
@ -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
|
|
@ -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'
|
||||
|
||||
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
Loading…
Reference in New Issue