|
32 | 32 | check_required_features
|
33 | 33 | require 'puppet-strings'
|
34 | 34 |
|
35 |
| - PuppetStrings::generate( |
| 35 | + PuppetStrings.generate( |
36 | 36 | args.count > 1 ? args[0..-2] : PuppetStrings::DEFAULT_SEARCH_PATTERNS,
|
37 |
| - build_generate_options(args.last) |
| 37 | + build_generate_options(args.last), |
38 | 38 | )
|
39 | 39 | nil
|
40 | 40 | end
|
|
79 | 79 | return
|
80 | 80 | end
|
81 | 81 | puts 'Starting YARD documentation server.'
|
82 |
| - PuppetStrings::run_server('-m', *module_docs) |
| 82 | + PuppetStrings.run_server('-m', *module_docs) |
83 | 83 | nil
|
84 | 84 | end
|
85 | 85 | end
|
86 | 86 |
|
87 |
| - action(:describe) do #This is Kris' experiment with string based describe |
88 |
| - option "--list" do |
89 |
| - summary "list types" |
| 87 | + action(:describe) do # This is Kris' experiment with string based describe |
| 88 | + option '--list' do |
| 89 | + summary 'list types' |
90 | 90 | end
|
91 |
| - option "--providers" do |
92 |
| - summary "provide details on providers" |
| 91 | + option '--providers' do |
| 92 | + summary 'provide details on providers' |
93 | 93 | end
|
94 | 94 |
|
95 |
| -#TODO: Implement the rest of describe behavior |
96 |
| -# * --help: |
97 |
| -# Print this help text |
| 95 | + # TODO: Implement the rest of describe behavior |
| 96 | + # * --help: |
| 97 | + # Print this help text |
98 | 98 |
|
99 |
| -# * --providers: |
100 |
| -# Describe providers in detail for each type |
| 99 | + # * --providers: |
| 100 | + # Describe providers in detail for each type |
101 | 101 |
|
102 |
| -# * --list: |
103 |
| -# List all types |
| 102 | + # * --list: |
| 103 | + # List all types |
104 | 104 |
|
105 |
| -# * --meta: |
106 |
| -# List all metaparameters |
107 |
| - |
108 |
| -# * --short: |
109 |
| -# List only parameters without detail |
| 105 | + # * --meta: |
| 106 | + # List all metaparameters |
110 | 107 |
|
| 108 | + # * --short: |
| 109 | + # List only parameters without detail |
111 | 110 |
|
112 | 111 | when_invoked do |*args|
|
113 | 112 | check_required_features
|
|
117 | 116 | options[:describe] = true
|
118 | 117 | options[:stdout] = true
|
119 | 118 | options[:format] = 'json'
|
120 |
| - |
| 119 | + |
121 | 120 | if args.length > 1
|
122 | 121 | if options[:list]
|
123 |
| - warn "WARNING: ignoring types when listing all types." |
| 122 | + warn 'WARNING: ignoring types when listing all types.' |
124 | 123 | else
|
125 | 124 | options[:describe_types] = args[0..-2]
|
126 | 125 | end
|
127 | 126 | end
|
128 | 127 |
|
129 |
| - #TODO: Set up search_patterns and whatever else needed to collect data for describe - currently missing some |
| 128 | + # TODO: Set up search_patterns and whatever else needed to collect data for describe - currently missing some |
130 | 129 | # manifests/**/*.pp
|
131 | 130 | # functions/**/*.pp
|
132 | 131 | # tasks/*.json
|
133 | 132 | # plans/*.pp
|
134 |
| - search_patterns = %w( |
135 |
| - types/**/*.pp |
136 |
| - lib/**/*.rb |
137 |
| - ) |
138 |
| - PuppetStrings::generate( |
| 133 | + search_patterns = ['types/**/*.pp', 'lib/**/*.rb'] |
| 134 | + PuppetStrings.generate( |
139 | 135 | search_patterns,
|
140 |
| - build_generate_options(options) |
| 136 | + build_generate_options(options), |
141 | 137 | )
|
142 | 138 | nil
|
143 | 139 | end
|
|
146 | 142 | # Checks that the required features are installed.
|
147 | 143 | # @return [void]
|
148 | 144 | def check_required_features
|
149 |
| - raise RuntimeError, "The 'yard' gem must be installed in order to use this face." unless Puppet.features.yard? |
150 |
| - raise RuntimeError, "The 'rgen' gem must be installed in order to use this face." unless Puppet.features.rgen? |
151 |
| - raise RuntimeError, 'This face requires Ruby 1.9 or greater.' if RUBY_VERSION.match?(/^1\.8/) |
| 145 | + raise "The 'yard' gem must be installed in order to use this face." unless Puppet.features.yard? |
| 146 | + raise "The 'rgen' gem must be installed in order to use this face." unless Puppet.features.rgen? |
| 147 | + raise 'This face requires Ruby 1.9 or greater.' if RUBY_VERSION.match?(%r{^1\.8}) |
152 | 148 | end
|
153 | 149 |
|
154 | 150 | # Builds the options to PuppetStrings.generate.
|
@@ -186,7 +182,7 @@ def build_generate_options(options = nil, *yard_args)
|
186 | 182 | generate_options[:json] = true
|
187 | 183 | generate_options[:path] ||= options[:emit_json] if options[:emit_json]
|
188 | 184 | else
|
189 |
| - raise RuntimeError, "Invalid format #{options[:format]}. Please select 'json' or 'markdown'." |
| 185 | + raise "Invalid format #{options[:format]}. Please select 'json' or 'markdown'." |
190 | 186 | end
|
191 | 187 | elsif options[:emit_json] || options[:emit_json_stdout]
|
192 | 188 | generate_options[:json] = true
|
|
0 commit comments