Module: PuppetStrings
- Defined in:
- lib/puppet-strings.rb,
lib/puppet-strings/tasks.rb,
lib/puppet-strings/version.rb
Overview
The root module for Puppet Strings.
Defined Under Namespace
Modules: Describe, Json, Markdown, Tasks, Yard
Constant Summary collapse
- DEFAULT_SEARCH_PATTERNS =
The glob patterns used to search for files to document.
%w( manifests/**/*.pp functions/**/*.pp types/**/*.pp lib/**/*.rb tasks/*.json plans/**/*.pp ).freeze
- VERSION =
'2.6.0'
Class Method Summary collapse
-
.generate(search_patterns = DEFAULT_SEARCH_PATTERNS, options = {}) ⇒ void
Generates documentation.
- .puppet_5? ⇒ Boolean
- .render_describe(describe_types, list = false, providers = false) ⇒ Object
- .render_json(path) ⇒ Object
- .render_markdown(path) ⇒ Object
-
.run_server(*args) ⇒ Object
Runs the YARD documentation server.
Class Method Details
.generate(search_patterns = DEFAULT_SEARCH_PATTERNS, options = {}) ⇒ void
This method returns an undefined value.
Generates documentation.
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/puppet-strings.rb', line 26 def self.generate(search_patterns = DEFAULT_SEARCH_PATTERNS, = {}) require 'puppet-strings/yard' PuppetStrings::Yard.setup! # Format the arguments to YARD args = ['doc'] args << '--no-progress' args << '--debug' if [:debug] args << '--backtrace' if [:debug] args << "-m#{[:markup] || 'markdown'}" file = nil if [:json] || [:markdown] file = if [:json] [:path] elsif [:markdown] [:path] || "REFERENCE.md" end # Disable output and prevent stats/progress when writing to STDOUT args << '-n' args << '-q' unless file args << '--no-stats' unless file end yard_args = [:yard_args] args += yard_args if yard_args args += search_patterns # Run YARD YARD::CLI::Yardoc.run(*args) # If outputting JSON, render the output if [:json] && ![:describe] render_json(file) end # If outputting Markdown, render the output if [:markdown] render_markdown(file) end if [:describe] render_describe([:describe_types], [:describe_list], [:providers]) end end |
.puppet_5? ⇒ Boolean
72 73 74 |
# File 'lib/puppet-strings.rb', line 72 def self.puppet_5? Puppet::Util::Package.versioncmp(Puppet.version, "5.0.0") >= 0 end |
.render_describe(describe_types, list = false, providers = false) ⇒ Object
86 87 88 89 |
# File 'lib/puppet-strings.rb', line 86 def self.render_describe(describe_types, list = false, providers = false) require 'puppet-strings/describe' PuppetStrings::Describe.render(describe_types, list, providers) end |
.render_json(path) ⇒ Object
76 77 78 79 |
# File 'lib/puppet-strings.rb', line 76 def self.render_json(path) require 'puppet-strings/json' PuppetStrings::Json.render(path) end |
.render_markdown(path) ⇒ Object
81 82 83 84 |
# File 'lib/puppet-strings.rb', line 81 def self.render_markdown(path) require 'puppet-strings/markdown' PuppetStrings::Markdown.render(path) end |
.run_server(*args) ⇒ Object
Runs the YARD documentation server.
93 94 95 96 97 98 |
# File 'lib/puppet-strings.rb', line 93 def self.run_server(*args) require 'puppet-strings/yard' PuppetStrings::Yard.setup! YARD::CLI::Server.run(*args) end |