summaryrefslogtreecommitdiffstats
path: root/spec/lib/puppet
Commit message (Collapse)AuthorAgeFilesLines
* maint: Fix Face testing bug 1.9.2 revealed.Daniel Pittman2011-07-252-4/+2
| | | | | | | | | | | | | | Ruby 1.8.7 is fairly lax about various bits of introspection, including that we can't tell much about what arguments a block takes. Ruby 1.9.2 makes it possible to do this, though. Meanwhile, the Faces system uses this to make sure that scripts and actions take the right set of arguments, to avoid surprises: failing early and explicitly is better than failing at runtime. Which, in final turn, exposes that I forgot to accept the right arguments in a couple of my testing actions for Faces, but didn't notice because 1.8.7 doesn't check that, and I didn't test on 1.9.2.
* (#7184) Load the core of obsolete versions of Faces.Daniel Pittman2011-07-222-0/+11
| | | | | | | | | | | | When we define an action on an older version of a Face, we must be sure to directly load the core of that version, not just define it with the external Action(s) that it had. Otherwise we break our contract, which is that any core Actions for a specific version will be available to your external Action for as long as we support that core version. Reviewed-By: Pieter van de Bruggen <pieter@puppetlabs.com>
* (#7184) Find actions bound to other versions of Faces.Daniel Pittman2011-07-221-0/+6
| | | | | | | | | | | | | | When we first touch a Face, we load all the available Actions from disk. Given they define themselves against a specific version of a Face, they are automatically available tied to the correct version; this makes it trivially possible to locate those on demand and return them. Now, we have the ability to find and, consequently, invoke Actions on older versions of Faces. We don't load enough context, though: the older face will only have external Actions defined, not anything core. Reviewed-By: Pieter van de Bruggen <pieter@puppetlabs.com>
* #7211: more helpful error messages in various cases.Daniel Pittman2011-05-311-0/+5
| | | | | | | | | | | | We were emitting a bunch of unhelpful failure messages, surrounding invalid actions and especially default actions interacting with the command-line. This cleans those up, to give a helpful, informative, and correct message in all cases. Notably, we no longer report that there is no "default" action when you specify an unknown action on a face. This change revealed some other weaknesses in our unit tests, now correctly, that result in slightly more robust code.
* (#7291) The 'script' version of actions needs options argumentMatt Robinson2011-05-162-2/+2
| | | | | | | | | | Ruby 1.9 is stricter about arity for for arguments passed as a block. A test case just hadn't been updated to take this into account for Face scripts (a simpler form of action), which isn't surprising since script isn't used anywhere in the code, which makes it a prime candidate for removal as far as I'm concerned, but apparently Luke wants it in there. Reviewed-by: Pieter van de Bruggen <pieter@puppetlabs.com>
* (#7329) Consistent naming for rendering formats and hooks.Daniel Pittman2011-05-031-0/+6
| | | | | | | | | | | | We refer to rendering formats pretty consistently as `json`, `yaml`, `s`, and so forth; unqualified names. On the other hand, we refer to the rendering hooks *mostly* as `to_*`, except the `:for_humans` and `:json` formats. Which is kind of confusing because of the internal inconsistency, and because it doesn't match the public name. Fix the code to resolve both, so the `to_*` format still works, but we mostly expect to use the `*` version, to match public expectation.
* (#7282) action without `when_invoked` should fail...Daniel Pittman2011-05-021-1/+1
| | | | | | | | | | | | | | We used to let actions be declared without the `when_invoked` block, which was usually a sign of either someone writing their method code direct in action declaration, or someone forgetting to add their code at all. This was just let silently by: the error only showed up when you finally tried to invoke the action, and a NoMethod error was raised by the face. ...except for our own testing. We took advantage of this a whole pile of times in there; fixing the original UI issue means fixing all those too. Reviewed-By: Nick Lewis <nick@puppetlabs.com>
* (#6962) Add integration tests on Face documentation.Daniel Pittman2011-04-273-0/+6
| | | | | | | | | | 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...
* (#7157) Return a non-zero exit code on face failure.Daniel Pittman2011-04-221-0/+30
| | | | | | | | When a face or action fails we should exit non-zero on the CLI to signal this to our caller. "Fails" is defined as "raises an exception"; we don't treat any return value as a significant failure. Reviewed-By: Jesse Wolf <jesse@puppetlabs.com>
* Merge remote-tracking branch ↵Daniel Pittman2011-04-211-2/+3
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | 'remotes/lak/tickets/next/7118-summaries_for_all_faces' into 2.7.x Fix conflicts due to version drift in: lib/puppet/face/certificate.rb lib/puppet/face/facts.rb lib/puppet/face/node.rb lib/puppet/face/secret_agent.rb spec/lib/puppet/face/basetest.rb spec/unit/face/help_spec.rb Reviewed-By: Markus Roberts <markus@puppetlabs.com>
| * (7118) Adding summaries for all facesLuke Kanies2011-04-141-1/+3
| | | | | | | | | | | | | | | | | | It's usually just a one-liner, but when I saw an obvious opportunity for longer docs, I've added a @longdocs variable that can be converted to longer forms when ready. Signed-off-by: Luke Kanies <luke@puppetlabs.com>
* | (#7183) Implement "invisible glob" version matching for facesDaniel Pittman2011-04-211-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "Invisible glob", or "prefix", version matching means that when you specify a version string to use you can specify as little as one version number out of the semantic versioning spec. Matching is done on the prefix; an omitted number is treated as "anything" in that slot, and we return the highest matching versioned face by that spec. For example, given the set of versions: 1.0.0, 1.0.1, 1.1.0, 1.1.1, 2.0.0 The following would be matched: input matched 1 1.1.1 1.0 1.0.1 1.0.1 1.0.1 1.0.2 fail - no match 1.1 1.1.1 1.1.1 1.1.1 1.2 fail - no match
* | (#6978) Add before and after decorators to actions from options.Daniel Pittman2011-04-151-0/+1
|/ | | | | | | | | | | | | | | | | | | | | | | 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>
* maint: clean up the spec test headers in bulk.Daniel Pittman2011-04-132-0/+0
| | | | | | | We now use a shebang of: #!/usr/bin/env rspec This enables the direct execution of spec tests again, which was lost earlier during the transition to more directly using the rspec2 runtime environment.
* (#7056) Use 'face' rather than 'faces' in the production code.Daniel Pittman2011-04-133-3/+3
| | | | | | | | | After some discussion we decided that most uses of the Puppet Face infrastructure were about single faces on their own, not about the collection, and so we were better referring to Puppet::Face[...] in code. This implements that by translating names and references in the Ruby code to the new, s-less, name.
* maint: avoid making temporary dirs during testing.Daniel Pittman2011-04-121-0/+1
| | | | | | | | We used to create temporary directories to have some support files on disk during testing of faces; we don't really need that most of the time, and this updates a test to reflect that reality. Reviewed-By: Matt Robinson <matt@puppetlabs.com>
* (#6962) Implement Face#summary support for the help face.Daniel Pittman2011-04-121-0/+1
| | | | | | | | We now use the summary information available in other faces as part of emitting a list our list of available subcommands. This is seldom used in faces, but enough emit the information to prove the concept. Reviewed-By: Matt Robinson <matt@puppetlabs.com>
* Merge puppet-interfaces into puppet.Daniel Pittman2011-04-071-0/+4
This joins the two repositories, including full history, into a single run, as well as landing the interfaces work on the next branch ready for release.