Re-work require statements

Use `require_relative` for all components under Puppetx. This makes it possible
to load `pupetx/yardoc/yard/plugin` outside of Puppet as a YARD plugin.

Also fix the `yardoc` face so that Puppetx bits are loaded _after_ feature
checks.
This commit is contained in:
Charlie Sharpsteen 2014-05-24 12:54:22 -07:00
parent 545a8a0c5e
commit b4e2ed0e5c
5 changed files with 11 additions and 12 deletions

View File

@ -1,5 +1,4 @@
require 'puppet/face'
require 'puppetx/yardoc/yard/parser'
Puppet::Face.define(:yardoc, '0.0.1') do
@ -12,12 +11,12 @@ Puppet::Face.define(:yardoc, '0.0.1') do
raise RuntimeError, "The 'yard' gem must be installed in order to use this face."
end
if Puppet.features.rgen?
require 'puppet/pops'
else
unless Puppet.features.rgen?
raise RuntimeError, "The 'rgen' gem must be installed in order to use this face."
end
require 'puppetx/yardoc/yard/plugin'
parser = Puppetx::Yardoc::YARD::PuppetParser.new(File.read(manifest), manifest)
parser.parse

View File

@ -1,7 +1,7 @@
require 'puppetx/yardoc'
require 'puppet/pops'
require_relative '../../yardoc'
module Puppetx::Yardoc::Pops
# An adapter class that conforms a Pops model instance + adapters to the
# interface expected by YARD handlers.

View File

@ -1,7 +1,6 @@
require 'puppetx/yardoc'
require 'puppet/pops'
require_relative '../../yardoc'
require_relative 'yard_statement'
module Puppetx::Yardoc::Pops

View File

@ -1,7 +1,8 @@
require 'puppetx/yardoc'
require 'yard'
require 'puppet/pops'
require_relative '../../../yardoc'
module Puppetx::Yardoc::YARD::Handlers
class Base < YARD::Handlers::Base
include Puppet::Pops::Model # This allows handlers to match based on model classes.

View File

@ -1,8 +1,8 @@
require 'puppetx/yardoc'
require 'yard'
require 'puppet/pops'
require 'puppetx/yardoc/pops/yard_transformer'
require_relative '../../yardoc'
require_relative '../pops/yard_transformer'
module Puppetx::Yardoc::YARD
class PuppetParser < YARD::Parser::Base