Skip to content

Commit

Permalink
Merge pull request #114 from rodjek/update_validate_cli_help
Browse files Browse the repository at this point in the history
(maint) Update validate CLI help text & README
  • Loading branch information
DavidS authored Jun 28, 2017
2 parents 8161e94 + d59928f commit f4dc670
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 5 deletions.
26 changes: 23 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,32 @@ pdk validate
This displays results in the console:

```
Running validations on `new_module`:
* ruby syntax: OK!
* puppet syntax: OK!
pdk (INFO): Running all available validators...
[✔] Checking for missing Gemfile dependencies
[✔] Checking metadata.json
[✔] Checking Ruby code style
[...]
```

Specific validators can be run by providing the validator name (or a comma
separated list of names) as an argument to `pdk validate`.

```
$ pdk validate metadata
[✔] Checking for missing Gemfile dependencies
[✔] Checking metadata.json
```

By default each validator will automatically determine which files in the
module that it should validate, however validations can be run on specific
files or directories by providing them as arguments to `pdk validate`

```
$ pdk validate lib/
[✔] Checking for missing Gemfile dependencies
[✔] Checking Ruby code style
```

### Run unit tests

The default template sets up [rspec](http://rspec.info/) for Ruby-level unit testing, and [rspec-puppet](https://github.com/rodjek/rspec-puppet/) for catalog-level unit testing.
Expand Down
10 changes: 8 additions & 2 deletions lib/pdk/cli/validate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,15 @@
module PDK::CLI
@validate_cmd = @base_cmd.define_command do
name 'validate'
usage _('validate [options]')
usage _('validate [validators] [options] [targets]')
summary _('Run static analysis tests.')
description _('Run metadata, puppet, or ruby validation.')
description _(
"Run metadata, puppet, or ruby validation.\n\n" \
'[validators] is an optional comma separated list of validators to use. ' \
"If not specified, all validators will be used.\n\n" \
'[targets] is an optional space separated list of files or directories to be validated. ' \
'If not specified, the validators will be run against all applicable files in the module.',
)

flag nil, :list, _('list all available validators')

Expand Down

0 comments on commit f4dc670

Please sign in to comment.