Module: PuppetStrings::Yard

Defined in:
lib/puppet-strings/yard.rb

Overview

Module for YARD related functionality.

Defined Under Namespace

Modules: CodeObjects, Handlers, Parsers, Tags, Util

Class Method Summary collapse

Class Method Details

.setup!void

This method returns an undefined value.

Sets up YARD for use with puppet-strings.



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/puppet-strings/yard.rb', line 15

def self.setup!
  # Register our factory
  YARD::Tags::Library.default_factory = PuppetStrings::Yard::Tags::Factory

  # Register the template path
  YARD::Templates::Engine.register_template_path(File.join(File.dirname(__FILE__), 'yard', 'templates'))

  # Register the Puppet parser
  YARD::Parser::SourceParser.register_parser_type(:puppet, PuppetStrings::Yard::Parsers::Puppet::Parser, ['pp'])
  YARD::Parser::SourceParser.register_parser_type(:json, PuppetStrings::Yard::Parsers::JSON::Parser, ['json'])

  # Register our handlers
  YARD::Handlers::Processor.register_handler_namespace(:puppet, PuppetStrings::Yard::Handlers::Puppet)
  YARD::Handlers::Processor.register_handler_namespace(:puppet_ruby, PuppetStrings::Yard::Handlers::Ruby)
  YARD::Handlers::Processor.register_handler_namespace(:json, PuppetStrings::Yard::Handlers::JSON)

  # Register the tag directives
  PuppetStrings::Yard::Tags::ParameterDirective.register!
  PuppetStrings::Yard::Tags::PropertyDirective.register!

  # Register the summary tag
  PuppetStrings::Yard::Tags::SummaryTag.register!

  # Register the enum tag
  PuppetStrings::Yard::Tags::EnumTag.register!

  # Ignore documentation on Puppet DSL calls
  # This prevents the YARD DSL parser from emitting warnings for Puppet's Ruby DSL
  YARD::Handlers::Ruby::DSLHandlerMethods::IGNORE_METHODS['create_function'] = true
  YARD::Handlers::Ruby::DSLHandlerMethods::IGNORE_METHODS['newtype'] = true
end