summaryrefslogtreecommitdiff
path: root/spec/unit/util/instrumentation_spec.rb
AgeCommit message (Collapse)AuthorFilesLines
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-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-23(maint) Ensure every file has a trailing newlinesJeff McCune1-1/+1
Without this patch some files exist in the tree that don't have trailing newlines. This is annoying because perl -pli.bak -e will automatically add a newline to every file it modifies in place. The files that actually have modifications by the global search and replace need to be separated from the files that only have newlines added. This patch simply adds newlines to everything if they don't exist on the last line. Yes, the PNG's are perfectly fine with a trailing newline as well.
2011-12-21Instrumentation foundation layerBrice Figureau1-0/+181
This is the base of the instrumentation layer. The idea is to allow instrumentation of code blocks. Each time this code is executed an event is fired to some event listeners that in turn can do whatever is needed to perform the instrumentation. This patch adds: * code instrumentation calls * the listener system Listeners are added by adding a file to puppet/util/instrumentation/listeners containing: Puppet::Util::Instrumentation.new_listener(:my_instrumentation, pattern) do def notify(label, event, data) ... do something for data... end end It is possible to use a "pattern". The listener will be notified only if the pattern match the label of the event. The pattern can be a symbol, a string or a regex. If no pattern is provided, then the listener will be notified for every event. The notify method will be called before and after the insturmented code is executed, with respectively an event of :start and then :stop. This class is thread-safe. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>