Skip to content

Commit 47e5741

Browse files
authored
Merge pull request puppetlabs#160 from eputnam/master
(PDOC-222) Release 1.2.0 prep and sundries
2 parents 378c01a + dde1637 commit 47e5741

File tree

4 files changed

+47
-6
lines changed

4 files changed

+47
-6
lines changed

CHANGELOG.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
# Change log
2+
3+
All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org).
4+
5+
## [1.2.0](https://github.com/puppetlabs/puppet-strings/tree/1.2.0) (2018-02-26)
6+
7+
[Full Changelog](https://github.com/puppetlabs/puppet-strings/compare/1.1.1...1.2.0)
8+
9+
### Added
10+
11+
- \(PDOC-184\) generate markdown [\#156](https://github.com/puppetlabs/puppet-strings/pull/156) ([eputnam](https://github.com/eputnam))
12+
- \(PDK-437\) Add support for Resource API types [\#153](https://github.com/puppetlabs/puppet-strings/pull/153) ([DavidS](https://github.com/DavidS))
13+
14+
### Fixed
15+
16+
- Fix return type matching for Puppet functions [\#159](https://github.com/puppetlabs/puppet-strings/pull/159) ([pegasd](https://github.com/pegasd))
17+
- Add rgen as a runtime dependency [\#149](https://github.com/puppetlabs/puppet-strings/pull/149) ([rnelson0](https://github.com/rnelson0))
18+
119
## 2017-10-20 - Release 1.1.1
220

321
### BugFixes
@@ -166,3 +184,6 @@ All related tickets can be found under the [PDOC][PDOC JIRA] JIRA project with t
166184
- Puppet namespaces are no longer mangled for nested classes and defined types **(PDOC-25)**
167185
- Strings is now compatible with the renaming of the Puppetx/puppetx namespace to PuppetX/puppet_x **(PDOC-26)**
168186
- Strings will no longer crash when documenting 3x functions with less than two arguments passed into newfunction **(PDOC-27)**
187+
188+
189+
\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,7 @@ function example(string $name) {
463463

464464
### Available Strings tags
465465

466+
* `@api`: Describes the resource as private or public, most commonly used with classes or defined types.
466467
* `@example`: Shows an example snippet of code for an object. The first line is an optional title. See above for more about how to [include examples in documentation](#including-examples-in-documentation).
467468
* `@param`: Documents a parameter with a given name, type and optional description.
468469
* `@!puppet.type.param`: Documents dynamic type parameters. See [Documenting resource types and providers](#documenting-resource-types-and-providers) above.

lib/puppet-strings/tasks/generate.rb

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Implements the strings:generate task.
44
namespace :strings do
55
desc 'Generate Puppet documentation with YARD.'
6-
task :generate, :patterns, :debug, :backtrace, :markup, :json, :yard_args do |t, args|
6+
task :generate, [:patterns, :debug, :backtrace, :markup, :json, :markdown, :yard_args] do |t, args|
77
patterns = args[:patterns]
88
patterns = patterns.split if patterns
99
patterns ||= PuppetStrings::DEFAULT_SEARCH_PATTERNS
@@ -14,11 +14,30 @@
1414
markup: args[:markup] || 'markdown',
1515
}
1616

17-
# rubocop:disable Style/PreferredHashMethods
18-
# `args` is a Rake::TaskArguments and has no key? method
19-
options[:json] = args[:json] if args.has_key? :json
17+
raise("Error: Both JSON and Markdown output have been selected. Please select one.") if args[:json] == 'true' && args[:markdown] == 'true'
18+
19+
# rubocop:disable Style/PreferredHashMethods
20+
# Because of Ruby, true and false from the args are both strings and both true. Here,
21+
# when the arg is set to false (or empty), set it to real false, else real true. Then,
22+
# if the arg is set simply to 'true', assume default behavior is expected and set the path
23+
# to nil to elicit that, else set to the path given.
24+
# @param [Hash] args from the Rake task cli
25+
# @param [Hash] options to send to the generate function
26+
# @param [Symbol] possible format option
27+
# @return nil
28+
def parse_format_option(args, options, format)
29+
if args.has_key? format
30+
options[format] = args[format] == 'false' || args[format].empty? ? false : true
31+
if options[format]
32+
options[:path] = args[format] == 'true' ? nil : args[format]
33+
end
34+
end
35+
end
36+
37+
[:json,:markdown].each { |format| parse_format_option(args, options, format) }
38+
39+
warn('yard_args behavior is a little dodgy, use at your own risk') if args[:yard_args]
2040
options[:yard_args] = args[:yard_args].split if args.has_key? :yard_args
21-
# rubocop:enable Style/PreferredHashMethods
2241

2342
PuppetStrings.generate(patterns, options)
2443
end

puppet-strings.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Gem::Specification.new do |s|
22
s.name = 'puppet-strings'
33
s.author = 'Puppet Inc.'
4-
s.version = '1.1.1'
4+
s.version = '1.2.0'
55
s.license = 'Apache-2.0'
66
s.summary = 'Puppet documentation via YARD'
77
s.email = 'info@puppet.com'

0 commit comments

Comments
 (0)