From 6d1d5b496dfba44e32a91597846302377e90ec55 Mon Sep 17 00:00:00 2001 From: Hailee Kenney Date: Tue, 30 Sep 2014 14:21:20 -0700 Subject: [PATCH] (PDOC-3) Relocate plugin configuration The plugin.rb file really only did configuration of components that were already loaded. By relocating to the strings.rb file, it provides a central place for all of the loading and configuration of the strings components. --- lib/puppetx/puppetlabs/strings.rb | 31 +++++++++++++------ lib/puppetx/puppetlabs/strings/actions.rb | 1 - lib/puppetx/puppetlabs/strings/yard/plugin.rb | 16 ---------- 3 files changed, 22 insertions(+), 26 deletions(-) delete mode 100644 lib/puppetx/puppetlabs/strings/yard/plugin.rb diff --git a/lib/puppetx/puppetlabs/strings.rb b/lib/puppetx/puppetlabs/strings.rb index 62cdd3a..8dbcaf1 100644 --- a/lib/puppetx/puppetlabs/strings.rb +++ b/lib/puppetx/puppetlabs/strings.rb @@ -1,13 +1,23 @@ +require 'puppet' require 'puppetx' +require 'puppet/pops' +require 'puppet/util/docs' +require 'yard' # Nothing to see here except forward declarations. module Puppetx::PuppetLabs module Strings - require 'puppet/pops' + # This submodule contains bits that operate on the Pops module produced by + # the Future parser. + module Pops + require 'puppetx/puppetlabs/strings/pops/yard_statement' + require 'puppetx/puppetlabs/strings/pops/yard_transformer' + end # This submodule contains bits that interface with the YARD plugin system. module YARD - require 'yard' + require 'puppetx/puppetlabs/strings/yard/monkey_patches' + require 'puppetx/puppetlabs/strings/yard/parser' # This submodule contains code objects which are used to represent relevant # aspects of puppet code in YARD's Registry @@ -21,20 +31,23 @@ module Puppetx::PuppetLabs # 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 - # This submodule contains bits that operate on the Pops module produced by - # the Future parser. - module Pops - require 'puppetx/puppetlabs/strings/pops/yard_statement' - require 'puppetx/puppetlabs/strings/pops/yard_transformer' + ::YARD::Parser::SourceParser.register_parser_type(:puppet, + Puppetx::PuppetLabs::Strings::YARD::PuppetParser, + ['pp']) + ::YARD::Handlers::Processor.register_handler_namespace(:puppet, + 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. + ::YARD::Templates::Engine.register_template_path( + File.join(File.dirname(__FILE__), 'strings', 'yard', 'templates')) end end end diff --git a/lib/puppetx/puppetlabs/strings/actions.rb b/lib/puppetx/puppetlabs/strings/actions.rb index 030b26c..628c41b 100644 --- a/lib/puppetx/puppetlabs/strings/actions.rb +++ b/lib/puppetx/puppetlabs/strings/actions.rb @@ -1,5 +1,4 @@ require 'puppetx/puppetlabs/strings' -require 'puppetx/puppetlabs/strings/yard/plugin' class Puppetx::PuppetLabs::Strings::Actions diff --git a/lib/puppetx/puppetlabs/strings/yard/plugin.rb b/lib/puppetx/puppetlabs/strings/yard/plugin.rb deleted file mode 100644 index c518c5e..0000000 --- a/lib/puppetx/puppetlabs/strings/yard/plugin.rb +++ /dev/null @@ -1,16 +0,0 @@ -require 'puppet' -require 'puppetx/puppetlabs/strings/yard/monkey_patches' -require 'puppetx/puppetlabs/strings/yard/parser' -require 'puppetx/puppetlabs/strings' - -YARD::Parser::SourceParser.register_parser_type(:puppet, - Puppetx::PuppetLabs::Strings::YARD::PuppetParser, - ['pp']) -YARD::Handlers::Processor.register_handler_namespace(:puppet, - 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. -YARD::Templates::Engine.register_template_path(File.join( - File.dirname(__FILE__), - 'templates'))