C0 code coverage information

Generated on Mon Mar 10 00:31:54 -0700 2008 with rcov 0.8.1.2


Code reported as executed by Ruby looks like this...
and this: this line is also marked as covered.
Lines considered as run by rcov, but not reported by Ruby, look like this,
and this: these lines were inferred by rcov (using simple heuristics).
Finally, here's a line marked as not executed.
Name Total lines Lines of code Total coverage Code coverage
lib/chef/recipe.rb 96 66
100.0%  
100.0%  
 1 #
 2 # Author:: Adam Jacob (<adam@hjksolutions.com>)
 3 # Copyright:: Copyright (c) 2008 HJK Solutions, LLC
 4 # License:: GNU General Public License version 2 or later
 5 # 
 6 # This program and entire repository is free software; you can
 7 # redistribute it and/or modify it under the terms of the GNU 
 8 # General Public License as published by the Free Software 
 9 # Foundation; either version 2 of the License, or any later version.
10 # 
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 # GNU General Public License for more details.
15 # 
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19 # 
20 
21 require File.join(File.dirname(__FILE__), "mixin", "from_file")
22 
23 class Chef
24   class Recipe
25     
26     include Chef::Mixin::FromFile
27         
28     attr_accessor :module_name, :recipe_name, :recipe, :node, :collection, 
29                   :definitions, :config, :params
30     
31     def initialize(module_name, recipe_name, node, collection=nil, definitions=nil, config=nil)
32       @module_name = module_name
33       @recipe_name = recipe_name
34       @node = node
35       if collection
36         @collection = collection
37       else
38         @collection = Chef::ResourceCollection.new()
39       end
40       if config
41         @config = config
42       else
43         @config = Chef::Config.new()
44       end
45       if definitions
46         @definitions = definitions
47       else
48         @definitions = Hash.new
49       end
50       @params = Hash.new
51     end
52     
53     def resources(*args)
54       @collection.resources(*args)
55     end
56         
57     def method_missing(method_symbol, *args, &block)
58       resource = nil
59       # If we have a definition that matches, we want to use that instead.  This should
60       # let you do some really crazy over-riding of "native" types, if you really want
61       # to.
62       if @definitions.has_key?(method_symbol)
63         new_def = @definitions[method_symbol].dup
64         new_def.instance_eval(&block)
65         new_recipe = Chef::Recipe.new(@module_name, @recipe_name, @node, @collection, @definitions, @config)
66         new_recipe.params = new_def.params
67         new_recipe.instance_eval(&new_def.recipe)
68       else
69         method_name = method_symbol.to_s
70       # Otherwise, we're rocking the regular resource call route.
71         rname = nil
72         case method_name
73         when /^(.+)_(.+)$/
74           rname = "Chef::Resource::#{$1.capitalize}#{$2.capitalize}"
75         when /^(.+)$/
76           rname = "Chef::Resource::#{$1.capitalize}"
77         end
78         begin
79           args << @collection
80           args << @config
81           resource = eval(rname).new(*args)
82           resource.params = @params
83           resource.instance_eval(&block)
84         rescue Exception => e
85           if e.kind_of?(NameError) && e.to_s =~ /Chef::Resource/
86             raise NameError, "Cannot find #{rname} for #{method_name}\nOriginal: #{e.to_s}"
87           else
88             raise e
89           end
90         end
91         @collection << resource
92         resource
93       end
94     end
95   end
96 end

Generated using the rcov code coverage analysis tool for Ruby version 0.8.1.2.

Valid XHTML 1.0! Valid CSS!