summaryrefslogtreecommitdiffstats
path: root/lib/puppet/interface/option.rb
Commit message (Collapse)AuthorAgeFilesLines
* (#6787) Add `default_to` for options.Daniel Pittman2011-07-201-0/+19
| | | | | | | | This implement support for options with default values, allowing faces to set those values when not invoked. This can eliminate substantial duplicate code from actions, especially when there are face-level options in use. Reviewed-By: Pieter van de Bruggen <pieter@puppetlabs.com>
* (#8048) Gem install puppet no longer fails if rdoc enabled.Michael Stahnke2011-06-221-2/+0
| | | | | | | | | | Rdoc wouldn't parse lib/puppet/interface/options.rb The offending code has been removed. This was causing issues for users wishing to upgrade puppet, via gem or puppet. Signed-off-by: Michael Stahnke <stahnma@puppetlabs.com>
* (#6962) Add integration tests on Face documentation.Daniel Pittman2011-04-271-1/+1
| | | | | | | | | | We now run all the faces, and their actions, as well as global help through the wringer in this test: this way we can be confident that we have, at least, the ability to generate the help without a user-visible failure. We also check that we have set copyright and license terms in our own faces. Theoretically this might fail if the end user has extra faces on LOAD_PATH, but my hope is that we won't hit that...
* (#6962) Finish documentation API on Face options.Daniel Pittman2011-04-271-1/+5
| | | | | | | This extends the last of the documentation support, down into options, so they can be described as expected. In the process we split out the modular docs API into a full and short version options only want short docs, but the behaviours are identical to the full version.
* maint: clean up test headers on face spec files.Daniel Pittman2011-04-221-0/+2
| | | | | | | | A whole pile of spec files for faces were not pulling in the regular spec_helper, or the puppet/face library before they used it. This worked fine by coincidence when they ran together, but blew up if run separately. Reviewed-By: Jesse Wolf <jesse@puppetlabs.com>
* (#7013) Support 'when_rendering' and 'render_as' in actions.Daniel Pittman2011-04-191-2/+2
| | | | | | | | | | | These define the API used by folks writing actions that supports their rendering hooks. 'when_rendering' defines a helper method on the interface, which runs the users code in their expected context. 'render_as' just sets the default rendering format; by default this is :for_humans. Reviewed-By: Max Martin <max@puppetlabs.com>
* Merge branch 'ticket/2.7.x/7131-optional-arguments' into 2.7.xMax Martin2011-04-181-2/+3
|\ | | | | | | | | * ticket/2.7.x/7131-optional-arguments: (#7131) Remove support for optional arguments to options
| * (#7131) Remove support for optional arguments to optionsMax Martin2011-04-181-2/+3
| | | | | | | | | | | | | | | | | | As per the design decision documented in #7131, optional arguments to options will no longer be supported. This patch causes such optional arguments to raise an error, and tests for this behavior. Also cleaned up some confusing use of the term "subject" in specs. Paired-with: Daniel Pittman
* | (Maint) Fixing an order-dependent failure.Pieter van de Bruggen2011-04-181-2/+0
|/ | | | | | Running spec/unit/option_spec.rb before requiring puppet/interface caused a circular require, and a failure. Paired-With: Max Martin
* (#7013) Add support for required options.Pieter van de Bruggen2011-04-171-2/+4
| | | | | | | | This adds another hook into the generated wrapper, which invokes a method to validate arguments. This is used to raise an exception when required options have not been passed to the method. Reviewed-By: Daniel Pittman <daniel@puppetlabs.com>
* (#6978) Add before and after decorators to actions from options.Daniel Pittman2011-04-151-13/+34
| | | | | | | | | | | | | | | | | | | | | | | Options can now add before_action and after_action blocks; these are invoked before or after any action is invoked on the face. This allows these options to declare common behaviour and have it automatically applied to the actions invoked. Option hooks have no defined order of invocation: they will run in a completely random order. Where there are dependencies they should be on the value of the options hash passed to the invocation, not on side-effects of the other invocations. You are not able to influence the arguments, options, or calling of the action body in a before or after decorator. This is by design. The invocation passes to the hook: 1. The action object representing this action. 2. The arguments to the action, as an array. 3. The options for the action, as a hash. Paired-With: Max Martin <max@puppetlabs.com>
* (#7012) Split plumbing into Puppet::InterfaceDaniel Pittman2011-04-071-0/+82
This splits out the plumbing into the Puppet::Interface namespace, and uses Puppet::Faces for all the public-facing code. The fault line is "what you care about if you are using or writing a face", which is public, against "what you care about to enable either of those two", which is the plumbing.