summaryrefslogtreecommitdiff
path: root/spec/unit/face/help_spec.rb
AgeCommit message (Collapse)AuthorFilesLines
2012-12-07(#7316) Refactor listing and requiring of applicationsJosh Cooper1-7/+5
Previously, the logic for listing and requiring applications was in two places, CommandLine and Application, respectively. The CommandLine contained logic, basically duplicated from the Autoloader, to walk a search path and generate a list unique applications relative to 'puppet/application'. The Application contained logic for requiring the application from 'puppet/application', duplicating the logic from CommandLine. This commit moves the logic for listing available applications to the Application class, which delegates to its autoloader. Note the autoloader already takes gem and module paths into account, so no change in functionality there. This commit also deprecates the CommandLine available_subcomands instance and class methods.
2012-10-04Revert "Merge pull request #1190 from ↵Jeff McCune1-3/+1
jeffmccune/fix/master/7316_load_faces_from_modulepath_try4" This reverts commit bdda511d06ed6f89b58343e815585957a33db94e, reversing changes made to 8f9699cee0d1028d538b0a26aa5bc885751b6d46. Conflicts: lib/puppet/settings/config_file.rb
2012-09-26Revert "Revert "Merge branch 'fix/3.x/7316_load_faces_from_modulepath_try3' ↵Jeff McCune1-1/+3
into 3.x"" This reverts commit ef3fe695fd0be5ff2b5aeb563f34f62a0f503831.
2012-09-26(Maint) Remove rspec from shebang lineJeff McCune1-1/+1
Without this patch Ruby 1.9 is still complaining loudly about trying to parse the spec files. The previous attempt to clean up this problem in edc3ddf works for Ruby 1.8 but not 1.9. I'd prefer to remove the shebang lines entirely, but doing so will cause encoding errors in Ruby 1.9. This patch strives for a happy middle ground of convincing Ruby it is actually working with Ruby while not confusing it to think it should exec() to rspec. This patch is the result of the following command run against the source tree: find spec -type f -print0 | \ xargs -0 perl -pl -i -e 's,^\#\!\s?/(.*)rspec,\#! /usr/bin/env ruby,'
2012-09-25Revert "Merge branch 'fix/3.x/7316_load_faces_from_modulepath_try3' into 3.x"Andrew Parker1-3/+1
This reverts commit b277bb3874ecd50e1cd6e600bf6d36e3240d5510, reversing changes made to bdf193640701e9a107b1c6f6661499b31fdefb4d. These changes are being backed out because they referenced a undefined methods (`default_global_config_dir` and `default_global_var_dir`). After fixing that locally, there was still a problem with `puppet help` printing out a large number of warnings because it could not load face code correctly. I think we need to step back from this, re-evaluate what is happening, and try a new approach.
2012-09-24Revert "Merge branch 'revert/3.x/faces_from_modulepath' into 3.x"Jeff McCune1-1/+3
This is a "revert-the-revert" commit. This reverts commit 87ea7a8849f90a232f2bb683fb8a2ce1573a21db, reversing changes made to 8dff14b9c5a3cdd99ede63dbcbb2dbe00b457926.
2012-09-21Revert "Merge branch 'fix/3.x/7316_load_faces_from_modulepath' into 3.x"Jeff McCune1-3/+1
Revert the modulepath face loader change set for the following reason: This change set is intended to load faces from the module path. It works great... _if_ you explicitly set --confdir on the command line like I do with my zsh puppet() function. If you don't, then it blows up because the global for the confdir is set by defaults at a different enough point in the code for us to overlook the issue. If we invest in removing global state, specifically Puppet.settings, I think we'll see a very quick return. The confdir setting should be "available" for use at the same point, regardless of where it comes from; defaults, puppet.conf, CLI, or (hopefully) the environment. This reverts commit 8b059a9a9e7c765d3050163ca59abeffe3e297b5, reversing changes made to 7c3b620182602012b191a5b5ade7b1df5cbc8b19.
2012-09-20(#7316) Load applications from the modulepathJeff McCune1-1/+3
Without this patch Puppet does not search the modulepath lib subdirectories for application subcommands. This is a problem because face applications that aren't affected by #3947 should work. This patch fixes the problem by searching through the modules along the modulepath to find available subcommands in addition to those available along the Ruby $LOAD_PATH and RubyGems $GEM_PATH. Both legacy application files and modern face applications are loaded from the modulepath with this patch. This patch does _not_ add the module's `lib/` subdirectory to the $LOAD_PATH, so issue #3947 will still affect face applications that attempt to use `require` with library files inside the module.
2012-07-24Merge branch '2.7.x' into 3.xPatrick Carlisle1-6/+7
* 2.7.x: Use rspec 2.11 compatible block syntax Conflicts: spec/integration/faces/ca_spec.rb spec/integration/network/server/mongrel_spec.rb spec/unit/application_spec.rb spec/unit/face/help_spec.rb spec/unit/network/handler/fileserver_spec.rb spec/unit/parser/functions/create_resources_spec.rb spec/unit/provider/nameservice/directoryservice_spec.rb spec/unit/type/file_spec.rb spec/unit/type_spec.rb
2012-07-23Use rspec 2.11 compatible block syntaxPatrick Carlisle1-5/+5
In rspec 2.11, expectations on a block must take the form of expect...to or lambda...should. Other combinations of those are no longer accepted. This commit converts all mixed cases to use expect...to, as it seems to be the preferred syntax now.
2012-07-06(#15307) Fix puppet help when a face throws an exceptionJeff McCune1-16/+16
Without this patch applied the `puppet help` command displays nothing but an exception when a 3rd party face throws an exception during the loading process. For example: Error: Could not autoload puppet/face/node/classify: no such file to load -- fog Error: Could not autoload puppet/face/node: Could not autoload puppet/face/node/classify: no such file to load -- fog Error: Failed to load face node: Error: Could not find version current of node Error: Try 'puppet help help help' for usage This is a problem because `puppet help` should be robust and provide helpful information in all cases. This patch fixes the problem by catching loading errors when building the list of available face subcommands and their summaries. If an exception is caught, it is handled by marking that face subcommand and presenting a message indicating the face is unavailable in the help output. This looks like: Usage: puppet <subcommand> [options] <action> [options] Available subcommands: agent The puppet agent daemon apply Apply Puppet manifests locally ca Local Puppet Certificate Authority management. catalog Compile, save, view, and convert catalogs. cert Manage certificates and requests certificate Provide access to the CA for certificate management. certificate_request Manage certificate requests. certificate_revocation_list Manage the list of revoked certificates. config Interact with Puppet's configuration options. describe Display help about resource types device Manage remote network devices doc Generate Puppet documentation and references facts Retrieve and store facts. file Retrieve and store files in a filebucket filebucket Store and retrieve files in a filebucket help Display Puppet help. inspect Send an inspection report instrumentation_data Manage instrumentation listener accumulated data. instrumentation_listener Manage instrumentation listeners. instrumentation_probe Manage instrumentation probes. key Create, save, and remove certificate keys. kick Remotely control puppet agent man Display Puppet manual pages. master The puppet master daemon module Creates, installs and searches for modules on the Puppet Forge. ! node ! Subcommand unavailable due to error. Check error logs. ! node_aws ! Subcommand unavailable due to error. Check error logs. ! node_vmware ! Subcommand unavailable due to error. Check error logs. parser Interact directly with the parser. plugin Interact with the Puppet plugin system. queue Queuing daemon for asynchronous storeconfigs report Create, display, and submit reports. resource The resource abstraction layer shell resource_type View classes, defined resource types, and nodes from all manifests. secret_agent Mimics puppet agent. status View puppet server status. See 'puppet help <subcommand> <action>' for help on a specific subcommand action. See 'puppet help <subcommand>' for help on a specific subcommand. Puppet v3.0.0 This patch also contains two squashed commits from Andy Parker * Cleaned up help action by extracting methods * Split apart things to stop mingling concerns
2012-07-02(maint) Standardize on /usr/bin/env ruby -S rspecJeff McCune1-1/+1
Without this patch some spec files are using `ruby -S rspec` and others are using `rspec`. We should standardize on a single form of the interpreter used for spec files. `ruby -S rspec` is the best choice because it correctly informs editors such as Vim with Syntastic that the file is a Ruby file rather than an Rspec file.
2012-04-26(#14200) Fix help faceChris Price1-3/+13
This commit does the following: 1. Fix the help face so that--in the case where there exists both an App and a Face by the same name, and the App is not just a stub for the Face--help gives preference to the App instead of the Face. The help face (as a command line tool) is mostly going to be used to help users navigate the other command line tools, so, e.g., "puppet help resource" should show help for the same tool that you will get by running "puppet resource". This was not the case prior to this commit. 2. Get rid of the separation between faces and applications in the help screen... making this distinction seems more confusing than helpful to the users, and exposes implementation details that users should not need to be concerned with. 3. Change all class names for Applications to conform to the convention of "foo_bar" file names mapping to "FooBar" class names.
2012-04-09Fix loading of faces in specsPatrick Carlisle1-3/+9
Iterating over faces outside of a test causes problems because the run mode is not set properly. Moving this inside of actual test cases allows the spec helper to fake any necessary setup. Changes due to Chris Price
2011-04-22maint: clean up test headers on face spec files.Daniel Pittman1-1/+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>
2011-04-21Merge remote-tracking branch ↵Daniel Pittman1-0/+12
'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>
2011-04-19maint: test the 'help' face has the default action 'help'Daniel Pittman1-1/+1
We had a pending test for this, but forgot to write it way back when we were implementing the feature. Add it now. Reviewed-By: Max Martin <max@puppetlabs.com>
2011-04-15maint: speed up testing output of the help face.Daniel Pittman1-9/+13
We were generating the help output multiple times and testing it for multiple properties; now we generate it once and test it multiple times. This makes for less clear error reporting, but saving dozens of calls at ~ 1/3rd a second each is worth it. Paired-With: Max Martin <max@puppetlabs.com>
2011-04-14(7118) Adding summaries for all facesLuke Kanies1-2/+13
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>
2011-04-13maint: clean up the spec test headers in bulk.Daniel Pittman1-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.
2011-04-13(#7056) Use 'face' rather than 'faces' in the production code.Daniel Pittman1-0/+112
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.