(PDOC-3) Move requires to top level scope

Prior to this commit, the requires for the puppetx portion of this
project were dealt with in each individual file. In order to make
the code more readable and the requires more clear, move them all
into the strings file.
This commit is contained in:
Hailee Kenney 2014-09-30 13:34:57 -07:00
parent f0da72b2b7
commit 5159a7b778
13 changed files with 21 additions and 43 deletions

View File

@ -3,19 +3,38 @@ require 'puppetx'
# Nothing to see here except forward declarations. # Nothing to see here except forward declarations.
module Puppetx::PuppetLabs module Puppetx::PuppetLabs
module Strings module Strings
require 'puppet/pops'
# This submodule contains bits that interface with the YARD plugin system. # This submodule contains bits that interface with the YARD plugin system.
module YARD module YARD
module Handlers require 'yard'
# This submodule contains code objects which are used to represent relevant
# aspects of puppet code in YARD's Registry
module CodeObjects
require 'puppetx/puppetlabs/strings/yard/code_objects/puppet_namespace_object'
require 'puppetx/puppetlabs/strings/yard/code_objects/defined_type_object'
require 'puppetx/puppetlabs/strings/yard/code_objects/host_class_object'
end end
module CodeObjects # This submodule contains handlers which are used to extract relevant data about
# puppet code from the ASTs produced by the Ruby and Puppet parsers
module Handlers
# This utility library contains some tools for working with Puppet docstrings
require 'puppet/util/docs'
require 'puppetx/puppetlabs/strings/yard/handlers/base'
require 'puppetx/puppetlabs/strings/yard/handlers/defined_type_handler'
require 'puppetx/puppetlabs/strings/yard/handlers/host_class_handler'
require 'puppetx/puppetlabs/strings/yard/handlers/puppet_3x_function_handler'
require 'puppetx/puppetlabs/strings/yard/handlers/puppet_4x_function_handler'
end end
end end
# This submodule contains bits that operate on the Pops module produced by # This submodule contains bits that operate on the Pops module produced by
# the Future parser. # the Future parser.
module Pops module Pops
require 'puppetx/puppetlabs/strings/pops/yard_statement'
require 'puppetx/puppetlabs/strings/pops/yard_transformer'
end end
end end
end end

View File

@ -1,7 +1,4 @@
require 'ostruct' require 'ostruct'
require 'puppet/pops'
require 'puppetx/puppetlabs/strings'
# An adapter class that conforms a Pops model instance + adapters to the # An adapter class that conforms a Pops model instance + adapters to the
# interface expected by YARD handlers. # interface expected by YARD handlers.

View File

@ -1,7 +1,3 @@
require 'puppet/pops'
require 'puppetx/puppetlabs/strings'
require 'puppetx/puppetlabs/strings/pops/yard_statement'
# Loosely based on the TreeDumper classes in Pops::Model. The responsibility of # 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 # this class is to walk a Pops::Model and output objects that can be consumed
# by YARD handlers. # by YARD handlers.

View File

@ -1,3 +0,0 @@
require 'puppetx/puppetlabs/strings/yard/code_objects/puppet_namespace_object'
require 'puppetx/puppetlabs/strings/yard/code_objects/defined_type_object'
require 'puppetx/puppetlabs/strings/yard/code_objects/host_class_object'

View File

@ -1,7 +1,3 @@
require 'puppet/pops'
require 'puppetx/puppetlabs/strings/yard/code_objects/puppet_namespace_object'
class Puppetx::PuppetLabs::Strings::YARD::CodeObjects::DefinedTypeObject < Puppetx::PuppetLabs::Strings::YARD::CodeObjects::PuppetNamespaceObject class Puppetx::PuppetLabs::Strings::YARD::CodeObjects::DefinedTypeObject < Puppetx::PuppetLabs::Strings::YARD::CodeObjects::PuppetNamespaceObject
# A list of parameters attached to this class. # A list of parameters attached to this class.
# @return [Array<Array(String, String)>] # @return [Array<Array(String, String)>]

View File

@ -1,5 +1,3 @@
require 'puppetx/puppetlabs/strings/yard/code_objects/defined_type_object'
class Puppetx::PuppetLabs::Strings::YARD::CodeObjects::HostClassObject < Puppetx::PuppetLabs::Strings::YARD::CodeObjects::DefinedTypeObject class Puppetx::PuppetLabs::Strings::YARD::CodeObjects::HostClassObject < Puppetx::PuppetLabs::Strings::YARD::CodeObjects::DefinedTypeObject
# The {HostClassObject} that this class inherits from, if any. # The {HostClassObject} that this class inherits from, if any.
# @return [HostClassObject, Proxy, nil] # @return [HostClassObject, Proxy, nil]

View File

@ -1,6 +1,3 @@
require 'yard'
require 'puppetx/puppetlabs/strings'
class Puppetx::PuppetLabs::Strings::YARD::CodeObjects::PuppetNamespaceObject < YARD::CodeObjects::NamespaceObject class Puppetx::PuppetLabs::Strings::YARD::CodeObjects::PuppetNamespaceObject < YARD::CodeObjects::NamespaceObject
# NOTE: `YARD::Registry#resolve` requires a method with this signature to # NOTE: `YARD::Registry#resolve` requires a method with this signature to
# be present on all subclasses of `NamespaceObject`. # be present on all subclasses of `NamespaceObject`.

View File

@ -1,6 +0,0 @@
require 'puppetx/puppetlabs/strings/yard/handlers/base'
require 'puppetx/puppetlabs/strings/yard/handlers/defined_type_handler'
require 'puppetx/puppetlabs/strings/yard/handlers/host_class_handler'
require 'puppetx/puppetlabs/strings/yard/handlers/puppet_3x_function_handler'
require 'puppetx/puppetlabs/strings/yard/handlers/puppet_4x_function_handler'

View File

@ -1,9 +1,3 @@
require 'yard'
require 'puppet/pops'
require 'puppetx/puppetlabs/strings'
require 'puppetx/puppetlabs/strings/yard/code_objects'
class Puppetx::PuppetLabs::Strings::YARD::Handlers::Base < YARD::Handlers::Base class Puppetx::PuppetLabs::Strings::YARD::Handlers::Base < YARD::Handlers::Base
# Easy access to Pops model objects for handler matching. # Easy access to Pops model objects for handler matching.
include Puppet::Pops::Model include Puppet::Pops::Model

View File

@ -1,5 +1,3 @@
require 'puppetx/puppetlabs/strings/yard/handlers/base'
class Puppetx::PuppetLabs::Strings::YARD::Handlers::DefinedTypeHandler < Puppetx::PuppetLabs::Strings::YARD::Handlers:: Base class Puppetx::PuppetLabs::Strings::YARD::Handlers::DefinedTypeHandler < Puppetx::PuppetLabs::Strings::YARD::Handlers:: Base
handles ResourceTypeDefinition handles ResourceTypeDefinition

View File

@ -1,5 +1,3 @@
require 'puppetx/puppetlabs/strings/yard/handlers/base'
class Puppetx::PuppetLabs::Strings::YARD::Handlers::HostClassHandler < Puppetx::PuppetLabs::Strings::YARD::Handlers::Base class Puppetx::PuppetLabs::Strings::YARD::Handlers::HostClassHandler < Puppetx::PuppetLabs::Strings::YARD::Handlers::Base
handles HostClassDefinition handles HostClassDefinition

View File

@ -1,7 +1,3 @@
# This utility library contains some tools for working with Puppet docstrings.
require 'puppet/util/docs'
require 'puppetx/puppetlabs/strings/yard/code_objects'
class Puppetx::PuppetLabs::Strings::YARD::Handlers::Puppet3xFunctionHandler < YARD::Handlers::Ruby::Base class Puppetx::PuppetLabs::Strings::YARD::Handlers::Puppet3xFunctionHandler < YARD::Handlers::Ruby::Base
include Puppetx::PuppetLabs::Strings::YARD::CodeObjects include Puppetx::PuppetLabs::Strings::YARD::CodeObjects

View File

@ -1,5 +1,3 @@
require 'puppetx/puppetlabs/strings/yard/code_objects'
# 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.