summaryrefslogtreecommitdiffstats
path: root/spec/unit/util/autoload.rb
Commit message (Collapse)AuthorAgeFilesLines
* [#3994] rename the specs to have _spec.rb at the endMarkus Roberts2010-06-231-120/+0
| | | | | | | | | Some spec files like active_record.rb had names that would confuse the load path and get loaded instead of the intended implentation when the spec was run from the same directory as the file. Author: Matt Robinson <matt@puppetlabs.com> Date: Fri Jun 11 15:29:33 2010 -0700
* [#3674] Part 2: Autoloader load method should propagate failuresJesse Wolfe2010-02-171-13/+4
| | | | | | | | | Change Autoloader's load to re-raise exceptions that happen when trying to load files, rather than just warning. This version still does not raise an error if the file is not found, as doing so would change the behavior of 'load' pretty significantly, but I am ambivalent this.
* [#3674] Autoloader should propagate failuresJesse Wolfe2010-02-171-2/+2
| | | | | | | Change Autoloader's loadall to re-raise exceptions that happen when trying to load files, rather than just warning. Signed-off-by: Jesse Wolfe <jes5199@gmail.com>
* Part 2 of fix for #1175 (functions in environments)Markus Roberts2010-02-171-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Jesse and I are shooting for the minimal viable fix here, with the idea that a great deal of refactoring is needed but isn't appropriate at this time. The changes in this commit are: * Index the function-holding modules by environment * We need to know the "current environment" when we're defining a function so we can attach it to the proper module, and this information isn't dynamically available when user-defined functions are being created (we're being called by user written code that doesn't "know" about environments) so we cheat and stash the value in Puppet::Node::Environment * since we must do this anyway, it turns out to be cleaner & safer to do the same when we are evaluating a functon. This is the main change from the prior version of this patch. * Add a special *root* environment for the built in functions, and extend all scopes with it. * Index the function characteristics (name, type, docstring, etc.) by environment * Make the autoloader environment aware, so that it uses the modulepath for the specified environment rather than the default * Turn off caching of the modulepath since it potentially changes for each node * Tweak tests that weren't environment aware
* Fix for #3094 (libdir should take ":" delimited path)Markus Roberts2010-01-301-1/+2
| | | | | | | | Actually, File::PATH_SEPARATOR, which is generally, but not always, ":"). Since libdir is also the default for the plugin handler, users will need to specify it explicitly if a multipart libdir is given (and it will need to be one of the segments given in the libdir for the plugins to be found).
* Fixing #2963 spec/unit/util/autoload.rb depends on global stateJesse Wolfe2009-12-201-0/+2
| | | | | | | An Autoload spec was depending on files having not yet been autoloaded. Detected as part of #2879. Signed-off-by: Jesse Wolfe <jes5199@gmail.com>
* Fixing #2574 - autoloading finds plugins in modulesLuke Kanies2009-09-011-3/+17
| | | | | | | | We had some stupid errors that were preventing this from happening; this fixes them and adds an integration test. Signed-off-by: Luke Kanies <luke@madstop.com>
* Ruby no longer clobbers puppet autoloadingLuke Kanies2009-07-161-1/+16
| | | | | | | | | We basically just make sure that we tell Ruby about files we've loaded, so you can 'require' these files and doing so will essentially no-op, rather than clobbering the already-loaded code. Signed-off-by: Luke Kanies <luke@madstop.com>
* Caching whether named autoloaded files are missingLuke Kanies2009-05-201-1/+7
| | | | | | | | This is the big win, because it causes us to just skip the whole loading infrastructure, including skipping looking through the modulepath. Signed-off-by: Luke Kanies <luke@madstop.com>
* Adding caching of file metadata to the autoloaderLuke Kanies2009-05-201-2/+12
| | | | | | | | | | | The cache isn't actually used yet - this just adds all of the plumbing. It was found that stat'ing files that didn't exist could take up to 85% of a run, so this is progress toward getting rid of those stats. Signed-off-by: Luke Kanies <luke@madstop.com>
* Adding modulepath caching to the AutoloaderLuke Kanies2009-05-201-2/+48
| | | | | | | | | There's more caching to add, but this simplifies the interface to the list of paths and then caches that list so we aren't constantly searching the filesystem. Signed-off-by: Luke Kanies <luke@madstop.com>
* Fixing #1869 - autoloaded files should never leak exceptionsLuke Kanies2009-02-121-0/+39
Ruby's exception hierarchy is a bit strange, in that only exceptions that sub RuntimeError are caught by default. This patch explicitly catches the base class, Exception, which means that LoadError, SyntaxError, and any RuntimeErrors will all be caught. This is done for both load() and loadall(); load() uses Kernel.load, but loadall() uses Kernel.require. Signed-off-by: Luke Kanies <luke@madstop.com>