diff options
author | Adam Jacob <adam@hjksolutions.com> | 2008-03-10 00:38:43 -0700 |
---|---|---|
committer | Adam Jacob <adam@hjksolutions.com> | 2008-03-10 00:38:43 -0700 |
commit | 3dd77b260393bae93bb27677e3f8a45f407981c1 (patch) | |
tree | d017427ddcd5733caf7c0ceeec8ea72abbb107fa | |
parent | b4beed548959ca63365ca3d799c59a155047b5ff (diff) | |
download | chef-3dd77b260393bae93bb27677e3f8a45f407981c1.tar.gz |
Added rcov coverage, lots of tests, definitions, node support
56 files changed, 8980 insertions, 496 deletions
diff --git a/Manifest.txt b/Manifest.txt index 990172d4b5..a3bb60aaff 100644 --- a/Manifest.txt +++ b/Manifest.txt @@ -2,6 +2,6 @@ History.txt Manifest.txt README.txt Rakefile -bin/marionette -lib/marionette.rb -test/test_marionette.rb
\ No newline at end of file +bin/chef +lib/chef.rb +test/test_chef.rb
\ No newline at end of file diff --git a/README.txt b/README.txt index 5a4b5989de..2216d88244 100644 --- a/README.txt +++ b/README.txt @@ -1,10 +1,12 @@ -= marionette += chef -* http://oss.hjksolutions.com/marionette +* http://oss.hjksolutions.com/chef == DESCRIPTION: -Marionette is a configuration management tool inspired by Puppet. +Chef is a configuration management tool inspired by Puppet. + +I'm in ur netwerk, cookin up yer servers. :) == FEATURES/PROBLEMS: @@ -25,7 +27,7 @@ Marionette is a configuration management tool inspired by Puppet. == LICENSE: -Marionette - A configuration management system +Chef - A configuration management system Copyright 2008 HJK Solutions @@ -2,17 +2,17 @@ require 'rubygems' require 'hoe' -require './lib/marionette.rb' +require './lib/chef.rb' require './tasks/rspec.rb' # require Dir[File.join(File.dirname(__FILE__), 'tasks/**/*.rb')].sort.each do |lib| # require lib # end -Hoe.new('marionette', Marionette::VERSION) do |p| - p.rubyforge_name = 'marionette' +Hoe.new('chef', Chef::VERSION) do |p| + p.rubyforge_name = 'chef' p.author = 'Adam Jacob' p.email = 'adam@hjksolutions.com' - p.summary = 'A configuration management system' + p.summary = 'A configuration management system.' p.description = p.paragraphs_of('README.txt', 2..5).join("\n\n") p.url = p.paragraphs_of('README.txt', 0).first.split(/\n/)[1..-1] p.changes = p.paragraphs_of('History.txt', 0..1).join("\n\n") diff --git a/bin/marionette-dotgraph b/bin/marionette-dotgraph index 80e2f342d7..75c33da274 100755 --- a/bin/marionette-dotgraph +++ b/bin/marionette-dotgraph @@ -19,10 +19,10 @@ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # -require File.join(File.dirname(__FILE__), "..", "lib", "marionette") +require File.join(File.dirname(__FILE__), "..", "lib", "chef") require 'rgl/dot' -mr = Marionette::Recipe.new("test", "default", "node") +mr = Chef::Recipe.new("test", "default", "node") raise ArgumentError, "#{ARGV[0]} is not a file!" unless File.exists?(ARGV[0]) mr.instance_eval(IO.read(ARGV[0]), ARGV[0], 1) puts mr.inspect diff --git a/coverage/index.html b/coverage/index.html new file mode 100644 index 0000000000..edcf70bab5 --- /dev/null +++ b/coverage/index.html @@ -0,0 +1,468 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html lang='en' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'><head><title>C0 code coverage information</title> + <style type='text/css'>body { background-color: rgb(240, 240, 245); }</style> + <style type='text/css'>span.cross-ref-title { + font-size: 140%; +} +span.cross-ref a { + text-decoration: none; +} +span.cross-ref { + background-color:#f3f7fa; + border: 1px dashed #333; + margin: 1em; + padding: 0.5em; + overflow: hidden; +} +a.crossref-toggle { + text-decoration: none; +} +span.marked0 { + background-color: rgb(185, 210, 200); + display: block; +} +span.marked1 { + background-color: rgb(190, 215, 205); + display: block; +} +span.inferred0 { + background-color: rgb(175, 200, 200); + display: block; +} +span.inferred1 { + background-color: rgb(180, 205, 205); + display: block; +} +span.uncovered0 { + background-color: rgb(225, 110, 110); + display: block; +} +span.uncovered1 { + background-color: rgb(235, 120, 120); + display: block; +} +span.overview { + border-bottom: 8px solid black; +} +div.overview { + border-bottom: 8px solid black; +} +body { + font-family: verdana, arial, helvetica; +} +div.footer { + font-size: 68%; + margin-top: 1.5em; +} +h1, h2, h3, h4, h5, h6 { + margin-bottom: 0.5em; +} +h5 { + margin-top: 0.5em; +} +.hidden { + display: none; +} +div.separator { + height: 10px; +} +/* Commented out for better readability, esp. on IE */ +/* +table tr td, table tr th { + font-size: 68%; +} +td.value table tr td { + font-size: 11px; +} +*/ +table.percent_graph { + height: 12px; + border: #808080 1px solid; + empty-cells: show; +} +table.percent_graph td.covered { + height: 10px; + background: #00f000; +} +table.percent_graph td.uncovered { + height: 10px; + background: #e00000; +} +table.percent_graph td.NA { + height: 10px; + background: #eaeaea; +} +table.report { + border-collapse: collapse; + width: 100%; +} +table.report td.heading { + background: #dcecff; + border: #d0d0d0 1px solid; + font-weight: bold; + text-align: center; +} +table.report td.heading:hover { + background: #c0ffc0; +} +table.report td.text { + border: #d0d0d0 1px solid; +} +table.report td.value, +table.report td.lines_total, +table.report td.lines_code { + text-align: right; + border: #d0d0d0 1px solid; +} +table.report tr.light { + background-color: rgb(240, 240, 245); +} +table.report tr.dark { + background-color: rgb(230, 230, 235); +} +</style> + <script type='text/javascript'> +// <![CDATA[ + function toggleCode( id ) { + if ( document.getElementById ) + elem = document.getElementById( id ); + else if ( document.all ) + elem = eval( "document.all." + id ); + else + return false; + + elemStyle = elem.style; + + if ( elemStyle.display != "block" ) { + elemStyle.display = "block" + } else { + elemStyle.display = "none" + } + + return true; + } + + // Make cross-references hidden by default + document.writeln( "<style type=\"text/css\">span.cross-ref { display: none }</style>" ) + // ]]> +</script> + </head> + <body><h3>C0 code coverage information</h3> + <p>Generated on Mon Mar 10 00:31:51 -0700 2008 with <a href='http://eigenclass.org/hiki/rcov'>rcov 0.8.1.2</a> + </p> + <hr/> + <table class='report'><thead><tr><td class='heading'>Name</td> + <td class='heading'>Total lines</td> + <td class='heading'>Lines of code</td> + <td class='heading'>Total coverage</td> + <td class='heading'>Code coverage</td> + </tr> + </thead> + <tbody><tr class='light'><td>TOTAL</td> + <td class='lines_total'><tt>801</tt> + </td> + <td class='lines_code'><tt>518</tt> + </td> + <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_total'>100.0%</tt> + </td> + <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='100'/> + <td class='uncovered' width='0'/> + </tr> + </table> + </td> + </tr> + </table> + </td> + <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_code'>100.0%</tt> + </td> + <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='100'/> + <td class='uncovered' width='0'/> + </tr> + </table> + </td> + </tr> + </table> + </td> + </tr> + <tr class='dark'><td><a href='lib-chef_rb.html'>lib/chef.rb</a> + </td> + <td class='lines_total'><tt>26</tt> + </td> + <td class='lines_code'><tt>5</tt> + </td> + <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_total'>100.0%</tt> + </td> + <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='100'/> + <td class='uncovered' width='0'/> + </tr> + </table> + </td> + </tr> + </table> + </td> + <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_code'>100.0%</tt> + </td> + <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='100'/> + <td class='uncovered' width='0'/> + </tr> + </table> + </td> + </tr> + </table> + </td> + </tr> + <tr class='light'><td><a href='lib-chef-config_rb.html'>lib/chef/config.rb</a> + </td> + <td class='lines_total'><tt>69</tt> + </td> + <td class='lines_code'><tt>43</tt> + </td> + <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_total'>100.0%</tt> + </td> + <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='100'/> + <td class='uncovered' width='0'/> + </tr> + </table> + </td> + </tr> + </table> + </td> + <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_code'>100.0%</tt> + </td> + <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='100'/> + <td class='uncovered' width='0'/> + </tr> + </table> + </td> + </tr> + </table> + </td> + </tr> + <tr class='dark'><td><a href='lib-chef-mixin-check_helper_rb.html'>lib/chef/mixin/check_helper.rb</a> + </td> + <td class='lines_total'><tt>33</tt> + </td> + <td class='lines_code'><tt>14</tt> + </td> + <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_total'>100.0%</tt> + </td> + <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='100'/> + <td class='uncovered' width='0'/> + </tr> + </table> + </td> + </tr> + </table> + </td> + <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_code'>100.0%</tt> + </td> + <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='100'/> + <td class='uncovered' width='0'/> + </tr> + </table> + </td> + </tr> + </table> + </td> + </tr> + <tr class='light'><td><a href='lib-chef-mixin-from_file_rb.html'>lib/chef/mixin/from_file.rb</a> + </td> + <td class='lines_total'><tt>32</tt> + </td> + <td class='lines_code'><tt>13</tt> + </td> + <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_total'>100.0%</tt> + </td> + <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='100'/> + <td class='uncovered' width='0'/> + </tr> + </table> + </td> + </tr> + </table> + </td> + <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_code'>100.0%</tt> + </td> + <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='100'/> + <td class='uncovered' width='0'/> + </tr> + </table> + </td> + </tr> + </table> + </td> + </tr> + <tr class='dark'><td><a href='lib-chef-node_rb.html'>lib/chef/node.rb</a> + </td> + <td class='lines_total'><tt>91</tt> + </td> + <td class='lines_code'><tt>60</tt> + </td> + <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_total'>100.0%</tt> + </td> + <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='100'/> + <td class='uncovered' width='0'/> + </tr> + </table> + </td> + </tr> + </table> + </td> + <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_code'>100.0%</tt> + </td> + <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='100'/> + <td class='uncovered' width='0'/> + </tr> + </table> + </td> + </tr> + </table> + </td> + </tr> + <tr class='light'><td><a href='lib-chef-recipe_rb.html'>lib/chef/recipe.rb</a> + </td> + <td class='lines_total'><tt>96</tt> + </td> + <td class='lines_code'><tt>66</tt> + </td> + <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_total'>100.0%</tt> + </td> + <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='100'/> + <td class='uncovered' width='0'/> + </tr> + </table> + </td> + </tr> + </table> + </td> + <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_code'>100.0%</tt> + </td> + <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='100'/> + <td class='uncovered' width='0'/> + </tr> + </table> + </td> + </tr> + </table> + </td> + </tr> + <tr class='dark'><td><a href='lib-chef-resource_rb.html'>lib/chef/resource.rb</a> + </td> + <td class='lines_total'><tt>123</tt> + </td> + <td class='lines_code'><tt>90</tt> + </td> + <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_total'>100.0%</tt> + </td> + <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='100'/> + <td class='uncovered' width='0'/> + </tr> + </table> + </td> + </tr> + </table> + </td> + <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_code'>100.0%</tt> + </td> + <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='100'/> + <td class='uncovered' width='0'/> + </tr> + </table> + </td> + </tr> + </table> + </td> + </tr> + <tr class='light'><td><a href='lib-chef-resource-file_rb.html'>lib/chef/resource/file.rb</a> + </td> + <td class='lines_total'><tt>113</tt> + </td> + <td class='lines_code'><tt>84</tt> + </td> + <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_total'>100.0%</tt> + </td> + <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='100'/> + <td class='uncovered' width='0'/> + </tr> + </table> + </td> + </tr> + </table> + </td> + <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_code'>100.0%</tt> + </td> + <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='100'/> + <td class='uncovered' width='0'/> + </tr> + </table> + </td> + </tr> + </table> + </td> + </tr> + <tr class='dark'><td><a href='lib-chef-resource_collection_rb.html'>lib/chef/resource_collection.rb</a> + </td> + <td class='lines_total'><tt>155</tt> + </td> + <td class='lines_code'><tt>110</tt> + </td> + <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_total'>100.0%</tt> + </td> + <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='100'/> + <td class='uncovered' width='0'/> + </tr> + </table> + </td> + </tr> + </table> + </td> + <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_code'>100.0%</tt> + </td> + <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='100'/> + <td class='uncovered' width='0'/> + </tr> + </table> + </td> + </tr> + </table> + </td> + </tr> + <tr class='light'><td><a href='lib-chef-resource_definition_rb.html'>lib/chef/resource_definition.rb</a> + </td> + <td class='lines_total'><tt>63</tt> + </td> + <td class='lines_code'><tt>33</tt> + </td> + <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_total'>100.0%</tt> + </td> + <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='100'/> + <td class='uncovered' width='0'/> + </tr> + </table> + </td> + </tr> + </table> + </td> + <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_code'>100.0%</tt> + </td> + <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='100'/> + <td class='uncovered' width='0'/> + </tr> + </table> + </td> + </tr> + </table> + </td> + </tr> + </tbody> + </table> +<hr/> + <p>Generated using the <a href='http://eigenclass.org/hiki.rb?rcov'>rcov code coverage analysis tool for Ruby</a> + version 0.8.1.2.</p> +<p><a href='http://validator.w3.org/check/referer'><img src='http://www.w3.org/Icons/valid-xhtml11' height='31' alt='Valid XHTML 1.1!' width='88'/> + </a> + <a href='http://jigsaw.w3.org/css-validator/check/referer'><img src='http://jigsaw.w3.org/css-validator/images/vcss' alt='Valid CSS!' style='border:0;width:88px;height:31px'/> + </a> + </p> + </body> + </html> diff --git a/coverage/lib-chef-config_rb.html b/coverage/lib-chef-config_rb.html new file mode 100644 index 0000000000..0aabc9efb0 --- /dev/null +++ b/coverage/lib-chef-config_rb.html @@ -0,0 +1,679 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html lang='en' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'><head><title>lib/chef/config.rb - C0 code coverage information</title> + <style type='text/css'>body { background-color: rgb(240, 240, 245); }</style> + <style type='text/css'>span.cross-ref-title { + font-size: 140%; +} +span.cross-ref a { + text-decoration: none; +} +span.cross-ref { + background-color:#f3f7fa; + border: 1px dashed #333; + margin: 1em; + padding: 0.5em; + overflow: hidden; +} +a.crossref-toggle { + text-decoration: none; +} +span.marked0 { + background-color: rgb(185, 210, 200); + display: block; +} +span.marked1 { + background-color: rgb(190, 215, 205); + display: block; +} +span.inferred0 { + background-color: rgb(175, 200, 200); + display: block; +} +span.inferred1 { + background-color: rgb(180, 205, 205); + display: block; +} +span.uncovered0 { + background-color: rgb(225, 110, 110); + display: block; +} +span.uncovered1 { + background-color: rgb(235, 120, 120); + display: block; +} +span.overview { + border-bottom: 8px solid black; +} +div.overview { + border-bottom: 8px solid black; +} +body { + font-family: verdana, arial, helvetica; +} +div.footer { + font-size: 68%; + margin-top: 1.5em; +} +h1, h2, h3, h4, h5, h6 { + margin-bottom: 0.5em; +} +h5 { + margin-top: 0.5em; +} +.hidden { + display: none; +} +div.separator { + height: 10px; +} +/* Commented out for better readability, esp. on IE */ +/* +table tr td, table tr th { + font-size: 68%; +} +td.value table tr td { + font-size: 11px; +} +*/ +table.percent_graph { + height: 12px; + border: #808080 1px solid; + empty-cells: show; +} +table.percent_graph td.covered { + height: 10px; + background: #00f000; +} +table.percent_graph td.uncovered { + height: 10px; + background: #e00000; +} +table.percent_graph td.NA { + height: 10px; + background: #eaeaea; +} +table.report { + border-collapse: collapse; + width: 100%; +} +table.report td.heading { + background: #dcecff; + border: #d0d0d0 1px solid; + font-weight: bold; + text-align: center; +} +table.report td.heading:hover { + background: #c0ffc0; +} +table.report td.text { + border: #d0d0d0 1px solid; +} +table.report td.value, +table.report td.lines_total, +table.report td.lines_code { + text-align: right; + border: #d0d0d0 1px solid; +} +table.report tr.light { + background-color: rgb(240, 240, 245); +} +table.report tr.dark { + background-color: rgb(230, 230, 235); +} +</style> + <script type='text/javascript'> +// <![CDATA[ + function toggleCode( id ) { + if ( document.getElementById ) + elem = document.getElementById( id ); + else if ( document.all ) + elem = eval( "document.all." + id ); + else + return false; + + elemStyle = elem.style; + + if ( elemStyle.display != "block" ) { + elemStyle.display = "block" + } else { + elemStyle.display = "none" + } + + return true; + } + + // Make cross-references hidden by default + document.writeln( "<style type=\"text/css\">span.cross-ref { display: none }</style>" ) + // ]]> +</script> + <style type='text/css'>span.run0 { + background-color: rgb(178, 204, 255); + display: block; +} +span.run1 { + background-color: rgb(178, 206, 255); + display: block; +} +span.run2 { + background-color: rgb(178, 209, 255); + display: block; +} +span.run3 { + background-color: rgb(178, 211, 255); + display: block; +} +span.run4 { + background-color: rgb(178, 214, 255); + display: block; +} +span.run5 { + background-color: rgb(178, 218, 255); + display: block; +} +span.run6 { + background-color: rgb(178, 220, 255); + display: block; +} +span.run7 { + background-color: rgb(178, 223, 255); + display: block; +} +span.run8 { + background-color: rgb(178, 225, 255); + display: block; +} +span.run9 { + background-color: rgb(178, 228, 255); + display: block; +} +span.run10 { + background-color: rgb(178, 232, 255); + display: block; +} +span.run11 { + background-color: rgb(178, 234, 255); + display: block; +} +span.run12 { + background-color: rgb(178, 237, 255); + display: block; +} +span.run13 { + background-color: rgb(178, 239, 255); + display: block; +} +span.run14 { + background-color: rgb(178, 242, 255); + display: block; +} +span.run15 { + background-color: rgb(178, 246, 255); + display: block; +} +span.run16 { + background-color: rgb(178, 248, 255); + display: block; +} +span.run17 { + background-color: rgb(178, 251, 255); + display: block; +} +span.run18 { + background-color: rgb(178, 253, 255); + display: block; +} +span.run19 { + background-color: rgb(178, 255, 253); + display: block; +} +span.run20 { + background-color: rgb(178, 255, 249); + display: block; +} +span.run21 { + background-color: rgb(178, 255, 247); + display: block; +} +span.run22 { + background-color: rgb(178, 255, 244); + display: block; +} +span.run23 { + background-color: rgb(178, 255, 242); + display: block; +} +span.run24 { + background-color: rgb(178, 255, 239); + display: block; +} +span.run25 { + background-color: rgb(178, 255, 235); + display: block; +} +span.run26 { + background-color: rgb(178, 255, 233); + display: block; +} +span.run27 { + background-color: rgb(178, 255, 230); + display: block; +} +span.run28 { + background-color: rgb(178, 255, 228); + display: block; +} +span.run29 { + background-color: rgb(178, 255, 225); + display: block; +} +span.run30 { + background-color: rgb(178, 255, 221); + display: block; +} +span.run31 { + background-color: rgb(178, 255, 219); + display: block; +} +span.run32 { + background-color: rgb(178, 255, 216); + display: block; +} +span.run33 { + background-color: rgb(178, 255, 214); + display: block; +} +span.run34 { + background-color: rgb(178, 255, 211); + display: block; +} +span.run35 { + background-color: rgb(178, 255, 207); + display: block; +} +span.run36 { + background-color: rgb(178, 255, 205); + display: block; +} +span.run37 { + background-color: rgb(178, 255, 202); + display: block; +} +span.run38 { + background-color: rgb(178, 255, 200); + display: block; +} +span.run39 { + background-color: rgb(178, 255, 197); + display: block; +} +span.run40 { + background-color: rgb(178, 255, 193); + display: block; +} +span.run41 { + background-color: rgb(178, 255, 191); + display: block; +} +span.run42 { + background-color: rgb(178, 255, 188); + display: block; +} +span.run43 { + background-color: rgb(178, 255, 186); + display: block; +} +span.run44 { + background-color: rgb(178, 255, 183); + display: block; +} +span.run45 { + background-color: rgb(178, 255, 179); + display: block; +} +span.run46 { + background-color: rgb(179, 255, 178); + display: block; +} +span.run47 { + background-color: rgb(182, 255, 178); + display: block; +} +span.run48 { + background-color: rgb(184, 255, 178); + display: block; +} +span.run49 { + background-color: rgb(187, 255, 178); + display: block; +} +span.run50 { + background-color: rgb(191, 255, 178); + display: block; +} +span.run51 { + background-color: rgb(193, 255, 178); + display: block; +} +span.run52 { + background-color: rgb(196, 255, 178); + display: block; +} +span.run53 { + background-color: rgb(198, 255, 178); + display: block; +} +span.run54 { + background-color: rgb(201, 255, 178); + display: block; +} +span.run55 { + background-color: rgb(205, 255, 178); + display: block; +} +span.run56 { + background-color: rgb(207, 255, 178); + display: block; +} +span.run57 { + background-color: rgb(210, 255, 178); + display: block; +} +span.run58 { + background-color: rgb(212, 255, 178); + display: block; +} +span.run59 { + background-color: rgb(215, 255, 178); + display: block; +} +span.run60 { + background-color: rgb(219, 255, 178); + display: block; +} +span.run61 { + background-color: rgb(221, 255, 178); + display: block; +} +span.run62 { + background-color: rgb(224, 255, 178); + display: block; +} +span.run63 { + background-color: rgb(226, 255, 178); + display: block; +} +span.run64 { + background-color: rgb(229, 255, 178); + display: block; +} +span.run65 { + background-color: rgb(233, 255, 178); + display: block; +} +span.run66 { + background-color: rgb(235, 255, 178); + display: block; +} +span.run67 { + background-color: rgb(238, 255, 178); + display: block; +} +span.run68 { + background-color: rgb(240, 255, 178); + display: block; +} +span.run69 { + background-color: rgb(243, 255, 178); + display: block; +} +span.run70 { + background-color: rgb(247, 255, 178); + display: block; +} +span.run71 { + background-color: rgb(249, 255, 178); + display: block; +} +span.run72 { + background-color: rgb(252, 255, 178); + display: block; +} +span.run73 { + background-color: rgb(255, 255, 178); + display: block; +} +span.run74 { + background-color: rgb(255, 252, 178); + display: block; +} +span.run75 { + background-color: rgb(255, 248, 178); + display: block; +} +span.run76 { + background-color: rgb(255, 246, 178); + display: block; +} +span.run77 { + background-color: rgb(255, 243, 178); + display: block; +} +span.run78 { + background-color: rgb(255, 240, 178); + display: block; +} +span.run79 { + background-color: rgb(255, 238, 178); + display: block; +} +span.run80 { + background-color: rgb(255, 234, 178); + display: block; +} +span.run81 { + background-color: rgb(255, 232, 178); + display: block; +} +span.run82 { + background-color: rgb(255, 229, 178); + display: block; +} +span.run83 { + background-color: rgb(255, 226, 178); + display: block; +} +span.run84 { + background-color: rgb(255, 224, 178); + display: block; +} +span.run85 { + background-color: rgb(255, 220, 178); + display: block; +} +span.run86 { + background-color: rgb(255, 218, 178); + display: block; +} +span.run87 { + background-color: rgb(255, 215, 178); + display: block; +} +span.run88 { + background-color: rgb(255, 212, 178); + display: block; +} +span.run89 { + background-color: rgb(255, 210, 178); + display: block; +} +span.run90 { + background-color: rgb(255, 206, 178); + display: block; +} +span.run91 { + background-color: rgb(255, 204, 178); + display: block; +} +span.run92 { + background-color: rgb(255, 201, 178); + display: block; +} +span.run93 { + background-color: rgb(255, 198, 178); + display: block; +} +span.run94 { + background-color: rgb(255, 196, 178); + display: block; +} +span.run95 { + background-color: rgb(255, 192, 178); + display: block; +} +span.run96 { + background-color: rgb(255, 189, 178); + display: block; +} +span.run97 { + background-color: rgb(255, 187, 178); + display: block; +} +span.run98 { + background-color: rgb(255, 184, 178); + display: block; +} +span.run99 { + background-color: rgb(255, 182, 178); + display: block; +} +span.run100 { + background-color: rgb(255, 178, 178); + display: block; +} +</style> + </head> + <body><h3>C0 code coverage information</h3> + <p>Generated on Mon Mar 10 00:31:52 -0700 2008 with <a href='http://eigenclass.org/hiki/rcov'>rcov 0.8.1.2</a> + </p> + <hr/> + <pre><span class='marked0'>Code reported as executed by Ruby looks like this... +</span><span class='marked1'>and this: this line is also marked as covered. +</span><span class='inferred0'>Lines considered as run by rcov, but not reported by Ruby, look like this, +</span><span class='inferred1'>and this: these lines were inferred by rcov (using simple heuristics). +</span><span class='uncovered0'>Finally, here's a line marked as not executed. +</span></pre> +<table class='report'><thead><tr><td class='heading'>Name</td> + <td class='heading'>Total lines</td> + <td class='heading'>Lines of code</td> + <td class='heading'>Total coverage</td> + <td class='heading'>Code coverage</td> + </tr> + </thead> + <tbody><tr class='light'><td><a href='lib-chef-config_rb.html'>lib/chef/config.rb</a> + </td> + <td class='lines_total'><tt>69</tt> + </td> + <td class='lines_code'><tt>43</tt> + </td> + <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_total'>100.0%</tt> + </td> + <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='100'/> + <td class='uncovered' width='0'/> + </tr> + </table> + </td> + </tr> + </table> + </td> + <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_code'>100.0%</tt> + </td> + <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='100'/> + <td class='uncovered' width='0'/> + </tr> + </table> + </td> + </tr> + </table> + </td> + </tr> + </tbody> + </table> +<pre><span class="inferred1"><a name="line1"></a> 1 # +</span><span class="inferred0"><a name="line2"></a> 2 # Author:: Adam Jacob (<adam@hjksolutions.com>) +</span><span class="inferred1"><a name="line3"></a> 3 # Copyright:: Copyright (c) 2008 HJK Solutions, LLC +</span><span class="inferred0"><a name="line4"></a> 4 # License:: GNU General Public License version 2 or later +</span><span class="inferred1"><a name="line5"></a> 5 # +</span><span class="inferred0"><a name="line6"></a> 6 # This program and entire repository is free software; you can +</span><span class="inferred1"><a name="line7"></a> 7 # redistribute it and/or modify it under the terms of the GNU +</span><span class="inferred0"><a name="line8"></a> 8 # General Public License as published by the Free Software +</span><span class="inferred1"><a name="line9"></a> 9 # Foundation; either version 2 of the License, or any later version. +</span><span class="inferred0"><a name="line10"></a>10 # +</span><span class="inferred1"><a name="line11"></a>11 # This program is distributed in the hope that it will be useful, +</span><span class="inferred0"><a name="line12"></a>12 # but WITHOUT ANY WARRANTY; without even the implied warranty of +</span><span class="inferred1"><a name="line13"></a>13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +</span><span class="inferred0"><a name="line14"></a>14 # GNU General Public License for more details. +</span><span class="inferred1"><a name="line15"></a>15 # +</span><span class="inferred0"><a name="line16"></a>16 # You should have received a copy of the GNU General Public License +</span><span class="inferred1"><a name="line17"></a>17 # along with this program; if not, write to the Free Software +</span><span class="inferred0"><a name="line18"></a>18 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +</span><span class="inferred1"><a name="line19"></a>19 # +</span><span class="inferred0"><a name="line20"></a>20 +</span><span class="marked1"><a name="line21"></a>21 require File.join(File.dirname(__FILE__), "mixin", "check_helper") +</span><span class="inferred0"><a name="line22"></a>22 +</span><span class="marked1"><a name="line23"></a>23 class Chef +</span><span class="marked0"><a name="line24"></a>24 class Config +</span><span class="inferred1"><a name="line25"></a>25 +</span><span class="marked0"><a name="line26"></a>26 include Chef::Mixin::CheckHelper +</span><span class="inferred1"><a name="line27"></a>27 +</span><span class="marked0"><a name="line28"></a>28 def initialize +</span><span class="marked1"><a name="line29"></a>29 set_defaults +</span><span class="marked0"><a name="line30"></a>30 end +</span><span class="inferred1"><a name="line31"></a>31 +</span><span class="marked0"><a name="line32"></a>32 def self.load_file(file) +</span><span class="marked1"><a name="line33"></a>33 config = Chef::Config.new +</span><span class="marked0"><a name="line34"></a>34 if File.exists?(file) && File.readable?(file) +</span><span class="marked1"><a name="line35"></a>35 begin +</span><span class="marked0"><a name="line36"></a>36 config.instance_eval(IO.read(file), file, 1) +</span><span class="inferred1"><a name="line37"></a>37 rescue NoMethodError => e +</span><span class="marked0"><a name="line38"></a>38 new_message = "You probably tried to use a config variable that doesn't exist!\n" +</span><span class="marked1"><a name="line39"></a>39 new_message += e.message +</span><span class="marked0"><a name="line40"></a>40 raise e.exception(new_message) +</span><span class="inferred1"><a name="line41"></a>41 end +</span><span class="inferred0"><a name="line42"></a>42 else +</span><span class="marked1"><a name="line43"></a>43 raise IOError, "Cannot find or read #{file}!" +</span><span class="inferred0"><a name="line44"></a>44 end +</span><span class="marked1"><a name="line45"></a>45 config +</span><span class="inferred0"><a name="line46"></a>46 end +</span><span class="inferred1"><a name="line47"></a>47 +</span><span class="marked0"><a name="line48"></a>48 def cookbook_path(*args) +</span><span class="marked1"><a name="line49"></a>49 if args.length == 0 +</span><span class="marked0"><a name="line50"></a>50 @cookbook_path +</span><span class="inferred1"><a name="line51"></a>51 else +</span><span class="marked0"><a name="line52"></a>52 flat_args = args.flatten +</span><span class="marked1"><a name="line53"></a>53 flat_args.each do |a| +</span><span class="marked0"><a name="line54"></a>54 unless a.kind_of?(String) +</span><span class="marked1"><a name="line55"></a>55 raise ArgumentError, "You must pass strings to cookbook_path!" +</span><span class="inferred0"><a name="line56"></a>56 end +</span><span class="inferred1"><a name="line57"></a>57 end +</span><span class="marked0"><a name="line58"></a>58 @cookbook_path = flat_args +</span><span class="inferred1"><a name="line59"></a>59 end +</span><span class="marked0"><a name="line60"></a>60 end +</span><span class="inferred1"><a name="line61"></a>61 +</span><span class="marked0"><a name="line62"></a>62 def set_defaults +</span><span class="marked1"><a name="line63"></a>63 @cookbook_path = [ +</span><span class="inferred0"><a name="line64"></a>64 "/etc/chef/site-cookbook", +</span><span class="inferred1"><a name="line65"></a>65 "/etc/chef/cookbook", +</span><span class="inferred0"><a name="line66"></a>66 ] +</span><span class="marked1"><a name="line67"></a>67 end +</span><span class="inferred0"><a name="line68"></a>68 end +</span><span class="inferred1"><a name="line69"></a>69 end +</span></pre><hr/> + <p>Generated using the <a href='http://eigenclass.org/hiki.rb?rcov'>rcov code coverage analysis tool for Ruby</a> + version 0.8.1.2.</p> +<p><a href='http://validator.w3.org/check/referer'><img src='http://www.w3.org/Icons/valid-xhtml10' height='31' alt='Valid XHTML 1.0!' width='88'/> + </a> + <a href='http://jigsaw.w3.org/css-validator/check/referer'><img src='http://jigsaw.w3.org/css-validator/images/vcss' alt='Valid CSS!' style='border:0;width:88px;height:31px'/> + </a> + </p> + </body> + </html> diff --git a/coverage/lib-chef-mixin-check_helper_rb.html b/coverage/lib-chef-mixin-check_helper_rb.html new file mode 100644 index 0000000000..639b5eaa67 --- /dev/null +++ b/coverage/lib-chef-mixin-check_helper_rb.html @@ -0,0 +1,643 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html lang='en' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'><head><title>lib/chef/mixin/check_helper.rb - C0 code coverage information</title> + <style type='text/css'>body { background-color: rgb(240, 240, 245); }</style> + <style type='text/css'>span.cross-ref-title { + font-size: 140%; +} +span.cross-ref a { + text-decoration: none; +} +span.cross-ref { + background-color:#f3f7fa; + border: 1px dashed #333; + margin: 1em; + padding: 0.5em; + overflow: hidden; +} +a.crossref-toggle { + text-decoration: none; +} +span.marked0 { + background-color: rgb(185, 210, 200); + display: block; +} +span.marked1 { + background-color: rgb(190, 215, 205); + display: block; +} +span.inferred0 { + background-color: rgb(175, 200, 200); + display: block; +} +span.inferred1 { + background-color: rgb(180, 205, 205); + display: block; +} +span.uncovered0 { + background-color: rgb(225, 110, 110); + display: block; +} +span.uncovered1 { + background-color: rgb(235, 120, 120); + display: block; +} +span.overview { + border-bottom: 8px solid black; +} +div.overview { + border-bottom: 8px solid black; +} +body { + font-family: verdana, arial, helvetica; +} +div.footer { + font-size: 68%; + margin-top: 1.5em; +} +h1, h2, h3, h4, h5, h6 { + margin-bottom: 0.5em; +} +h5 { + margin-top: 0.5em; +} +.hidden { + display: none; +} +div.separator { + height: 10px; +} +/* Commented out for better readability, esp. on IE */ +/* +table tr td, table tr th { + font-size: 68%; +} +td.value table tr td { + font-size: 11px; +} +*/ +table.percent_graph { + height: 12px; + border: #808080 1px solid; + empty-cells: show; +} +table.percent_graph td.covered { + height: 10px; + background: #00f000; +} +table.percent_graph td.uncovered { + height: 10px; + background: #e00000; +} +table.percent_graph td.NA { + height: 10px; + background: #eaeaea; +} +table.report { + border-collapse: collapse; + width: 100%; +} +table.report td.heading { + background: #dcecff; + border: #d0d0d0 1px solid; + font-weight: bold; + text-align: center; +} +table.report td.heading:hover { + background: #c0ffc0; +} +table.report td.text { + border: #d0d0d0 1px solid; +} +table.report td.value, +table.report td.lines_total, +table.report td.lines_code { + text-align: right; + border: #d0d0d0 1px solid; +} +table.report tr.light { + background-color: rgb(240, 240, 245); +} +table.report tr.dark { + background-color: rgb(230, 230, 235); +} +</style> + <script type='text/javascript'> +// <![CDATA[ + function toggleCode( id ) { + if ( document.getElementById ) + elem = document.getElementById( id ); + else if ( document.all ) + elem = eval( "document.all." + id ); + else + return false; + + elemStyle = elem.style; + + if ( elemStyle.display != "block" ) { + elemStyle.display = "block" + } else { + elemStyle.display = "none" + } + + return true; + } + + // Make cross-references hidden by default + document.writeln( "<style type=\"text/css\">span.cross-ref { display: none }</style>" ) + // ]]> +</script> + <style type='text/css'>span.run0 { + background-color: rgb(178, 204, 255); + display: block; +} +span.run1 { + background-color: rgb(178, 206, 255); + display: block; +} +span.run2 { + background-color: rgb(178, 209, 255); + display: block; +} +span.run3 { + background-color: rgb(178, 211, 255); + display: block; +} +span.run4 { + background-color: rgb(178, 214, 255); + display: block; +} +span.run5 { + background-color: rgb(178, 218, 255); + display: block; +} +span.run6 { + background-color: rgb(178, 220, 255); + display: block; +} +span.run7 { + background-color: rgb(178, 223, 255); + display: block; +} +span.run8 { + background-color: rgb(178, 225, 255); + display: block; +} +span.run9 { + background-color: rgb(178, 228, 255); + display: block; +} +span.run10 { + background-color: rgb(178, 232, 255); + display: block; +} +span.run11 { + background-color: rgb(178, 234, 255); + display: block; +} +span.run12 { + background-color: rgb(178, 237, 255); + display: block; +} +span.run13 { + background-color: rgb(178, 239, 255); + display: block; +} +span.run14 { + background-color: rgb(178, 242, 255); + display: block; +} +span.run15 { + background-color: rgb(178, 246, 255); + display: block; +} +span.run16 { + background-color: rgb(178, 248, 255); + display: block; +} +span.run17 { + background-color: rgb(178, 251, 255); + display: block; +} +span.run18 { + background-color: rgb(178, 253, 255); + display: block; +} +span.run19 { + background-color: rgb(178, 255, 253); + display: block; +} +span.run20 { + background-color: rgb(178, 255, 249); + display: block; +} +span.run21 { + background-color: rgb(178, 255, 247); + display: block; +} +span.run22 { + background-color: rgb(178, 255, 244); + display: block; +} +span.run23 { + background-color: rgb(178, 255, 242); + display: block; +} +span.run24 { + background-color: rgb(178, 255, 239); + display: block; +} +span.run25 { + background-color: rgb(178, 255, 235); + display: block; +} +span.run26 { + background-color: rgb(178, 255, 233); + display: block; +} +span.run27 { + background-color: rgb(178, 255, 230); + display: block; +} +span.run28 { + background-color: rgb(178, 255, 228); + display: block; +} +span.run29 { + background-color: rgb(178, 255, 225); + display: block; +} +span.run30 { + background-color: rgb(178, 255, 221); + display: block; +} +span.run31 { + background-color: rgb(178, 255, 219); + display: block; +} +span.run32 { + background-color: rgb(178, 255, 216); + display: block; +} +span.run33 { + background-color: rgb(178, 255, 214); + display: block; +} +span.run34 { + background-color: rgb(178, 255, 211); + display: block; +} +span.run35 { + background-color: rgb(178, 255, 207); + display: block; +} +span.run36 { + background-color: rgb(178, 255, 205); + display: block; +} +span.run37 { + background-color: rgb(178, 255, 202); + display: block; +} +span.run38 { + background-color: rgb(178, 255, 200); + display: block; +} +span.run39 { + background-color: rgb(178, 255, 197); + display: block; +} +span.run40 { + background-color: rgb(178, 255, 193); + display: block; +} +span.run41 { + background-color: rgb(178, 255, 191); + display: block; +} +span.run42 { + background-color: rgb(178, 255, 188); + display: block; +} +span.run43 { + background-color: rgb(178, 255, 186); + display: block; +} +span.run44 { + background-color: rgb(178, 255, 183); + display: block; +} +span.run45 { + background-color: rgb(178, 255, 179); + display: block; +} +span.run46 { + background-color: rgb(179, 255, 178); + display: block; +} +span.run47 { + background-color: rgb(182, 255, 178); + display: block; +} +span.run48 { + background-color: rgb(184, 255, 178); + display: block; +} +span.run49 { + background-color: rgb(187, 255, 178); + display: block; +} +span.run50 { + background-color: rgb(191, 255, 178); + display: block; +} +span.run51 { + background-color: rgb(193, 255, 178); + display: block; +} +span.run52 { + background-color: rgb(196, 255, 178); + display: block; +} +span.run53 { + background-color: rgb(198, 255, 178); + display: block; +} +span.run54 { + background-color: rgb(201, 255, 178); + display: block; +} +span.run55 { + background-color: rgb(205, 255, 178); + display: block; +} +span.run56 { + background-color: rgb(207, 255, 178); + display: block; +} +span.run57 { + background-color: rgb(210, 255, 178); + display: block; +} +span.run58 { + background-color: rgb(212, 255, 178); + display: block; +} +span.run59 { + background-color: rgb(215, 255, 178); + display: block; +} +span.run60 { + background-color: rgb(219, 255, 178); + display: block; +} +span.run61 { + background-color: rgb(221, 255, 178); + display: block; +} +span.run62 { + background-color: rgb(224, 255, 178); + display: block; +} +span.run63 { + background-color: rgb(226, 255, 178); + display: block; +} +span.run64 { + background-color: rgb(229, 255, 178); + display: block; +} +span.run65 { + background-color: rgb(233, 255, 178); + display: block; +} +span.run66 { + background-color: rgb(235, 255, 178); + display: block; +} +span.run67 { + background-color: rgb(238, 255, 178); + display: block; +} +span.run68 { + background-color: rgb(240, 255, 178); + display: block; +} +span.run69 { + background-color: rgb(243, 255, 178); + display: block; +} +span.run70 { + background-color: rgb(247, 255, 178); + display: block; +} +span.run71 { + background-color: rgb(249, 255, 178); + display: block; +} +span.run72 { + background-color: rgb(252, 255, 178); + display: block; +} +span.run73 { + background-color: rgb(255, 255, 178); + display: block; +} +span.run74 { + background-color: rgb(255, 252, 178); + display: block; +} +span.run75 { + background-color: rgb(255, 248, 178); + display: block; +} +span.run76 { + background-color: rgb(255, 246, 178); + display: block; +} +span.run77 { + background-color: rgb(255, 243, 178); + display: block; +} +span.run78 { + background-color: rgb(255, 240, 178); + display: block; +} +span.run79 { + background-color: rgb(255, 238, 178); + display: block; +} +span.run80 { + background-color: rgb(255, 234, 178); + display: block; +} +span.run81 { + background-color: rgb(255, 232, 178); + display: block; +} +span.run82 { + background-color: rgb(255, 229, 178); + display: block; +} +span.run83 { + background-color: rgb(255, 226, 178); + display: block; +} +span.run84 { + background-color: rgb(255, 224, 178); + display: block; +} +span.run85 { + background-color: rgb(255, 220, 178); + display: block; +} +span.run86 { + background-color: rgb(255, 218, 178); + display: block; +} +span.run87 { + background-color: rgb(255, 215, 178); + display: block; +} +span.run88 { + background-color: rgb(255, 212, 178); + display: block; +} +span.run89 { + background-color: rgb(255, 210, 178); + display: block; +} +span.run90 { + background-color: rgb(255, 206, 178); + display: block; +} +span.run91 { + background-color: rgb(255, 204, 178); + display: block; +} +span.run92 { + background-color: rgb(255, 201, 178); + display: block; +} +span.run93 { + background-color: rgb(255, 198, 178); + display: block; +} +span.run94 { + background-color: rgb(255, 196, 178); + display: block; +} +span.run95 { + background-color: rgb(255, 192, 178); + display: block; +} +span.run96 { + background-color: rgb(255, 189, 178); + display: block; +} +span.run97 { + background-color: rgb(255, 187, 178); + display: block; +} +span.run98 { + background-color: rgb(255, 184, 178); + display: block; +} +span.run99 { + background-color: rgb(255, 182, 178); + display: block; +} +span.run100 { + background-color: rgb(255, 178, 178); + display: block; +} +</style> + </head> + <body><h3>C0 code coverage information</h3> + <p>Generated on Mon Mar 10 00:31:53 -0700 2008 with <a href='http://eigenclass.org/hiki/rcov'>rcov 0.8.1.2</a> + </p> + <hr/> + <pre><span class='marked0'>Code reported as executed by Ruby looks like this... +</span><span class='marked1'>and this: this line is also marked as covered. +</span><span class='inferred0'>Lines considered as run by rcov, but not reported by Ruby, look like this, +</span><span class='inferred1'>and this: these lines were inferred by rcov (using simple heuristics). +</span><span class='uncovered0'>Finally, here's a line marked as not executed. +</span></pre> +<table class='report'><thead><tr><td class='heading'>Name</td> + <td class='heading'>Total lines</td> + <td class='heading'>Lines of code</td> + <td class='heading'>Total coverage</td> + <td class='heading'>Code coverage</td> + </tr> + </thead> + <tbody><tr class='light'><td><a href='lib-chef-mixin-check_helper_rb.html'>lib/chef/mixin/check_helper.rb</a> + </td> + <td class='lines_total'><tt>33</tt> + </td> + <td class='lines_code'><tt>14</tt> + </td> + <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_total'>100.0%</tt> + </td> + <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='100'/> + <td class='uncovered' width='0'/> + </tr> + </table> + </td> + </tr> + </table> + </td> + <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_code'>100.0%</tt> + </td> + <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='100'/> + <td class='uncovered' width='0'/> + </tr> + </table> + </td> + </tr> + </table> + </td> + </tr> + </tbody> + </table> +<pre><span class="inferred0"><a name="line1"></a> 1 # Author:: Adam Jacob (<adam@hjksolutions.com>) +</span><span class="inferred1"><a name="line2"></a> 2 # Copyright:: Copyright (c) 2008 HJK Solutions, LLC +</span><span class="inferred0"><a name="line3"></a> 3 # License:: GNU General Public License version 2 or later +</span><span class="inferred1"><a name="line4"></a> 4 # +</span><span class="inferred0"><a name="line5"></a> 5 # This program and entire repository is free software; you can +</span><span class="inferred1"><a name="line6"></a> 6 # redistribute it and/or modify it under the terms of the GNU +</span><span class="inferred0"><a name="line7"></a> 7 # General Public License as published by the Free Software +</span><span class="inferred1"><a name="line8"></a> 8 # Foundation; either version 2 of the License, or any later version. +</span><span class="inferred0"><a name="line9"></a> 9 # +</span><span class="inferred1"><a name="line10"></a>10 # This program is distributed in the hope that it will be useful, +</span><span class="inferred0"><a name="line11"></a>11 # but WITHOUT ANY WARRANTY; without even the implied warranty of +</span><span class="inferred1"><a name="line12"></a>12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +</span><span class="inferred0"><a name="line13"></a>13 # GNU General Public License for more details. +</span><span class="inferred1"><a name="line14"></a>14 # +</span><span class="inferred0"><a name="line15"></a>15 # You should have received a copy of the GNU General Public License +</span><span class="inferred1"><a name="line16"></a>16 # along with this program; if not, write to the Free Software +</span><span class="inferred0"><a name="line17"></a>17 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +</span><span class="inferred1"><a name="line18"></a>18 # +</span><span class="inferred0"><a name="line19"></a>19 +</span><span class="marked1"><a name="line20"></a>20 class Chef +</span><span class="marked0"><a name="line21"></a>21 module Mixin +</span><span class="marked1"><a name="line22"></a>22 module CheckHelper +</span><span class="marked0"><a name="line23"></a>23 def set_if_args(thing, arguments) +</span><span class="marked1"><a name="line24"></a>24 raise ArgumentError, "Must call set_if_args with a block!" unless Kernel.block_given? +</span><span class="marked0"><a name="line25"></a>25 if arguments != nil +</span><span class="marked1"><a name="line26"></a>26 yield(arguments) +</span><span class="inferred0"><a name="line27"></a>27 else +</span><span class="marked1"><a name="line28"></a>28 thing +</span><span class="inferred0"><a name="line29"></a>29 end +</span><span class="inferred1"><a name="line30"></a>30 end +</span><span class="inferred0"><a name="line31"></a>31 end +</span><span class="inferred1"><a name="line32"></a>32 end +</span><span class="inferred0"><a name="line33"></a>33 end +</span></pre><hr/> + <p>Generated using the <a href='http://eigenclass.org/hiki.rb?rcov'>rcov code coverage analysis tool for Ruby</a> + version 0.8.1.2.</p> +<p><a href='http://validator.w3.org/check/referer'><img src='http://www.w3.org/Icons/valid-xhtml10' height='31' alt='Valid XHTML 1.0!' width='88'/> + </a> + <a href='http://jigsaw.w3.org/css-validator/check/referer'><img src='http://jigsaw.w3.org/css-validator/images/vcss' alt='Valid CSS!' style='border:0;width:88px;height:31px'/> + </a> + </p> + </body> + </html> diff --git a/coverage/lib-chef-mixin-from_file_rb.html b/coverage/lib-chef-mixin-from_file_rb.html new file mode 100644 index 0000000000..02362e8a28 --- /dev/null +++ b/coverage/lib-chef-mixin-from_file_rb.html @@ -0,0 +1,642 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html lang='en' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'><head><title>lib/chef/mixin/from_file.rb - C0 code coverage information</title> + <style type='text/css'>body { background-color: rgb(240, 240, 245); }</style> + <style type='text/css'>span.cross-ref-title { + font-size: 140%; +} +span.cross-ref a { + text-decoration: none; +} +span.cross-ref { + background-color:#f3f7fa; + border: 1px dashed #333; + margin: 1em; + padding: 0.5em; + overflow: hidden; +} +a.crossref-toggle { + text-decoration: none; +} +span.marked0 { + background-color: rgb(185, 210, 200); + display: block; +} +span.marked1 { + background-color: rgb(190, 215, 205); + display: block; +} +span.inferred0 { + background-color: rgb(175, 200, 200); + display: block; +} +span.inferred1 { + background-color: rgb(180, 205, 205); + display: block; +} +span.uncovered0 { + background-color: rgb(225, 110, 110); + display: block; +} +span.uncovered1 { + background-color: rgb(235, 120, 120); + display: block; +} +span.overview { + border-bottom: 8px solid black; +} +div.overview { + border-bottom: 8px solid black; +} +body { + font-family: verdana, arial, helvetica; +} +div.footer { + font-size: 68%; + margin-top: 1.5em; +} +h1, h2, h3, h4, h5, h6 { + margin-bottom: 0.5em; +} +h5 { + margin-top: 0.5em; +} +.hidden { + display: none; +} +div.separator { + height: 10px; +} +/* Commented out for better readability, esp. on IE */ +/* +table tr td, table tr th { + font-size: 68%; +} +td.value table tr td { + font-size: 11px; +} +*/ +table.percent_graph { + height: 12px; + border: #808080 1px solid; + empty-cells: show; +} +table.percent_graph td.covered { + height: 10px; + background: #00f000; +} +table.percent_graph td.uncovered { + height: 10px; + background: #e00000; +} +table.percent_graph td.NA { + height: 10px; + background: #eaeaea; +} +table.report { + border-collapse: collapse; + width: 100%; +} +table.report td.heading { + background: #dcecff; + border: #d0d0d0 1px solid; + font-weight: bold; + text-align: center; +} +table.report td.heading:hover { + background: #c0ffc0; +} +table.report td.text { + border: #d0d0d0 1px solid; +} +table.report td.value, +table.report td.lines_total, +table.report td.lines_code { + text-align: right; + border: #d0d0d0 1px solid; +} +table.report tr.light { + background-color: rgb(240, 240, 245); +} +table.report tr.dark { + background-color: rgb(230, 230, 235); +} +</style> + <script type='text/javascript'> +// <![CDATA[ + function toggleCode( id ) { + if ( document.getElementById ) + elem = document.getElementById( id ); + else if ( document.all ) + elem = eval( "document.all." + id ); + else + return false; + + elemStyle = elem.style; + + if ( elemStyle.display != "block" ) { + elemStyle.display = "block" + } else { + elemStyle.display = "none" + } + + return true; + } + + // Make cross-references hidden by default + document.writeln( "<style type=\"text/css\">span.cross-ref { display: none }</style>" ) + // ]]> +</script> + <style type='text/css'>span.run0 { + background-color: rgb(178, 204, 255); + display: block; +} +span.run1 { + background-color: rgb(178, 206, 255); + display: block; +} +span.run2 { + background-color: rgb(178, 209, 255); + display: block; +} +span.run3 { + background-color: rgb(178, 211, 255); + display: block; +} +span.run4 { + background-color: rgb(178, 214, 255); + display: block; +} +span.run5 { + background-color: rgb(178, 218, 255); + display: block; +} +span.run6 { + background-color: rgb(178, 220, 255); + display: block; +} +span.run7 { + background-color: rgb(178, 223, 255); + display: block; +} +span.run8 { + background-color: rgb(178, 225, 255); + display: block; +} +span.run9 { + background-color: rgb(178, 228, 255); + display: block; +} +span.run10 { + background-color: rgb(178, 232, 255); + display: block; +} +span.run11 { + background-color: rgb(178, 234, 255); + display: block; +} +span.run12 { + background-color: rgb(178, 237, 255); + display: block; +} +span.run13 { + background-color: rgb(178, 239, 255); + display: block; +} +span.run14 { + background-color: rgb(178, 242, 255); + display: block; +} +span.run15 { + background-color: rgb(178, 246, 255); + display: block; +} +span.run16 { + background-color: rgb(178, 248, 255); + display: block; +} +span.run17 { + background-color: rgb(178, 251, 255); + display: block; +} +span.run18 { + background-color: rgb(178, 253, 255); + display: block; +} +span.run19 { + background-color: rgb(178, 255, 253); + display: block; +} +span.run20 { + background-color: rgb(178, 255, 249); + display: block; +} +span.run21 { + background-color: rgb(178, 255, 247); + display: block; +} +span.run22 { + background-color: rgb(178, 255, 244); + display: block; +} +span.run23 { + background-color: rgb(178, 255, 242); + display: block; +} +span.run24 { + background-color: rgb(178, 255, 239); + display: block; +} +span.run25 { + background-color: rgb(178, 255, 235); + display: block; +} +span.run26 { + background-color: rgb(178, 255, 233); + display: block; +} +span.run27 { + background-color: rgb(178, 255, 230); + display: block; +} +span.run28 { + background-color: rgb(178, 255, 228); + display: block; +} +span.run29 { + background-color: rgb(178, 255, 225); + display: block; +} +span.run30 { + background-color: rgb(178, 255, 221); + display: block; +} +span.run31 { + background-color: rgb(178, 255, 219); + display: block; +} +span.run32 { + background-color: rgb(178, 255, 216); + display: block; +} +span.run33 { + background-color: rgb(178, 255, 214); + display: block; +} +span.run34 { + background-color: rgb(178, 255, 211); + display: block; +} +span.run35 { + background-color: rgb(178, 255, 207); + display: block; +} +span.run36 { + background-color: rgb(178, 255, 205); + display: block; +} +span.run37 { + background-color: rgb(178, 255, 202); + display: block; +} +span.run38 { + background-color: rgb(178, 255, 200); + display: block; +} +span.run39 { + background-color: rgb(178, 255, 197); + display: block; +} +span.run40 { + background-color: rgb(178, 255, 193); + display: block; +} +span.run41 { + background-color: rgb(178, 255, 191); + display: block; +} +span.run42 { + background-color: rgb(178, 255, 188); + display: block; +} +span.run43 { + background-color: rgb(178, 255, 186); + display: block; +} +span.run44 { + background-color: rgb(178, 255, 183); + display: block; +} +span.run45 { + background-color: rgb(178, 255, 179); + display: block; +} +span.run46 { + background-color: rgb(179, 255, 178); + display: block; +} +span.run47 { + background-color: rgb(182, 255, 178); + display: block; +} +span.run48 { + background-color: rgb(184, 255, 178); + display: block; +} +span.run49 { + background-color: rgb(187, 255, 178); + display: block; +} +span.run50 { + background-color: rgb(191, 255, 178); + display: block; +} +span.run51 { + background-color: rgb(193, 255, 178); + display: block; +} +span.run52 { + background-color: rgb(196, 255, 178); + display: block; +} +span.run53 { + background-color: rgb(198, 255, 178); + display: block; +} +span.run54 { + background-color: rgb(201, 255, 178); + display: block; +} +span.run55 { + background-color: rgb(205, 255, 178); + display: block; +} +span.run56 { + background-color: rgb(207, 255, 178); + display: block; +} +span.run57 { + background-color: rgb(210, 255, 178); + display: block; +} +span.run58 { + background-color: rgb(212, 255, 178); + display: block; +} +span.run59 { + background-color: rgb(215, 255, 178); + display: block; +} +span.run60 { + background-color: rgb(219, 255, 178); + display: block; +} +span.run61 { + background-color: rgb(221, 255, 178); + display: block; +} +span.run62 { + background-color: rgb(224, 255, 178); + display: block; +} +span.run63 { + background-color: rgb(226, 255, 178); + display: block; +} +span.run64 { + background-color: rgb(229, 255, 178); + display: block; +} +span.run65 { + background-color: rgb(233, 255, 178); + display: block; +} +span.run66 { + background-color: rgb(235, 255, 178); + display: block; +} +span.run67 { + background-color: rgb(238, 255, 178); + display: block; +} +span.run68 { + background-color: rgb(240, 255, 178); + display: block; +} +span.run69 { + background-color: rgb(243, 255, 178); + display: block; +} +span.run70 { + background-color: rgb(247, 255, 178); + display: block; +} +span.run71 { + background-color: rgb(249, 255, 178); + display: block; +} +span.run72 { + background-color: rgb(252, 255, 178); + display: block; +} +span.run73 { + background-color: rgb(255, 255, 178); + display: block; +} +span.run74 { + background-color: rgb(255, 252, 178); + display: block; +} +span.run75 { + background-color: rgb(255, 248, 178); + display: block; +} +span.run76 { + background-color: rgb(255, 246, 178); + display: block; +} +span.run77 { + background-color: rgb(255, 243, 178); + display: block; +} +span.run78 { + background-color: rgb(255, 240, 178); + display: block; +} +span.run79 { + background-color: rgb(255, 238, 178); + display: block; +} +span.run80 { + background-color: rgb(255, 234, 178); + display: block; +} +span.run81 { + background-color: rgb(255, 232, 178); + display: block; +} +span.run82 { + background-color: rgb(255, 229, 178); + display: block; +} +span.run83 { + background-color: rgb(255, 226, 178); + display: block; +} +span.run84 { + background-color: rgb(255, 224, 178); + display: block; +} +span.run85 { + background-color: rgb(255, 220, 178); + display: block; +} +span.run86 { + background-color: rgb(255, 218, 178); + display: block; +} +span.run87 { + background-color: rgb(255, 215, 178); + display: block; +} +span.run88 { + background-color: rgb(255, 212, 178); + display: block; +} +span.run89 { + background-color: rgb(255, 210, 178); + display: block; +} +span.run90 { + background-color: rgb(255, 206, 178); + display: block; +} +span.run91 { + background-color: rgb(255, 204, 178); + display: block; +} +span.run92 { + background-color: rgb(255, 201, 178); + display: block; +} +span.run93 { + background-color: rgb(255, 198, 178); + display: block; +} +span.run94 { + background-color: rgb(255, 196, 178); + display: block; +} +span.run95 { + background-color: rgb(255, 192, 178); + display: block; +} +span.run96 { + background-color: rgb(255, 189, 178); + display: block; +} +span.run97 { + background-color: rgb(255, 187, 178); + display: block; +} +span.run98 { + background-color: rgb(255, 184, 178); + display: block; +} +span.run99 { + background-color: rgb(255, 182, 178); + display: block; +} +span.run100 { + background-color: rgb(255, 178, 178); + display: block; +} +</style> + </head> + <body><h3>C0 code coverage information</h3> + <p>Generated on Mon Mar 10 00:31:53 -0700 2008 with <a href='http://eigenclass.org/hiki/rcov'>rcov 0.8.1.2</a> + </p> + <hr/> + <pre><span class='marked0'>Code reported as executed by Ruby looks like this... +</span><span class='marked1'>and this: this line is also marked as covered. +</span><span class='inferred0'>Lines considered as run by rcov, but not reported by Ruby, look like this, +</span><span class='inferred1'>and this: these lines were inferred by rcov (using simple heuristics). +</span><span class='uncovered0'>Finally, here's a line marked as not executed. +</span></pre> +<table class='report'><thead><tr><td class='heading'>Name</td> + <td class='heading'>Total lines</td> + <td class='heading'>Lines of code</td> + <td class='heading'>Total coverage</td> + <td class='heading'>Code coverage</td> + </tr> + </thead> + <tbody><tr class='light'><td><a href='lib-chef-mixin-from_file_rb.html'>lib/chef/mixin/from_file.rb</a> + </td> + <td class='lines_total'><tt>32</tt> + </td> + <td class='lines_code'><tt>13</tt> + </td> + <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_total'>100.0%</tt> + </td> + <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='100'/> + <td class='uncovered' width='0'/> + </tr> + </table> + </td> + </tr> + </table> + </td> + <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_code'>100.0%</tt> + </td> + <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='100'/> + <td class='uncovered' width='0'/> + </tr> + </table> + </td> + </tr> + </table> + </td> + </tr> + </tbody> + </table> +<pre><span class="inferred1"><a name="line1"></a> 1 # Author:: Adam Jacob (<adam@hjksolutions.com>) +</span><span class="inferred0"><a name="line2"></a> 2 # Copyright:: Copyright (c) 2008 HJK Solutions, LLC +</span><span class="inferred1"><a name="line3"></a> 3 # License:: GNU General Public License version 2 or later +</span><span class="inferred0"><a name="line4"></a> 4 # +</span><span class="inferred1"><a name="line5"></a> 5 # This program and entire repository is free software; you can +</span><span class="inferred0"><a name="line6"></a> 6 # redistribute it and/or modify it under the terms of the GNU +</span><span class="inferred1"><a name="line7"></a> 7 # General Public License as published by the Free Software +</span><span class="inferred0"><a name="line8"></a> 8 # Foundation; either version 2 of the License, or any later version. +</span><span class="inferred1"><a name="line9"></a> 9 # +</span><span class="inferred0"><a name="line10"></a>10 # This program is distributed in the hope that it will be useful, +</span><span class="inferred1"><a name="line11"></a>11 # but WITHOUT ANY WARRANTY; without even the implied warranty of +</span><span class="inferred0"><a name="line12"></a>12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +</span><span class="inferred1"><a name="line13"></a>13 # GNU General Public License for more details. +</span><span class="inferred0"><a name="line14"></a>14 # +</span><span class="inferred1"><a name="line15"></a>15 # You should have received a copy of the GNU General Public License +</span><span class="inferred0"><a name="line16"></a>16 # along with this program; if not, write to the Free Software +</span><span class="inferred1"><a name="line17"></a>17 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +</span><span class="inferred0"><a name="line18"></a>18 # +</span><span class="inferred1"><a name="line19"></a>19 +</span><span class="marked0"><a name="line20"></a>20 class Chef +</span><span class="marked1"><a name="line21"></a>21 module Mixin +</span><span class="marked0"><a name="line22"></a>22 module FromFile +</span><span class="marked1"><a name="line23"></a>23 def from_file(filename) +</span><span class="marked0"><a name="line24"></a>24 if File.exists?(filename) && File.readable?(filename) +</span><span class="marked1"><a name="line25"></a>25 self.instance_eval(IO.read(filename), filename, 1) +</span><span class="inferred0"><a name="line26"></a>26 else +</span><span class="marked1"><a name="line27"></a>27 raise IOError, "Cannot open or read #{filename}!" +</span><span class="inferred0"><a name="line28"></a>28 end +</span><span class="marked1"><a name="line29"></a>29 end +</span><span class="inferred0"><a name="line30"></a>30 end +</span><span class="inferred1"><a name="line31"></a>31 end +</span><span class="inferred0"><a name="line32"></a>32 end +</span></pre><hr/> + <p>Generated using the <a href='http://eigenclass.org/hiki.rb?rcov'>rcov code coverage analysis tool for Ruby</a> + version 0.8.1.2.</p> +<p><a href='http://validator.w3.org/check/referer'><img src='http://www.w3.org/Icons/valid-xhtml10' height='31' alt='Valid XHTML 1.0!' width='88'/> + </a> + <a href='http://jigsaw.w3.org/css-validator/check/referer'><img src='http://jigsaw.w3.org/css-validator/images/vcss' alt='Valid CSS!' style='border:0;width:88px;height:31px'/> + </a> + </p> + </body> + </html> diff --git a/coverage/lib-chef-node_rb.html b/coverage/lib-chef-node_rb.html new file mode 100644 index 0000000000..00f0a03e4c --- /dev/null +++ b/coverage/lib-chef-node_rb.html @@ -0,0 +1,701 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html lang='en' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'><head><title>lib/chef/node.rb - C0 code coverage information</title> + <style type='text/css'>body { background-color: rgb(240, 240, 245); }</style> + <style type='text/css'>span.cross-ref-title { + font-size: 140%; +} +span.cross-ref a { + text-decoration: none; +} +span.cross-ref { + background-color:#f3f7fa; + border: 1px dashed #333; + margin: 1em; + padding: 0.5em; + overflow: hidden; +} +a.crossref-toggle { + text-decoration: none; +} +span.marked0 { + background-color: rgb(185, 210, 200); + display: block; +} +span.marked1 { + background-color: rgb(190, 215, 205); + display: block; +} +span.inferred0 { + background-color: rgb(175, 200, 200); + display: block; +} +span.inferred1 { + background-color: rgb(180, 205, 205); + display: block; +} +span.uncovered0 { + background-color: rgb(225, 110, 110); + display: block; +} +span.uncovered1 { + background-color: rgb(235, 120, 120); + display: block; +} +span.overview { + border-bottom: 8px solid black; +} +div.overview { + border-bottom: 8px solid black; +} +body { + font-family: verdana, arial, helvetica; +} +div.footer { + font-size: 68%; + margin-top: 1.5em; +} +h1, h2, h3, h4, h5, h6 { + margin-bottom: 0.5em; +} +h5 { + margin-top: 0.5em; +} +.hidden { + display: none; +} +div.separator { + height: 10px; +} +/* Commented out for better readability, esp. on IE */ +/* +table tr td, table tr th { + font-size: 68%; +} +td.value table tr td { + font-size: 11px; +} +*/ +table.percent_graph { + height: 12px; + border: #808080 1px solid; + empty-cells: show; +} +table.percent_graph td.covered { + height: 10px; + background: #00f000; +} +table.percent_graph td.uncovered { + height: 10px; + background: #e00000; +} +table.percent_graph td.NA { + height: 10px; + background: #eaeaea; +} +table.report { + border-collapse: collapse; + width: 100%; +} +table.report td.heading { + background: #dcecff; + border: #d0d0d0 1px solid; + font-weight: bold; + text-align: center; +} +table.report td.heading:hover { + background: #c0ffc0; +} +table.report td.text { + border: #d0d0d0 1px solid; +} +table.report td.value, +table.report td.lines_total, +table.report td.lines_code { + text-align: right; + border: #d0d0d0 1px solid; +} +table.report tr.light { + background-color: rgb(240, 240, 245); +} +table.report tr.dark { + background-color: rgb(230, 230, 235); +} +</style> + <script type='text/javascript'> +// <![CDATA[ + function toggleCode( id ) { + if ( document.getElementById ) + elem = document.getElementById( id ); + else if ( document.all ) + elem = eval( "document.all." + id ); + else + return false; + + elemStyle = elem.style; + + if ( elemStyle.display != "block" ) { + elemStyle.display = "block" + } else { + elemStyle.display = "none" + } + + return true; + } + + // Make cross-references hidden by default + document.writeln( "<style type=\"text/css\">span.cross-ref { display: none }</style>" ) + // ]]> +</script> + <style type='text/css'>span.run0 { + background-color: rgb(178, 204, 255); + display: block; +} +span.run1 { + background-color: rgb(178, 206, 255); + display: block; +} +span.run2 { + background-color: rgb(178, 209, 255); + display: block; +} +span.run3 { + background-color: rgb(178, 211, 255); + display: block; +} +span.run4 { + background-color: rgb(178, 214, 255); + display: block; +} +span.run5 { + background-color: rgb(178, 218, 255); + display: block; +} +span.run6 { + background-color: rgb(178, 220, 255); + display: block; +} +span.run7 { + background-color: rgb(178, 223, 255); + display: block; +} +span.run8 { + background-color: rgb(178, 225, 255); + display: block; +} +span.run9 { + background-color: rgb(178, 228, 255); + display: block; +} +span.run10 { + background-color: rgb(178, 232, 255); + display: block; +} +span.run11 { + background-color: rgb(178, 234, 255); + display: block; +} +span.run12 { + background-color: rgb(178, 237, 255); + display: block; +} +span.run13 { + background-color: rgb(178, 239, 255); + display: block; +} +span.run14 { + background-color: rgb(178, 242, 255); + display: block; +} +span.run15 { + background-color: rgb(178, 246, 255); + display: block; +} +span.run16 { + background-color: rgb(178, 248, 255); + display: block; +} +span.run17 { + background-color: rgb(178, 251, 255); + display: block; +} +span.run18 { + background-color: rgb(178, 253, 255); + display: block; +} +span.run19 { + background-color: rgb(178, 255, 253); + display: block; +} +span.run20 { + background-color: rgb(178, 255, 249); + display: block; +} +span.run21 { + background-color: rgb(178, 255, 247); + display: block; +} +span.run22 { + background-color: rgb(178, 255, 244); + display: block; +} +span.run23 { + background-color: rgb(178, 255, 242); + display: block; +} +span.run24 { + background-color: rgb(178, 255, 239); + display: block; +} +span.run25 { + background-color: rgb(178, 255, 235); + display: block; +} +span.run26 { + background-color: rgb(178, 255, 233); + display: block; +} +span.run27 { + background-color: rgb(178, 255, 230); + display: block; +} +span.run28 { + background-color: rgb(178, 255, 228); + display: block; +} +span.run29 { + background-color: rgb(178, 255, 225); + display: block; +} +span.run30 { + background-color: rgb(178, 255, 221); + display: block; +} +span.run31 { + background-color: rgb(178, 255, 219); + display: block; +} +span.run32 { + background-color: rgb(178, 255, 216); + display: block; +} +span.run33 { + background-color: rgb(178, 255, 214); + display: block; +} +span.run34 { + background-color: rgb(178, 255, 211); + display: block; +} +span.run35 { + background-color: rgb(178, 255, 207); + display: block; +} +span.run36 { + background-color: rgb(178, 255, 205); + display: block; +} +span.run37 { + background-color: rgb(178, 255, 202); + display: block; +} +span.run38 { + background-color: rgb(178, 255, 200); + display: block; +} +span.run39 { + background-color: rgb(178, 255, 197); + display: block; +} +span.run40 { + background-color: rgb(178, 255, 193); + display: block; +} +span.run41 { + background-color: rgb(178, 255, 191); + display: block; +} +span.run42 { + background-color: rgb(178, 255, 188); + display: block; +} +span.run43 { + background-color: rgb(178, 255, 186); + display: block; +} +span.run44 { + background-color: rgb(178, 255, 183); + display: block; +} +span.run45 { + background-color: rgb(178, 255, 179); + display: block; +} +span.run46 { + background-color: rgb(179, 255, 178); + display: block; +} +span.run47 { + background-color: rgb(182, 255, 178); + display: block; +} +span.run48 { + background-color: rgb(184, 255, 178); + display: block; +} +span.run49 { + background-color: rgb(187, 255, 178); + display: block; +} +span.run50 { + background-color: rgb(191, 255, 178); + display: block; +} +span.run51 { + background-color: rgb(193, 255, 178); + display: block; +} +span.run52 { + background-color: rgb(196, 255, 178); + display: block; +} +span.run53 { + background-color: rgb(198, 255, 178); + display: block; +} +span.run54 { + background-color: rgb(201, 255, 178); + display: block; +} +span.run55 { + background-color: rgb(205, 255, 178); + display: block; +} +span.run56 { + background-color: rgb(207, 255, 178); + display: block; +} +span.run57 { + background-color: rgb(210, 255, 178); + display: block; +} +span.run58 { + background-color: rgb(212, 255, 178); + display: block; +} +span.run59 { + background-color: rgb(215, 255, 178); + display: block; +} +span.run60 { + background-color: rgb(219, 255, 178); + display: block; +} +span.run61 { + background-color: rgb(221, 255, 178); + display: block; +} +span.run62 { + background-color: rgb(224, 255, 178); + display: block; +} +span.run63 { + background-color: rgb(226, 255, 178); + display: block; +} +span.run64 { + background-color: rgb(229, 255, 178); + display: block; +} +span.run65 { + background-color: rgb(233, 255, 178); + display: block; +} +span.run66 { + background-color: rgb(235, 255, 178); + display: block; +} +span.run67 { + background-color: rgb(238, 255, 178); + display: block; +} +span.run68 { + background-color: rgb(240, 255, 178); + display: block; +} +span.run69 { + background-color: rgb(243, 255, 178); + display: block; +} +span.run70 { + background-color: rgb(247, 255, 178); + display: block; +} +span.run71 { + background-color: rgb(249, 255, 178); + display: block; +} +span.run72 { + background-color: rgb(252, 255, 178); + display: block; +} +span.run73 { + background-color: rgb(255, 255, 178); + display: block; +} +span.run74 { + background-color: rgb(255, 252, 178); + display: block; +} +span.run75 { + background-color: rgb(255, 248, 178); + display: block; +} +span.run76 { + background-color: rgb(255, 246, 178); + display: block; +} +span.run77 { + background-color: rgb(255, 243, 178); + display: block; +} +span.run78 { + background-color: rgb(255, 240, 178); + display: block; +} +span.run79 { + background-color: rgb(255, 238, 178); + display: block; +} +span.run80 { + background-color: rgb(255, 234, 178); + display: block; +} +span.run81 { + background-color: rgb(255, 232, 178); + display: block; +} +span.run82 { + background-color: rgb(255, 229, 178); + display: block; +} +span.run83 { + background-color: rgb(255, 226, 178); + display: block; +} +span.run84 { + background-color: rgb(255, 224, 178); + display: block; +} +span.run85 { + background-color: rgb(255, 220, 178); + display: block; +} +span.run86 { + background-color: rgb(255, 218, 178); + display: block; +} +span.run87 { + background-color: rgb(255, 215, 178); + display: block; +} +span.run88 { + background-color: rgb(255, 212, 178); + display: block; +} +span.run89 { + background-color: rgb(255, 210, 178); + display: block; +} +span.run90 { + background-color: rgb(255, 206, 178); + display: block; +} +span.run91 { + background-color: rgb(255, 204, 178); + display: block; +} +span.run92 { + background-color: rgb(255, 201, 178); + display: block; +} +span.run93 { + background-color: rgb(255, 198, 178); + display: block; +} +span.run94 { + background-color: rgb(255, 196, 178); + display: block; +} +span.run95 { + background-color: rgb(255, 192, 178); + display: block; +} +span.run96 { + background-color: rgb(255, 189, 178); + display: block; +} +span.run97 { + background-color: rgb(255, 187, 178); + display: block; +} +span.run98 { + background-color: rgb(255, 184, 178); + display: block; +} +span.run99 { + background-color: rgb(255, 182, 178); + display: block; +} +span.run100 { + background-color: rgb(255, 178, 178); + display: block; +} +</style> + </head> + <body><h3>C0 code coverage information</h3> + <p>Generated on Mon Mar 10 00:31:54 -0700 2008 with <a href='http://eigenclass.org/hiki/rcov'>rcov 0.8.1.2</a> + </p> + <hr/> + <pre><span class='marked0'>Code reported as executed by Ruby looks like this... +</span><span class='marked1'>and this: this line is also marked as covered. +</span><span class='inferred0'>Lines considered as run by rcov, but not reported by Ruby, look like this, +</span><span class='inferred1'>and this: these lines were inferred by rcov (using simple heuristics). +</span><span class='uncovered0'>Finally, here's a line marked as not executed. +</span></pre> +<table class='report'><thead><tr><td class='heading'>Name</td> + <td class='heading'>Total lines</td> + <td class='heading'>Lines of code</td> + <td class='heading'>Total coverage</td> + <td class='heading'>Code coverage</td> + </tr> + </thead> + <tbody><tr class='light'><td><a href='lib-chef-node_rb.html'>lib/chef/node.rb</a> + </td> + <td class='lines_total'><tt>91</tt> + </td> + <td class='lines_code'><tt>60</tt> + </td> + <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_total'>100.0%</tt> + </td> + <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='100'/> + <td class='uncovered' width='0'/> + </tr> + </table> + </td> + </tr> + </table> + </td> + <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_code'>100.0%</tt> + </td> + <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='100'/> + <td class='uncovered' width='0'/> + </tr> + </table> + </td> + </tr> + </table> + </td> + </tr> + </tbody> + </table> +<pre><span class="inferred1"><a name="line1"></a> 1 # +</span><span class="inferred0"><a name="line2"></a> 2 # Author:: Adam Jacob (<adam@hjksolutions.com>) +</span><span class="inferred1"><a name="line3"></a> 3 # Copyright:: Copyright (c) 2008 HJK Solutions, LLC +</span><span class="inferred0"><a name="line4"></a> 4 # License:: GNU General Public License version 2 or later +</span><span class="inferred1"><a name="line5"></a> 5 # +</span><span class="inferred0"><a name="line6"></a> 6 # This program and entire repository is free software; you can +</span><span class="inferred1"><a name="line7"></a> 7 # redistribute it and/or modify it under the terms of the GNU +</span><span class="inferred0"><a name="line8"></a> 8 # General Public License as published by the Free Software +</span><span class="inferred1"><a name="line9"></a> 9 # Foundation; either version 2 of the License, or any later version. +</span><span class="inferred0"><a name="line10"></a>10 # +</span><span class="inferred1"><a name="line11"></a>11 # This program is distributed in the hope that it will be useful, +</span><span class="inferred0"><a name="line12"></a>12 # but WITHOUT ANY WARRANTY; without even the implied warranty of +</span><span class="inferred1"><a name="line13"></a>13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +</span><span class="inferred0"><a name="line14"></a>14 # GNU General Public License for more details. +</span><span class="inferred1"><a name="line15"></a>15 # +</span><span class="inferred0"><a name="line16"></a>16 # You should have received a copy of the GNU General Public License +</span><span class="inferred1"><a name="line17"></a>17 # along with this program; if not, write to the Free Software +</span><span class="inferred0"><a name="line18"></a>18 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +</span><span class="inferred1"><a name="line19"></a>19 # +</span><span class="inferred0"><a name="line20"></a>20 +</span><span class="marked1"><a name="line21"></a>21 require File.join(File.dirname(__FILE__), "mixin", "check_helper") +</span><span class="marked0"><a name="line22"></a>22 require File.join(File.dirname(__FILE__), "mixin", "from_file") +</span><span class="inferred1"><a name="line23"></a>23 +</span><span class="marked0"><a name="line24"></a>24 class Chef +</span><span class="marked1"><a name="line25"></a>25 class Node +</span><span class="inferred0"><a name="line26"></a>26 +</span><span class="marked1"><a name="line27"></a>27 attr_accessor :attribute, :recipe_list +</span><span class="inferred0"><a name="line28"></a>28 +</span><span class="marked1"><a name="line29"></a>29 include Chef::Mixin::CheckHelper +</span><span class="marked0"><a name="line30"></a>30 include Chef::Mixin::FromFile +</span><span class="inferred1"><a name="line31"></a>31 +</span><span class="marked0"><a name="line32"></a>32 def initialize() +</span><span class="marked1"><a name="line33"></a>33 @name = nil +</span><span class="marked0"><a name="line34"></a>34 @attribute = Hash.new +</span><span class="marked1"><a name="line35"></a>35 @recipe_list = Array.new +</span><span class="inferred0"><a name="line36"></a>36 end +</span><span class="inferred1"><a name="line37"></a>37 +</span><span class="marked0"><a name="line38"></a>38 def name(arg=nil) +</span><span class="marked1"><a name="line39"></a>39 set_if_args(@name, arg) do |a| +</span><span class="marked0"><a name="line40"></a>40 case a +</span><span class="marked1"><a name="line41"></a>41 when String +</span><span class="marked0"><a name="line42"></a>42 @name = a +</span><span class="inferred1"><a name="line43"></a>43 else +</span><span class="marked0"><a name="line44"></a>44 raise ArgumentError, "The nodes name must be a string" +</span><span class="inferred1"><a name="line45"></a>45 end +</span><span class="inferred0"><a name="line46"></a>46 end +</span><span class="marked1"><a name="line47"></a>47 end +</span><span class="inferred0"><a name="line48"></a>48 +</span><span class="marked1"><a name="line49"></a>49 def [](attrib) +</span><span class="marked0"><a name="line50"></a>50 if @attribute.has_key?(attrib) +</span><span class="marked1"><a name="line51"></a>51 @attribute[attrib] +</span><span class="marked0"><a name="line52"></a>52 elsif @attribute.has_key?(attrib.to_s) +</span><span class="marked1"><a name="line53"></a>53 @attribute[attrib.to_s] +</span><span class="inferred0"><a name="line54"></a>54 else +</span><span class="marked1"><a name="line55"></a>55 nil +</span><span class="inferred0"><a name="line56"></a>56 end +</span><span class="marked1"><a name="line57"></a>57 end +</span><span class="inferred0"><a name="line58"></a>58 +</span><span class="marked1"><a name="line59"></a>59 def attribute?(attrib) +</span><span class="marked0"><a name="line60"></a>60 result = false +</span><span class="marked1"><a name="line61"></a>61 result = @attribute.has_key?(attrib) +</span><span class="marked0"><a name="line62"></a>62 return result if result +</span><span class="marked1"><a name="line63"></a>63 return @attribute.has_key?(attrib.to_sym) +</span><span class="inferred0"><a name="line64"></a>64 end +</span><span class="inferred1"><a name="line65"></a>65 +</span><span class="marked0"><a name="line66"></a>66 def recipe?(recipe_name) +</span><span class="marked1"><a name="line67"></a>67 @recipe_list.detect { |r| r == recipe_name } ? true : false +</span><span class="marked0"><a name="line68"></a>68 end +</span><span class="inferred1"><a name="line69"></a>69 +</span><span class="marked0"><a name="line70"></a>70 def recipes(*args) +</span><span class="marked1"><a name="line71"></a>71 if args.length > 0 +</span><span class="marked0"><a name="line72"></a>72 @recipe_list = args.flatten +</span><span class="inferred1"><a name="line73"></a>73 else +</span><span class="marked0"><a name="line74"></a>74 @recipe_list +</span><span class="inferred1"><a name="line75"></a>75 end +</span><span class="marked0"><a name="line76"></a>76 end +</span><span class="inferred1"><a name="line77"></a>77 +</span><span class="marked0"><a name="line78"></a>78 def method_missing(symbol, *args) +</span><span class="marked1"><a name="line79"></a>79 if args.length != 0 +</span><span class="marked0"><a name="line80"></a>80 @attribute[symbol] = args.length == 1 ? args[0] : args +</span><span class="inferred1"><a name="line81"></a>81 else +</span><span class="marked0"><a name="line82"></a>82 if self[symbol] +</span><span class="marked1"><a name="line83"></a>83 @attribute[symbol] +</span><span class="inferred0"><a name="line84"></a>84 else +</span><span class="marked1"><a name="line85"></a>85 raise ArgumentError, "Attribute #{symbol.to_s} is not defined!" +</span><span class="inferred0"><a name="line86"></a>86 end +</span><span class="inferred1"><a name="line87"></a>87 end +</span><span class="marked0"><a name="line88"></a>88 end +</span><span class="inferred1"><a name="line89"></a>89 +</span><span class="inferred0"><a name="line90"></a>90 end +</span><span class="inferred1"><a name="line91"></a>91 end +</span></pre><hr/> + <p>Generated using the <a href='http://eigenclass.org/hiki.rb?rcov'>rcov code coverage analysis tool for Ruby</a> + version 0.8.1.2.</p> +<p><a href='http://validator.w3.org/check/referer'><img src='http://www.w3.org/Icons/valid-xhtml10' height='31' alt='Valid XHTML 1.0!' width='88'/> + </a> + <a href='http://jigsaw.w3.org/css-validator/check/referer'><img src='http://jigsaw.w3.org/css-validator/images/vcss' alt='Valid CSS!' style='border:0;width:88px;height:31px'/> + </a> + </p> + </body> + </html> diff --git a/coverage/lib-chef-recipe_rb.html b/coverage/lib-chef-recipe_rb.html new file mode 100644 index 0000000000..37cbaff636 --- /dev/null +++ b/coverage/lib-chef-recipe_rb.html @@ -0,0 +1,706 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html lang='en' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'><head><title>lib/chef/recipe.rb - C0 code coverage information</title> + <style type='text/css'>body { background-color: rgb(240, 240, 245); }</style> + <style type='text/css'>span.cross-ref-title { + font-size: 140%; +} +span.cross-ref a { + text-decoration: none; +} +span.cross-ref { + background-color:#f3f7fa; + border: 1px dashed #333; + margin: 1em; + padding: 0.5em; + overflow: hidden; +} +a.crossref-toggle { + text-decoration: none; +} +span.marked0 { + background-color: rgb(185, 210, 200); + display: block; +} +span.marked1 { + background-color: rgb(190, 215, 205); + display: block; +} +span.inferred0 { + background-color: rgb(175, 200, 200); + display: block; +} +span.inferred1 { + background-color: rgb(180, 205, 205); + display: block; +} +span.uncovered0 { + background-color: rgb(225, 110, 110); + display: block; +} +span.uncovered1 { + background-color: rgb(235, 120, 120); + display: block; +} +span.overview { + border-bottom: 8px solid black; +} +div.overview { + border-bottom: 8px solid black; +} +body { + font-family: verdana, arial, helvetica; +} +div.footer { + font-size: 68%; + margin-top: 1.5em; +} +h1, h2, h3, h4, h5, h6 { + margin-bottom: 0.5em; +} +h5 { + margin-top: 0.5em; +} +.hidden { + display: none; +} +div.separator { + height: 10px; +} +/* Commented out for better readability, esp. on IE */ +/* +table tr td, table tr th { + font-size: 68%; +} +td.value table tr td { + font-size: 11px; +} +*/ +table.percent_graph { + height: 12px; + border: #808080 1px solid; + empty-cells: show; +} +table.percent_graph td.covered { + height: 10px; + background: #00f000; +} +table.percent_graph td.uncovered { + height: 10px; + background: #e00000; +} +table.percent_graph td.NA { + height: 10px; + background: #eaeaea; +} +table.report { + border-collapse: collapse; + width: 100%; +} +table.report td.heading { + background: #dcecff; + border: #d0d0d0 1px solid; + font-weight: bold; + text-align: center; +} +table.report td.heading:hover { + background: #c0ffc0; +} +table.report td.text { + border: #d0d0d0 1px solid; +} +table.report td.value, +table.report td.lines_total, +table.report td.lines_code { + text-align: right; + border: #d0d0d0 1px solid; +} +table.report tr.light { + background-color: rgb(240, 240, 245); +} +table.report tr.dark { + background-color: rgb(230, 230, 235); +} +</style> + <script type='text/javascript'> +// <![CDATA[ + function toggleCode( id ) { + if ( document.getElementById ) + elem = document.getElementById( id ); + else if ( document.all ) + elem = eval( "document.all." + id ); + else + return false; + + elemStyle = elem.style; + + if ( elemStyle.display != "block" ) { + elemStyle.display = "block" + } else { + elemStyle.display = "none" + } + + return true; + } + + // Make cross-references hidden by default + document.writeln( "<style type=\"text/css\">span.cross-ref { display: none }</style>" ) + // ]]> +</script> + <style type='text/css'>span.run0 { + background-color: rgb(178, 204, 255); + display: block; +} +span.run1 { + background-color: rgb(178, 206, 255); + display: block; +} +span.run2 { + background-color: rgb(178, 209, 255); + display: block; +} +span.run3 { + background-color: rgb(178, 211, 255); + display: block; +} +span.run4 { + background-color: rgb(178, 214, 255); + display: block; +} +span.run5 { + background-color: rgb(178, 218, 255); + display: block; +} +span.run6 { + background-color: rgb(178, 220, 255); + display: block; +} +span.run7 { + background-color: rgb(178, 223, 255); + display: block; +} +span.run8 { + background-color: rgb(178, 225, 255); + display: block; +} +span.run9 { + background-color: rgb(178, 228, 255); + display: block; +} +span.run10 { + background-color: rgb(178, 232, 255); + display: block; +} +span.run11 { + background-color: rgb(178, 234, 255); + display: block; +} +span.run12 { + background-color: rgb(178, 237, 255); + display: block; +} +span.run13 { + background-color: rgb(178, 239, 255); + display: block; +} +span.run14 { + background-color: rgb(178, 242, 255); + display: block; +} +span.run15 { + background-color: rgb(178, 246, 255); + display: block; +} +span.run16 { + background-color: rgb(178, 248, 255); + display: block; +} +span.run17 { + background-color: rgb(178, 251, 255); + display: block; +} +span.run18 { + background-color: rgb(178, 253, 255); + display: block; +} +span.run19 { + background-color: rgb(178, 255, 253); + display: block; +} +span.run20 { + background-color: rgb(178, 255, 249); + display: block; +} +span.run21 { + background-color: rgb(178, 255, 247); + display: block; +} +span.run22 { + background-color: rgb(178, 255, 244); + display: block; +} +span.run23 { + background-color: rgb(178, 255, 242); + display: block; +} +span.run24 { + background-color: rgb(178, 255, 239); + display: block; +} +span.run25 { + background-color: rgb(178, 255, 235); + display: block; +} +span.run26 { + background-color: rgb(178, 255, 233); + display: block; +} +span.run27 { + background-color: rgb(178, 255, 230); + display: block; +} +span.run28 { + background-color: rgb(178, 255, 228); + display: block; +} +span.run29 { + background-color: rgb(178, 255, 225); + display: block; +} +span.run30 { + background-color: rgb(178, 255, 221); + display: block; +} +span.run31 { + background-color: rgb(178, 255, 219); + display: block; +} +span.run32 { + background-color: rgb(178, 255, 216); + display: block; +} +span.run33 { + background-color: rgb(178, 255, 214); + display: block; +} +span.run34 { + background-color: rgb(178, 255, 211); + display: block; +} +span.run35 { + background-color: rgb(178, 255, 207); + display: block; +} +span.run36 { + background-color: rgb(178, 255, 205); + display: block; +} +span.run37 { + background-color: rgb(178, 255, 202); + display: block; +} +span.run38 { + background-color: rgb(178, 255, 200); + display: block; +} +span.run39 { + background-color: rgb(178, 255, 197); + display: block; +} +span.run40 { + background-color: rgb(178, 255, 193); + display: block; +} +span.run41 { + background-color: rgb(178, 255, 191); + display: block; +} +span.run42 { + background-color: rgb(178, 255, 188); + display: block; +} +span.run43 { + background-color: rgb(178, 255, 186); + display: block; +} +span.run44 { + background-color: rgb(178, 255, 183); + display: block; +} +span.run45 { + background-color: rgb(178, 255, 179); + display: block; +} +span.run46 { + background-color: rgb(179, 255, 178); + display: block; +} +span.run47 { + background-color: rgb(182, 255, 178); + display: block; +} +span.run48 { + background-color: rgb(184, 255, 178); + display: block; +} +span.run49 { + background-color: rgb(187, 255, 178); + display: block; +} +span.run50 { + background-color: rgb(191, 255, 178); + display: block; +} +span.run51 { + background-color: rgb(193, 255, 178); + display: block; +} +span.run52 { + background-color: rgb(196, 255, 178); + display: block; +} +span.run53 { + background-color: rgb(198, 255, 178); + display: block; +} +span.run54 { + background-color: rgb(201, 255, 178); + display: block; +} +span.run55 { + background-color: rgb(205, 255, 178); + display: block; +} +span.run56 { + background-color: rgb(207, 255, 178); + display: block; +} +span.run57 { + background-color: rgb(210, 255, 178); + display: block; +} +span.run58 { + background-color: rgb(212, 255, 178); + display: block; +} +span.run59 { + background-color: rgb(215, 255, 178); + display: block; +} +span.run60 { + background-color: rgb(219, 255, 178); + display: block; +} +span.run61 { + background-color: rgb(221, 255, 178); + display: block; +} +span.run62 { + background-color: rgb(224, 255, 178); + display: block; +} +span.run63 { + background-color: rgb(226, 255, 178); + display: block; +} +span.run64 { + background-color: rgb(229, 255, 178); + display: block; +} +span.run65 { + background-color: rgb(233, 255, 178); + display: block; +} +span.run66 { + background-color: rgb(235, 255, 178); + display: block; +} +span.run67 { + background-color: rgb(238, 255, 178); + display: block; +} +span.run68 { + background-color: rgb(240, 255, 178); + display: block; +} +span.run69 { + background-color: rgb(243, 255, 178); + display: block; +} +span.run70 { + background-color: rgb(247, 255, 178); + display: block; +} +span.run71 { + background-color: rgb(249, 255, 178); + display: block; +} +span.run72 { + background-color: rgb(252, 255, 178); + display: block; +} +span.run73 { + background-color: rgb(255, 255, 178); + display: block; +} +span.run74 { + background-color: rgb(255, 252, 178); + display: block; +} +span.run75 { + background-color: rgb(255, 248, 178); + display: block; +} +span.run76 { + background-color: rgb(255, 246, 178); + display: block; +} +span.run77 { + background-color: rgb(255, 243, 178); + display: block; +} +span.run78 { + background-color: rgb(255, 240, 178); + display: block; +} +span.run79 { + background-color: rgb(255, 238, 178); + display: block; +} +span.run80 { + background-color: rgb(255, 234, 178); + display: block; +} +span.run81 { + background-color: rgb(255, 232, 178); + display: block; +} +span.run82 { + background-color: rgb(255, 229, 178); + display: block; +} +span.run83 { + background-color: rgb(255, 226, 178); + display: block; +} +span.run84 { + background-color: rgb(255, 224, 178); + display: block; +} +span.run85 { + background-color: rgb(255, 220, 178); + display: block; +} +span.run86 { + background-color: rgb(255, 218, 178); + display: block; +} +span.run87 { + background-color: rgb(255, 215, 178); + display: block; +} +span.run88 { + background-color: rgb(255, 212, 178); + display: block; +} +span.run89 { + background-color: rgb(255, 210, 178); + display: block; +} +span.run90 { + background-color: rgb(255, 206, 178); + display: block; +} +span.run91 { + background-color: rgb(255, 204, 178); + display: block; +} +span.run92 { + background-color: rgb(255, 201, 178); + display: block; +} +span.run93 { + background-color: rgb(255, 198, 178); + display: block; +} +span.run94 { + background-color: rgb(255, 196, 178); + display: block; +} +span.run95 { + background-color: rgb(255, 192, 178); + display: block; +} +span.run96 { + background-color: rgb(255, 189, 178); + display: block; +} +span.run97 { + background-color: rgb(255, 187, 178); + display: block; +} +span.run98 { + background-color: rgb(255, 184, 178); + display: block; +} +span.run99 { + background-color: rgb(255, 182, 178); + display: block; +} +span.run100 { + background-color: rgb(255, 178, 178); + display: block; +} +</style> + </head> + <body><h3>C0 code coverage information</h3> + <p>Generated on Mon Mar 10 00:31:54 -0700 2008 with <a href='http://eigenclass.org/hiki/rcov'>rcov 0.8.1.2</a> + </p> + <hr/> + <pre><span class='marked0'>Code reported as executed by Ruby looks like this... +</span><span class='marked1'>and this: this line is also marked as covered. +</span><span class='inferred0'>Lines considered as run by rcov, but not reported by Ruby, look like this, +</span><span class='inferred1'>and this: these lines were inferred by rcov (using simple heuristics). +</span><span class='uncovered0'>Finally, here's a line marked as not executed. +</span></pre> +<table class='report'><thead><tr><td class='heading'>Name</td> + <td class='heading'>Total lines</td> + <td class='heading'>Lines of code</td> + <td class='heading'>Total coverage</td> + <td class='heading'>Code coverage</td> + </tr> + </thead> + <tbody><tr class='light'><td><a href='lib-chef-recipe_rb.html'>lib/chef/recipe.rb</a> + </td> + <td class='lines_total'><tt>96</tt> + </td> + <td class='lines_code'><tt>66</tt> + </td> + <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_total'>100.0%</tt> + </td> + <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='100'/> + <td class='uncovered' width='0'/> + </tr> + </table> + </td> + </tr> + </table> + </td> + <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_code'>100.0%</tt> + </td> + <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='100'/> + <td class='uncovered' width='0'/> + </tr> + </table> + </td> + </tr> + </table> + </td> + </tr> + </tbody> + </table> +<pre><span class="inferred0"><a name="line1"></a> 1 # +</span><span class="inferred1"><a name="line2"></a> 2 # Author:: Adam Jacob (<adam@hjksolutions.com>) +</span><span class="inferred0"><a name="line3"></a> 3 # Copyright:: Copyright (c) 2008 HJK Solutions, LLC +</span><span class="inferred1"><a name="line4"></a> 4 # License:: GNU General Public License version 2 or later +</span><span class="inferred0"><a name="line5"></a> 5 # +</span><span class="inferred1"><a name="line6"></a> 6 # This program and entire repository is free software; you can +</span><span class="inferred0"><a name="line7"></a> 7 # redistribute it and/or modify it under the terms of the GNU +</span><span class="inferred1"><a name="line8"></a> 8 # General Public License as published by the Free Software +</span><span class="inferred0"><a name="line9"></a> 9 # Foundation; either version 2 of the License, or any later version. +</span><span class="inferred1"><a name="line10"></a>10 # +</span><span class="inferred0"><a name="line11"></a>11 # This program is distributed in the hope that it will be useful, +</span><span class="inferred1"><a name="line12"></a>12 # but WITHOUT ANY WARRANTY; without even the implied warranty of +</span><span class="inferred0"><a name="line13"></a>13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +</span><span class="inferred1"><a name="line14"></a>14 # GNU General Public License for more details. +</span><span class="inferred0"><a name="line15"></a>15 # +</span><span class="inferred1"><a name="line16"></a>16 # You should have received a copy of the GNU General Public License +</span><span class="inferred0"><a name="line17"></a>17 # along with this program; if not, write to the Free Software +</span><span class="inferred1"><a name="line18"></a>18 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +</span><span class="inferred0"><a name="line19"></a>19 # +</span><span class="inferred1"><a name="line20"></a>20 +</span><span class="marked0"><a name="line21"></a>21 require File.join(File.dirname(__FILE__), "mixin", "from_file") +</span><span class="inferred1"><a name="line22"></a>22 +</span><span class="marked0"><a name="line23"></a>23 class Chef +</span><span class="marked1"><a name="line24"></a>24 class Recipe +</span><span class="inferred0"><a name="line25"></a>25 +</span><span class="marked1"><a name="line26"></a>26 include Chef::Mixin::FromFile +</span><span class="inferred0"><a name="line27"></a>27 +</span><span class="marked1"><a name="line28"></a>28 attr_accessor :module_name, :recipe_name, :recipe, :node, :collection, +</span><span class="inferred0"><a name="line29"></a>29 :definitions, :config, :params +</span><span class="inferred1"><a name="line30"></a>30 +</span><span class="marked0"><a name="line31"></a>31 def initialize(module_name, recipe_name, node, collection=nil, definitions=nil, config=nil) +</span><span class="marked1"><a name="line32"></a>32 @module_name = module_name +</span><span class="marked0"><a name="line33"></a>33 @recipe_name = recipe_name +</span><span class="marked1"><a name="line34"></a>34 @node = node +</span><span class="marked0"><a name="line35"></a>35 if collection +</span><span class="marked1"><a name="line36"></a>36 @collection = collection +</span><span class="inferred0"><a name="line37"></a>37 else +</span><span class="marked1"><a name="line38"></a>38 @collection = Chef::ResourceCollection.new() +</span><span class="inferred0"><a name="line39"></a>39 end +</span><span class="marked1"><a name="line40"></a>40 if config +</span><span class="marked0"><a name="line41"></a>41 @config = config +</span><span class="inferred1"><a name="line42"></a>42 else +</span><span class="marked0"><a name="line43"></a>43 @config = Chef::Config.new() +</span><span class="inferred1"><a name="line44"></a>44 end +</span><span class="marked0"><a name="line45"></a>45 if definitions +</span><span class="marked1"><a name="line46"></a>46 @definitions = definitions +</span><span class="inferred0"><a name="line47"></a>47 else +</span><span class="marked1"><a name="line48"></a>48 @definitions = Hash.new +</span><span class="inferred0"><a name="line49"></a>49 end +</span><span class="marked1"><a name="line50"></a>50 @params = Hash.new +</span><span class="inferred0"><a name="line51"></a>51 end +</span><span class="inferred1"><a name="line52"></a>52 +</span><span class="marked0"><a name="line53"></a>53 def resources(*args) +</span><span class="marked1"><a name="line54"></a>54 @collection.resources(*args) +</span><span class="marked0"><a name="line55"></a>55 end +</span><span class="inferred1"><a name="line56"></a>56 +</span><span class="marked0"><a name="line57"></a>57 def method_missing(method_symbol, *args, &block) +</span><span class="marked1"><a name="line58"></a>58 resource = nil +</span><span class="inferred0"><a name="line59"></a>59 # If we have a definition that matches, we want to use that instead. This should +</span><span class="inferred1"><a name="line60"></a>60 # let you do some really crazy over-riding of "native" types, if you really want +</span><span class="inferred0"><a name="line61"></a>61 # to. +</span><span class="marked1"><a name="line62"></a>62 if @definitions.has_key?(method_symbol) +</span><span class="marked0"><a name="line63"></a>63 new_def = @definitions[method_symbol].dup +</span><span class="marked1"><a name="line64"></a>64 new_def.instance_eval(&block) +</span><span class="marked0"><a name="line65"></a>65 new_recipe = Chef::Recipe.new(@module_name, @recipe_name, @node, @collection, @definitions, @config) +</span><span class="marked1"><a name="line66"></a>66 new_recipe.params = new_def.params +</span><span class="marked0"><a name="line67"></a>67 new_recipe.instance_eval(&new_def.recipe) +</span><span class="inferred1"><a name="line68"></a>68 else +</span><span class="marked0"><a name="line69"></a>69 method_name = method_symbol.to_s +</span><span class="inferred1"><a name="line70"></a>70 # Otherwise, we're rocking the regular resource call route. +</span><span class="marked0"><a name="line71"></a>71 rname = nil +</span><span class="marked1"><a name="line72"></a>72 case method_name +</span><span class="marked0"><a name="line73"></a>73 when /^(.+)_(.+)$/ +</span><span class="marked1"><a name="line74"></a>74 rname = "Chef::Resource::#{$1.capitalize}#{$2.capitalize}" +</span><span class="marked0"><a name="line75"></a>75 when /^(.+)$/ +</span><span class="marked1"><a name="line76"></a>76 rname = "Chef::Resource::#{$1.capitalize}" +</span><span class="inferred0"><a name="line77"></a>77 end +</span><span class="marked1"><a name="line78"></a>78 begin +</span><span class="marked0"><a name="line79"></a>79 args << @collection +</span><span class="marked1"><a name="line80"></a>80 args << @config +</span><span class="marked0"><a name="line81"></a>81 resource = eval(rname).new(*args) +</span><span class="marked1"><a name="line82"></a>82 resource.params = @params +</span><span class="marked0"><a name="line83"></a>83 resource.instance_eval(&block) +</span><span class="inferred1"><a name="line84"></a>84 rescue Exception => e +</span><span class="marked0"><a name="line85"></a>85 if e.kind_of?(NameError) && e.to_s =~ /Chef::Resource/ +</span><span class="marked1"><a name="line86"></a>86 raise NameError, "Cannot find #{rname} for #{method_name}\nOriginal: #{e.to_s}" +</span><span class="inferred0"><a name="line87"></a>87 else +</span><span class="marked1"><a name="line88"></a>88 raise e +</span><span class="inferred0"><a name="line89"></a>89 end +</span><span class="inferred1"><a name="line90"></a>90 end +</span><span class="marked0"><a name="line91"></a>91 @collection << resource +</span><span class="marked1"><a name="line92"></a>92 resource +</span><span class="inferred0"><a name="line93"></a>93 end +</span><span class="inferred1"><a name="line94"></a>94 end +</span><span class="inferred0"><a name="line95"></a>95 end +</span><span class="inferred1"><a name="line96"></a>96 end +</span></pre><hr/> + <p>Generated using the <a href='http://eigenclass.org/hiki.rb?rcov'>rcov code coverage analysis tool for Ruby</a> + version 0.8.1.2.</p> +<p><a href='http://validator.w3.org/check/referer'><img src='http://www.w3.org/Icons/valid-xhtml10' height='31' alt='Valid XHTML 1.0!' width='88'/> + </a> + <a href='http://jigsaw.w3.org/css-validator/check/referer'><img src='http://jigsaw.w3.org/css-validator/images/vcss' alt='Valid CSS!' style='border:0;width:88px;height:31px'/> + </a> + </p> + </body> + </html> diff --git a/coverage/lib-chef-resource-file_rb.html b/coverage/lib-chef-resource-file_rb.html new file mode 100644 index 0000000000..168f017279 --- /dev/null +++ b/coverage/lib-chef-resource-file_rb.html @@ -0,0 +1,723 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html lang='en' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'><head><title>lib/chef/resource/file.rb - C0 code coverage information</title> + <style type='text/css'>body { background-color: rgb(240, 240, 245); }</style> + <style type='text/css'>span.cross-ref-title { + font-size: 140%; +} +span.cross-ref a { + text-decoration: none; +} +span.cross-ref { + background-color:#f3f7fa; + border: 1px dashed #333; + margin: 1em; + padding: 0.5em; + overflow: hidden; +} +a.crossref-toggle { + text-decoration: none; +} +span.marked0 { + background-color: rgb(185, 210, 200); + display: block; +} +span.marked1 { + background-color: rgb(190, 215, 205); + display: block; +} +span.inferred0 { + background-color: rgb(175, 200, 200); + display: block; +} +span.inferred1 { + background-color: rgb(180, 205, 205); + display: block; +} +span.uncovered0 { + background-color: rgb(225, 110, 110); + display: block; +} +span.uncovered1 { + background-color: rgb(235, 120, 120); + display: block; +} +span.overview { + border-bottom: 8px solid black; +} +div.overview { + border-bottom: 8px solid black; +} +body { + font-family: verdana, arial, helvetica; +} +div.footer { + font-size: 68%; + margin-top: 1.5em; +} +h1, h2, h3, h4, h5, h6 { + margin-bottom: 0.5em; +} +h5 { + margin-top: 0.5em; +} +.hidden { + display: none; +} +div.separator { + height: 10px; +} +/* Commented out for better readability, esp. on IE */ +/* +table tr td, table tr th { + font-size: 68%; +} +td.value table tr td { + font-size: 11px; +} +*/ +table.percent_graph { + height: 12px; + border: #808080 1px solid; + empty-cells: show; +} +table.percent_graph td.covered { + height: 10px; + background: #00f000; +} +table.percent_graph td.uncovered { + height: 10px; + background: #e00000; +} +table.percent_graph td.NA { + height: 10px; + background: #eaeaea; +} +table.report { + border-collapse: collapse; + width: 100%; +} +table.report td.heading { + background: #dcecff; + border: #d0d0d0 1px solid; + font-weight: bold; + text-align: center; +} +table.report td.heading:hover { + background: #c0ffc0; +} +table.report td.text { + border: #d0d0d0 1px solid; +} +table.report td.value, +table.report td.lines_total, +table.report td.lines_code { + text-align: right; + border: #d0d0d0 1px solid; +} +table.report tr.light { + background-color: rgb(240, 240, 245); +} +table.report tr.dark { + background-color: rgb(230, 230, 235); +} +</style> + <script type='text/javascript'> +// <![CDATA[ + function toggleCode( id ) { + if ( document.getElementById ) + elem = document.getElementById( id ); + else if ( document.all ) + elem = eval( "document.all." + id ); + else + return false; + + elemStyle = elem.style; + + if ( elemStyle.display != "block" ) { + elemStyle.display = "block" + } else { + elemStyle.display = "none" + } + + return true; + } + + // Make cross-references hidden by default + document.writeln( "<style type=\"text/css\">span.cross-ref { display: none }</style>" ) + // ]]> +</script> + <style type='text/css'>span.run0 { + background-color: rgb(178, 204, 255); + display: block; +} +span.run1 { + background-color: rgb(178, 206, 255); + display: block; +} +span.run2 { + background-color: rgb(178, 209, 255); + display: block; +} +span.run3 { + background-color: rgb(178, 211, 255); + display: block; +} +span.run4 { + background-color: rgb(178, 214, 255); + display: block; +} +span.run5 { + background-color: rgb(178, 218, 255); + display: block; +} +span.run6 { + background-color: rgb(178, 220, 255); + display: block; +} +span.run7 { + background-color: rgb(178, 223, 255); + display: block; +} +span.run8 { + background-color: rgb(178, 225, 255); + display: block; +} +span.run9 { + background-color: rgb(178, 228, 255); + display: block; +} +span.run10 { + background-color: rgb(178, 232, 255); + display: block; +} +span.run11 { + background-color: rgb(178, 234, 255); + display: block; +} +span.run12 { + background-color: rgb(178, 237, 255); + display: block; +} +span.run13 { + background-color: rgb(178, 239, 255); + display: block; +} +span.run14 { + background-color: rgb(178, 242, 255); + display: block; +} +span.run15 { + background-color: rgb(178, 246, 255); + display: block; +} +span.run16 { + background-color: rgb(178, 248, 255); + display: block; +} +span.run17 { + background-color: rgb(178, 251, 255); + display: block; +} +span.run18 { + background-color: rgb(178, 253, 255); + display: block; +} +span.run19 { + background-color: rgb(178, 255, 253); + display: block; +} +span.run20 { + background-color: rgb(178, 255, 249); + display: block; +} +span.run21 { + background-color: rgb(178, 255, 247); + display: block; +} +span.run22 { + background-color: rgb(178, 255, 244); + display: block; +} +span.run23 { + background-color: rgb(178, 255, 242); + display: block; +} +span.run24 { + background-color: rgb(178, 255, 239); + display: block; +} +span.run25 { + background-color: rgb(178, 255, 235); + display: block; +} +span.run26 { + background-color: rgb(178, 255, 233); + display: block; +} +span.run27 { + background-color: rgb(178, 255, 230); + display: block; +} +span.run28 { + background-color: rgb(178, 255, 228); + display: block; +} +span.run29 { + background-color: rgb(178, 255, 225); + display: block; +} +span.run30 { + background-color: rgb(178, 255, 221); + display: block; +} +span.run31 { + background-color: rgb(178, 255, 219); + display: block; +} +span.run32 { + background-color: rgb(178, 255, 216); + display: block; +} +span.run33 { + background-color: rgb(178, 255, 214); + display: block; +} +span.run34 { + background-color: rgb(178, 255, 211); + display: block; +} +span.run35 { + background-color: rgb(178, 255, 207); + display: block; +} +span.run36 { + background-color: rgb(178, 255, 205); + display: block; +} +span.run37 { + background-color: rgb(178, 255, 202); + display: block; +} +span.run38 { + background-color: rgb(178, 255, 200); + display: block; +} +span.run39 { + background-color: rgb(178, 255, 197); + display: block; +} +span.run40 { + background-color: rgb(178, 255, 193); + display: block; +} +span.run41 { + background-color: rgb(178, 255, 191); + display: block; +} +span.run42 { + background-color: rgb(178, 255, 188); + display: block; +} +span.run43 { + background-color: rgb(178, 255, 186); + display: block; +} +span.run44 { + background-color: rgb(178, 255, 183); + display: block; +} +span.run45 { + background-color: rgb(178, 255, 179); + display: block; +} +span.run46 { + background-color: rgb(179, 255, 178); + display: block; +} +span.run47 { + background-color: rgb(182, 255, 178); + display: block; +} +span.run48 { + background-color: rgb(184, 255, 178); + display: block; +} +span.run49 { + background-color: rgb(187, 255, 178); + display: block; +} +span.run50 { + background-color: rgb(191, 255, 178); + display: block; +} +span.run51 { + background-color: rgb(193, 255, 178); + display: block; +} +span.run52 { + background-color: rgb(196, 255, 178); + display: block; +} +span.run53 { + background-color: rgb(198, 255, 178); + display: block; +} +span.run54 { + background-color: rgb(201, 255, 178); + display: block; +} +span.run55 { + background-color: rgb(205, 255, 178); + display: block; +} +span.run56 { + background-color: rgb(207, 255, 178); + display: block; +} +span.run57 { + background-color: rgb(210, 255, 178); + display: block; +} +span.run58 { + background-color: rgb(212, 255, 178); + display: block; +} +span.run59 { + background-color: rgb(215, 255, 178); + display: block; +} +span.run60 { + background-color: rgb(219, 255, 178); + display: block; +} +span.run61 { + background-color: rgb(221, 255, 178); + display: block; +} +span.run62 { + background-color: rgb(224, 255, 178); + display: block; +} +span.run63 { + background-color: rgb(226, 255, 178); + display: block; +} +span.run64 { + background-color: rgb(229, 255, 178); + display: block; +} +span.run65 { + background-color: rgb(233, 255, 178); + display: block; +} +span.run66 { + background-color: rgb(235, 255, 178); + display: block; +} +span.run67 { + background-color: rgb(238, 255, 178); + display: block; +} +span.run68 { + background-color: rgb(240, 255, 178); + display: block; +} +span.run69 { + background-color: rgb(243, 255, 178); + display: block; +} +span.run70 { + background-color: rgb(247, 255, 178); + display: block; +} +span.run71 { + background-color: rgb(249, 255, 178); + display: block; +} +span.run72 { + background-color: rgb(252, 255, 178); + display: block; +} +span.run73 { + background-color: rgb(255, 255, 178); + display: block; +} +span.run74 { + background-color: rgb(255, 252, 178); + display: block; +} +span.run75 { + background-color: rgb(255, 248, 178); + display: block; +} +span.run76 { + background-color: rgb(255, 246, 178); + display: block; +} +span.run77 { + background-color: rgb(255, 243, 178); + display: block; +} +span.run78 { + background-color: rgb(255, 240, 178); + display: block; +} +span.run79 { + background-color: rgb(255, 238, 178); + display: block; +} +span.run80 { + background-color: rgb(255, 234, 178); + display: block; +} +span.run81 { + background-color: rgb(255, 232, 178); + display: block; +} +span.run82 { + background-color: rgb(255, 229, 178); + display: block; +} +span.run83 { + background-color: rgb(255, 226, 178); + display: block; +} +span.run84 { + background-color: rgb(255, 224, 178); + display: block; +} +span.run85 { + background-color: rgb(255, 220, 178); + display: block; +} +span.run86 { + background-color: rgb(255, 218, 178); + display: block; +} +span.run87 { + background-color: rgb(255, 215, 178); + display: block; +} +span.run88 { + background-color: rgb(255, 212, 178); + display: block; +} +span.run89 { + background-color: rgb(255, 210, 178); + display: block; +} +span.run90 { + background-color: rgb(255, 206, 178); + display: block; +} +span.run91 { + background-color: rgb(255, 204, 178); + display: block; +} +span.run92 { + background-color: rgb(255, 201, 178); + display: block; +} +span.run93 { + background-color: rgb(255, 198, 178); + display: block; +} +span.run94 { + background-color: rgb(255, 196, 178); + display: block; +} +span.run95 { + background-color: rgb(255, 192, 178); + display: block; +} +span.run96 { + background-color: rgb(255, 189, 178); + display: block; +} +span.run97 { + background-color: rgb(255, 187, 178); + display: block; +} +span.run98 { + background-color: rgb(255, 184, 178); + display: block; +} +span.run99 { + background-color: rgb(255, 182, 178); + display: block; +} +span.run100 { + background-color: rgb(255, 178, 178); + display: block; +} +</style> + </head> + <body><h3>C0 code coverage information</h3> + <p>Generated on Mon Mar 10 00:31:54 -0700 2008 with <a href='http://eigenclass.org/hiki/rcov'>rcov 0.8.1.2</a> + </p> + <hr/> + <pre><span class='marked0'>Code reported as executed by Ruby looks like this... +</span><span class='marked1'>and this: this line is also marked as covered. +</span><span class='inferred0'>Lines considered as run by rcov, but not reported by Ruby, look like this, +</span><span class='inferred1'>and this: these lines were inferred by rcov (using simple heuristics). +</span><span class='uncovered0'>Finally, here's a line marked as not executed. +</span></pre> +<table class='report'><thead><tr><td class='heading'>Name</td> + <td class='heading'>Total lines</td> + <td class='heading'>Lines of code</td> + <td class='heading'>Total coverage</td> + <td class='heading'>Code coverage</td> + </tr> + </thead> + <tbody><tr class='light'><td><a href='lib-chef-resource-file_rb.html'>lib/chef/resource/file.rb</a> + </td> + <td class='lines_total'><tt>113</tt> + </td> + <td class='lines_code'><tt>84</tt> + </td> + <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_total'>100.0%</tt> + </td> + <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='100'/> + <td class='uncovered' width='0'/> + </tr> + </table> + </td> + </tr> + </table> + </td> + <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_code'>100.0%</tt> + </td> + <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='100'/> + <td class='uncovered' width='0'/> + </tr> + </table> + </td> + </tr> + </table> + </td> + </tr> + </tbody> + </table> +<pre><span class="inferred1"><a name="line1"></a> 1 # +</span><span class="inferred0"><a name="line2"></a> 2 # Author:: Adam Jacob (<adam@hjksolutions.com>) +</span><span class="inferred1"><a name="line3"></a> 3 # Copyright:: Copyright (c) 2008 HJK Solutions, LLC +</span><span class="inferred0"><a name="line4"></a> 4 # License:: GNU General Public License version 2 or later +</span><span class="inferred1"><a name="line5"></a> 5 # +</span><span class="inferred0"><a name="line6"></a> 6 # This program and entire repository is free software; you can +</span><span class="inferred1"><a name="line7"></a> 7 # redistribute it and/or modify it under the terms of the GNU +</span><span class="inferred0"><a name="line8"></a> 8 # General Public License as published by the Free Software +</span><span class="inferred1"><a name="line9"></a> 9 # Foundation; either version 2 of the License, or any later version. +</span><span class="inferred0"><a name="line10"></a> 10 # +</span><span class="inferred1"><a name="line11"></a> 11 # This program is distributed in the hope that it will be useful, +</span><span class="inferred0"><a name="line12"></a> 12 # but WITHOUT ANY WARRANTY; without even the implied warranty of +</span><span class="inferred1"><a name="line13"></a> 13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +</span><span class="inferred0"><a name="line14"></a> 14 # GNU General Public License for more details. +</span><span class="inferred1"><a name="line15"></a> 15 # +</span><span class="inferred0"><a name="line16"></a> 16 # You should have received a copy of the GNU General Public License +</span><span class="inferred1"><a name="line17"></a> 17 # along with this program; if not, write to the Free Software +</span><span class="inferred0"><a name="line18"></a> 18 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +</span><span class="inferred1"><a name="line19"></a> 19 # +</span><span class="inferred0"><a name="line20"></a> 20 +</span><span class="marked1"><a name="line21"></a> 21 class Chef +</span><span class="marked0"><a name="line22"></a> 22 class Resource +</span><span class="marked1"><a name="line23"></a> 23 class File < Chef::Resource +</span><span class="marked0"><a name="line24"></a> 24 attr_reader :backup, :checksum, :insure, :group, :mode, :owner, :path +</span><span class="inferred1"><a name="line25"></a> 25 +</span><span class="marked0"><a name="line26"></a> 26 def initialize(name, collection=nil, config=nil) +</span><span class="marked1"><a name="line27"></a> 27 @resource_name = :file +</span><span class="marked0"><a name="line28"></a> 28 super(name, collection, config) +</span><span class="marked1"><a name="line29"></a> 29 @path = name +</span><span class="marked0"><a name="line30"></a> 30 @backup = true +</span><span class="marked1"><a name="line31"></a> 31 @checksum = "md5sum" +</span><span class="inferred0"><a name="line32"></a> 32 end +</span><span class="inferred1"><a name="line33"></a> 33 +</span><span class="marked0"><a name="line34"></a> 34 def backup(arg=nil) +</span><span class="marked1"><a name="line35"></a> 35 set_if_args(@backup, arg) do +</span><span class="marked0"><a name="line36"></a> 36 case arg +</span><span class="marked1"><a name="line37"></a> 37 when true, false, Integer +</span><span class="marked0"><a name="line38"></a> 38 @backup = arg +</span><span class="inferred1"><a name="line39"></a> 39 else +</span><span class="marked0"><a name="line40"></a> 40 raise ArgumentError, "backup must be true, false, or a number!" +</span><span class="inferred1"><a name="line41"></a> 41 end +</span><span class="inferred0"><a name="line42"></a> 42 end +</span><span class="marked1"><a name="line43"></a> 43 end +</span><span class="inferred0"><a name="line44"></a> 44 +</span><span class="marked1"><a name="line45"></a> 45 def checksum(arg=nil) +</span><span class="marked0"><a name="line46"></a> 46 set_if_args(@checksum, arg) do +</span><span class="marked1"><a name="line47"></a> 47 case arg +</span><span class="marked0"><a name="line48"></a> 48 when "md5sum", "mtime" +</span><span class="marked1"><a name="line49"></a> 49 @checksum = arg +</span><span class="inferred0"><a name="line50"></a> 50 else +</span><span class="marked1"><a name="line51"></a> 51 raise ArgumentError, "checksum must be md5sum or mtime!" +</span><span class="inferred0"><a name="line52"></a> 52 end +</span><span class="inferred1"><a name="line53"></a> 53 end +</span><span class="marked0"><a name="line54"></a> 54 end +</span><span class="inferred1"><a name="line55"></a> 55 +</span><span class="marked0"><a name="line56"></a> 56 def insure(arg=nil) +</span><span class="marked1"><a name="line57"></a> 57 set_if_args(@insure, arg) do +</span><span class="marked0"><a name="line58"></a> 58 case arg +</span><span class="marked1"><a name="line59"></a> 59 when "absent", "present" +</span><span class="marked0"><a name="line60"></a> 60 @insure = arg +</span><span class="inferred1"><a name="line61"></a> 61 else +</span><span class="marked0"><a name="line62"></a> 62 raise ArgumentError, "insure must be absent or present!" +</span><span class="inferred1"><a name="line63"></a> 63 end +</span><span class="inferred0"><a name="line64"></a> 64 end +</span><span class="marked1"><a name="line65"></a> 65 end +</span><span class="inferred0"><a name="line66"></a> 66 +</span><span class="marked1"><a name="line67"></a> 67 def group(arg=nil) +</span><span class="marked0"><a name="line68"></a> 68 set_if_args(@group, arg) do +</span><span class="marked1"><a name="line69"></a> 69 case arg +</span><span class="marked0"><a name="line70"></a> 70 when /^([a-z]|[A-Z]|[0-9]|_|-)+$/, Integer +</span><span class="marked1"><a name="line71"></a> 71 @group = arg +</span><span class="inferred0"><a name="line72"></a> 72 else +</span><span class="marked1"><a name="line73"></a> 73 raise ArgumentError, "group must match /^([a-z]|[A-Z]|[0-9]|_|-)$/, Integer!" +</span><span class="inferred0"><a name="line74"></a> 74 end +</span><span class="inferred1"><a name="line75"></a> 75 end +</span><span class="marked0"><a name="line76"></a> 76 end +</span><span class="inferred1"><a name="line77"></a> 77 +</span><span class="marked0"><a name="line78"></a> 78 def mode(arg=nil) +</span><span class="marked1"><a name="line79"></a> 79 set_if_args(@mode, arg) do +</span><span class="marked0"><a name="line80"></a> 80 case "#{arg.to_s}" +</span><span class="marked1"><a name="line81"></a> 81 when /^\d{3,4}$/ +</span><span class="marked0"><a name="line82"></a> 82 @mode = arg +</span><span class="inferred1"><a name="line83"></a> 83 else +</span><span class="marked0"><a name="line84"></a> 84 raise ArgumentError, "mode must be a valid unix file mode - 3 or 4 digets!" +</span><span class="inferred1"><a name="line85"></a> 85 end +</span><span class="inferred0"><a name="line86"></a> 86 end +</span><span class="marked1"><a name="line87"></a> 87 end +</span><span class="inferred0"><a name="line88"></a> 88 +</span><span class="marked1"><a name="line89"></a> 89 def owner(arg=nil) +</span><span class="marked0"><a name="line90"></a> 90 set_if_args(@owner, arg) do +</span><span class="marked1"><a name="line91"></a> 91 case arg +</span><span class="marked0"><a name="line92"></a> 92 when /^([a-z]|[A-Z]|[0-9]|_|-)+$/, Integer +</span><span class="marked1"><a name="line93"></a> 93 @owner = arg +</span><span class="inferred0"><a name="line94"></a> 94 else +</span><span class="marked1"><a name="line95"></a> 95 raise ArgumentError, "group must match /^([a-z]|[A-Z]|[0-9]|_|-)$/, Integer!" +</span><span class="inferred0"><a name="line96"></a> 96 end +</span><span class="inferred1"><a name="line97"></a> 97 end +</span><span class="marked0"><a name="line98"></a> 98 end +</span><span class="inferred1"><a name="line99"></a> 99 +</span><span class="marked0"><a name="line100"></a>100 def path(arg=nil) +</span><span class="marked1"><a name="line101"></a>101 set_if_args(@path, arg) do +</span><span class="marked0"><a name="line102"></a>102 case arg +</span><span class="marked1"><a name="line103"></a>103 when String +</span><span class="marked0"><a name="line104"></a>104 @path = arg +</span><span class="inferred1"><a name="line105"></a>105 else +</span><span class="marked0"><a name="line106"></a>106 raise ArgumentError, "path must be a string!" +</span><span class="inferred1"><a name="line107"></a>107 end +</span><span class="inferred0"><a name="line108"></a>108 end +</span><span class="marked1"><a name="line109"></a>109 end +</span><span class="inferred0"><a name="line110"></a>110 +</span><span class="inferred1"><a name="line111"></a>111 end +</span><span class="inferred0"><a name="line112"></a>112 end +</span><span class="inferred1"><a name="line113"></a>113 end +</span></pre><hr/> + <p>Generated using the <a href='http://eigenclass.org/hiki.rb?rcov'>rcov code coverage analysis tool for Ruby</a> + version 0.8.1.2.</p> +<p><a href='http://validator.w3.org/check/referer'><img src='http://www.w3.org/Icons/valid-xhtml10' height='31' alt='Valid XHTML 1.0!' width='88'/> + </a> + <a href='http://jigsaw.w3.org/css-validator/check/referer'><img src='http://jigsaw.w3.org/css-validator/images/vcss' alt='Valid CSS!' style='border:0;width:88px;height:31px'/> + </a> + </p> + </body> + </html> diff --git a/coverage/lib-chef-resource_collection_rb.html b/coverage/lib-chef-resource_collection_rb.html new file mode 100644 index 0000000000..ecc5c44f58 --- /dev/null +++ b/coverage/lib-chef-resource_collection_rb.html @@ -0,0 +1,765 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html lang='en' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'><head><title>lib/chef/resource_collection.rb - C0 code coverage information</title> + <style type='text/css'>body { background-color: rgb(240, 240, 245); }</style> + <style type='text/css'>span.cross-ref-title { + font-size: 140%; +} +span.cross-ref a { + text-decoration: none; +} +span.cross-ref { + background-color:#f3f7fa; + border: 1px dashed #333; + margin: 1em; + padding: 0.5em; + overflow: hidden; +} +a.crossref-toggle { + text-decoration: none; +} +span.marked0 { + background-color: rgb(185, 210, 200); + display: block; +} +span.marked1 { + background-color: rgb(190, 215, 205); + display: block; +} +span.inferred0 { + background-color: rgb(175, 200, 200); + display: block; +} +span.inferred1 { + background-color: rgb(180, 205, 205); + display: block; +} +span.uncovered0 { + background-color: rgb(225, 110, 110); + display: block; +} +span.uncovered1 { + background-color: rgb(235, 120, 120); + display: block; +} +span.overview { + border-bottom: 8px solid black; +} +div.overview { + border-bottom: 8px solid black; +} +body { + font-family: verdana, arial, helvetica; +} +div.footer { + font-size: 68%; + margin-top: 1.5em; +} +h1, h2, h3, h4, h5, h6 { + margin-bottom: 0.5em; +} +h5 { + margin-top: 0.5em; +} +.hidden { + display: none; +} +div.separator { + height: 10px; +} +/* Commented out for better readability, esp. on IE */ +/* +table tr td, table tr th { + font-size: 68%; +} +td.value table tr td { + font-size: 11px; +} +*/ +table.percent_graph { + height: 12px; + border: #808080 1px solid; + empty-cells: show; +} +table.percent_graph td.covered { + height: 10px; + background: #00f000; +} +table.percent_graph td.uncovered { + height: 10px; + background: #e00000; +} +table.percent_graph td.NA { + height: 10px; + background: #eaeaea; +} +table.report { + border-collapse: collapse; + width: 100%; +} +table.report td.heading { + background: #dcecff; + border: #d0d0d0 1px solid; + font-weight: bold; + text-align: center; +} +table.report td.heading:hover { + background: #c0ffc0; +} +table.report td.text { + border: #d0d0d0 1px solid; +} +table.report td.value, +table.report td.lines_total, +table.report td.lines_code { + text-align: right; + border: #d0d0d0 1px solid; +} +table.report tr.light { + background-color: rgb(240, 240, 245); +} +table.report tr.dark { + background-color: rgb(230, 230, 235); +} +</style> + <script type='text/javascript'> +// <![CDATA[ + function toggleCode( id ) { + if ( document.getElementById ) + elem = document.getElementById( id ); + else if ( document.all ) + elem = eval( "document.all." + id ); + else + return false; + + elemStyle = elem.style; + + if ( elemStyle.display != "block" ) { + elemStyle.display = "block" + } else { + elemStyle.display = "none" + } + + return true; + } + + // Make cross-references hidden by default + document.writeln( "<style type=\"text/css\">span.cross-ref { display: none }</style>" ) + // ]]> +</script> + <style type='text/css'>span.run0 { + background-color: rgb(178, 204, 255); + display: block; +} +span.run1 { + background-color: rgb(178, 206, 255); + display: block; +} +span.run2 { + background-color: rgb(178, 209, 255); + display: block; +} +span.run3 { + background-color: rgb(178, 211, 255); + display: block; +} +span.run4 { + background-color: rgb(178, 214, 255); + display: block; +} +span.run5 { + background-color: rgb(178, 218, 255); + display: block; +} +span.run6 { + background-color: rgb(178, 220, 255); + display: block; +} +span.run7 { + background-color: rgb(178, 223, 255); + display: block; +} +span.run8 { + background-color: rgb(178, 225, 255); + display: block; +} +span.run9 { + background-color: rgb(178, 228, 255); + display: block; +} +span.run10 { + background-color: rgb(178, 232, 255); + display: block; +} +span.run11 { + background-color: rgb(178, 234, 255); + display: block; +} +span.run12 { + background-color: rgb(178, 237, 255); + display: block; +} +span.run13 { + background-color: rgb(178, 239, 255); + display: block; +} +span.run14 { + background-color: rgb(178, 242, 255); + display: block; +} +span.run15 { + background-color: rgb(178, 246, 255); + display: block; +} +span.run16 { + background-color: rgb(178, 248, 255); + display: block; +} +span.run17 { + background-color: rgb(178, 251, 255); + display: block; +} +span.run18 { + background-color: rgb(178, 253, 255); + display: block; +} +span.run19 { + background-color: rgb(178, 255, 253); + display: block; +} +span.run20 { + background-color: rgb(178, 255, 249); + display: block; +} +span.run21 { + background-color: rgb(178, 255, 247); + display: block; +} +span.run22 { + background-color: rgb(178, 255, 244); + display: block; +} +span.run23 { + background-color: rgb(178, 255, 242); + display: block; +} +span.run24 { + background-color: rgb(178, 255, 239); + display: block; +} +span.run25 { + background-color: rgb(178, 255, 235); + display: block; +} +span.run26 { + background-color: rgb(178, 255, 233); + display: block; +} +span.run27 { + background-color: rgb(178, 255, 230); + display: block; +} +span.run28 { + background-color: rgb(178, 255, 228); + display: block; +} +span.run29 { + background-color: rgb(178, 255, 225); + display: block; +} +span.run30 { + background-color: rgb(178, 255, 221); + display: block; +} +span.run31 { + background-color: rgb(178, 255, 219); + display: block; +} +span.run32 { + background-color: rgb(178, 255, 216); + display: block; +} +span.run33 { + background-color: rgb(178, 255, 214); + display: block; +} +span.run34 { + background-color: rgb(178, 255, 211); + display: block; +} +span.run35 { + background-color: rgb(178, 255, 207); + display: block; +} +span.run36 { + background-color: rgb(178, 255, 205); + display: block; +} +span.run37 { + background-color: rgb(178, 255, 202); + display: block; +} +span.run38 { + background-color: rgb(178, 255, 200); + display: block; +} +span.run39 { + background-color: rgb(178, 255, 197); + display: block; +} +span.run40 { + background-color: rgb(178, 255, 193); + display: block; +} +span.run41 { + background-color: rgb(178, 255, 191); + display: block; +} +span.run42 { + background-color: rgb(178, 255, 188); + display: block; +} +span.run43 { + background-color: rgb(178, 255, 186); + display: block; +} +span.run44 { + background-color: rgb(178, 255, 183); + display: block; +} +span.run45 { + background-color: rgb(178, 255, 179); + display: block; +} +span.run46 { + background-color: rgb(179, 255, 178); + display: block; +} +span.run47 { + background-color: rgb(182, 255, 178); + display: block; +} +span.run48 { + background-color: rgb(184, 255, 178); + display: block; +} +span.run49 { + background-color: rgb(187, 255, 178); + display: block; +} +span.run50 { + background-color: rgb(191, 255, 178); + display: block; +} +span.run51 { + background-color: rgb(193, 255, 178); + display: block; +} +span.run52 { + background-color: rgb(196, 255, 178); + display: block; +} +span.run53 { + background-color: rgb(198, 255, 178); + display: block; +} +span.run54 { + background-color: rgb(201, 255, 178); + display: block; +} +span.run55 { + background-color: rgb(205, 255, 178); + display: block; +} +span.run56 { + background-color: rgb(207, 255, 178); + display: block; +} +span.run57 { + background-color: rgb(210, 255, 178); + display: block; +} +span.run58 { + background-color: rgb(212, 255, 178); + display: block; +} +span.run59 { + background-color: rgb(215, 255, 178); + display: block; +} +span.run60 { + background-color: rgb(219, 255, 178); + display: block; +} +span.run61 { + background-color: rgb(221, 255, 178); + display: block; +} +span.run62 { + background-color: rgb(224, 255, 178); + display: block; +} +span.run63 { + background-color: rgb(226, 255, 178); + display: block; +} +span.run64 { + background-color: rgb(229, 255, 178); + display: block; +} +span.run65 { + background-color: rgb(233, 255, 178); + display: block; +} +span.run66 { + background-color: rgb(235, 255, 178); + display: block; +} +span.run67 { + background-color: rgb(238, 255, 178); + display: block; +} +span.run68 { + background-color: rgb(240, 255, 178); + display: block; +} +span.run69 { + background-color: rgb(243, 255, 178); + display: block; +} +span.run70 { + background-color: rgb(247, 255, 178); + display: block; +} +span.run71 { + background-color: rgb(249, 255, 178); + display: block; +} +span.run72 { + background-color: rgb(252, 255, 178); + display: block; +} +span.run73 { + background-color: rgb(255, 255, 178); + display: block; +} +span.run74 { + background-color: rgb(255, 252, 178); + display: block; +} +span.run75 { + background-color: rgb(255, 248, 178); + display: block; +} +span.run76 { + background-color: rgb(255, 246, 178); + display: block; +} +span.run77 { + background-color: rgb(255, 243, 178); + display: block; +} +span.run78 { + background-color: rgb(255, 240, 178); + display: block; +} +span.run79 { + background-color: rgb(255, 238, 178); + display: block; +} +span.run80 { + background-color: rgb(255, 234, 178); + display: block; +} +span.run81 { + background-color: rgb(255, 232, 178); + display: block; +} +span.run82 { + background-color: rgb(255, 229, 178); + display: block; +} +span.run83 { + background-color: rgb(255, 226, 178); + display: block; +} +span.run84 { + background-color: rgb(255, 224, 178); + display: block; +} +span.run85 { + background-color: rgb(255, 220, 178); + display: block; +} +span.run86 { + background-color: rgb(255, 218, 178); + display: block; +} +span.run87 { + background-color: rgb(255, 215, 178); + display: block; +} +span.run88 { + background-color: rgb(255, 212, 178); + display: block; +} +span.run89 { + background-color: rgb(255, 210, 178); + display: block; +} +span.run90 { + background-color: rgb(255, 206, 178); + display: block; +} +span.run91 { + background-color: rgb(255, 204, 178); + display: block; +} +span.run92 { + background-color: rgb(255, 201, 178); + display: block; +} +span.run93 { + background-color: rgb(255, 198, 178); + display: block; +} +span.run94 { + background-color: rgb(255, 196, 178); + display: block; +} +span.run95 { + background-color: rgb(255, 192, 178); + display: block; +} +span.run96 { + background-color: rgb(255, 189, 178); + display: block; +} +span.run97 { + background-color: rgb(255, 187, 178); + display: block; +} +span.run98 { + background-color: rgb(255, 184, 178); + display: block; +} +span.run99 { + background-color: rgb(255, 182, 178); + display: block; +} +span.run100 { + background-color: rgb(255, 178, 178); + display: block; +} +</style> + </head> + <body><h3>C0 code coverage information</h3> + <p>Generated on Mon Mar 10 00:31:55 -0700 2008 with <a href='http://eigenclass.org/hiki/rcov'>rcov 0.8.1.2</a> + </p> + <hr/> + <pre><span class='marked0'>Code reported as executed by Ruby looks like this... +</span><span class='marked1'>and this: this line is also marked as covered. +</span><span class='inferred0'>Lines considered as run by rcov, but not reported by Ruby, look like this, +</span><span class='inferred1'>and this: these lines were inferred by rcov (using simple heuristics). +</span><span class='uncovered0'>Finally, here's a line marked as not executed. +</span></pre> +<table class='report'><thead><tr><td class='heading'>Name</td> + <td class='heading'>Total lines</td> + <td class='heading'>Lines of code</td> + <td class='heading'>Total coverage</td> + <td class='heading'>Code coverage</td> + </tr> + </thead> + <tbody><tr class='light'><td><a href='lib-chef-resource_collection_rb.html'>lib/chef/resource_collection.rb</a> + </td> + <td class='lines_total'><tt>155</tt> + </td> + <td class='lines_code'><tt>110</tt> + </td> + <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_total'>100.0%</tt> + </td> + <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='100'/> + <td class='uncovered' width='0'/> + </tr> + </table> + </td> + </tr> + </table> + </td> + <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_code'>100.0%</tt> + </td> + <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='100'/> + <td class='uncovered' width='0'/> + </tr> + </table> + </td> + </tr> + </table> + </td> + </tr> + </tbody> + </table> +<pre><span class="inferred0"><a name="line1"></a> 1 # +</span><span class="inferred1"><a name="line2"></a> 2 # Author:: Adam Jacob (<adam@hjksolutions.com>) +</span><span class="inferred0"><a name="line3"></a> 3 # Copyright:: Copyright (c) 2008 HJK Solutions, LLC +</span><span class="inferred1"><a name="line4"></a> 4 # License:: GNU General Public License version 2 or later +</span><span class="inferred0"><a name="line5"></a> 5 # +</span><span class="inferred1"><a name="line6"></a> 6 # This program and entire repository is free software; you can +</span><span class="inferred0"><a name="line7"></a> 7 # redistribute it and/or modify it under the terms of the GNU +</span><span class="inferred1"><a name="line8"></a> 8 # General Public License as published by the Free Software +</span><span class="inferred0"><a name="line9"></a> 9 # Foundation; either version 2 of the License, or any later version. +</span><span class="inferred1"><a name="line10"></a> 10 # +</span><span class="inferred0"><a name="line11"></a> 11 # This program is distributed in the hope that it will be useful, +</span><span class="inferred1"><a name="line12"></a> 12 # but WITHOUT ANY WARRANTY; without even the implied warranty of +</span><span class="inferred0"><a name="line13"></a> 13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +</span><span class="inferred1"><a name="line14"></a> 14 # GNU General Public License for more details. +</span><span class="inferred0"><a name="line15"></a> 15 # +</span><span class="inferred1"><a name="line16"></a> 16 # You should have received a copy of the GNU General Public License +</span><span class="inferred0"><a name="line17"></a> 17 # along with this program; if not, write to the Free Software +</span><span class="inferred1"><a name="line18"></a> 18 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +</span><span class="inferred0"><a name="line19"></a> 19 # +</span><span class="inferred1"><a name="line20"></a> 20 +</span><span class="marked0"><a name="line21"></a> 21 class Chef +</span><span class="marked1"><a name="line22"></a> 22 class ResourceCollection +</span><span class="marked0"><a name="line23"></a> 23 include Enumerable +</span><span class="inferred1"><a name="line24"></a> 24 +</span><span class="marked0"><a name="line25"></a> 25 def initialize +</span><span class="marked1"><a name="line26"></a> 26 @resources = Array.new +</span><span class="marked0"><a name="line27"></a> 27 @resources_by_name = Hash.new +</span><span class="inferred1"><a name="line28"></a> 28 end +</span><span class="inferred0"><a name="line29"></a> 29 +</span><span class="marked1"><a name="line30"></a> 30 def [](index) +</span><span class="marked0"><a name="line31"></a> 31 @resources[index] +</span><span class="marked1"><a name="line32"></a> 32 end +</span><span class="inferred0"><a name="line33"></a> 33 +</span><span class="marked1"><a name="line34"></a> 34 def []=(index, arg) +</span><span class="marked0"><a name="line35"></a> 35 is_chef_resource(arg) +</span><span class="marked1"><a name="line36"></a> 36 @resources[index] = arg +</span><span class="marked0"><a name="line37"></a> 37 @resources_by_name[arg.to_s] = index +</span><span class="inferred1"><a name="line38"></a> 38 end +</span><span class="inferred0"><a name="line39"></a> 39 +</span><span class="marked1"><a name="line40"></a> 40 def <<(*args) +</span><span class="marked0"><a name="line41"></a> 41 args.flatten.each do |a| +</span><span class="marked1"><a name="line42"></a> 42 is_chef_resource(a) +</span><span class="marked0"><a name="line43"></a> 43 @resources << a +</span><span class="marked1"><a name="line44"></a> 44 @resources_by_name[a.to_s] = @resources.length - 1 +</span><span class="inferred0"><a name="line45"></a> 45 end +</span><span class="marked1"><a name="line46"></a> 46 end +</span><span class="inferred0"><a name="line47"></a> 47 +</span><span class="marked1"><a name="line48"></a> 48 def push(*args) +</span><span class="marked0"><a name="line49"></a> 49 args.flatten.each do |a| +</span><span class="marked1"><a name="line50"></a> 50 is_chef_resource(a) +</span><span class="marked0"><a name="line51"></a> 51 @resources.push(a) +</span><span class="marked1"><a name="line52"></a> 52 @resources_by_name[a.to_s] = @resources.length - 1 +</span><span class="inferred0"><a name="line53"></a> 53 end +</span><span class="marked1"><a name="line54"></a> 54 end +</span><span class="inferred0"><a name="line55"></a> 55 +</span><span class="marked1"><a name="line56"></a> 56 def each +</span><span class="marked0"><a name="line57"></a> 57 @resources.each do |r| +</span><span class="marked1"><a name="line58"></a> 58 yield r +</span><span class="inferred0"><a name="line59"></a> 59 end +</span><span class="marked1"><a name="line60"></a> 60 end +</span><span class="inferred0"><a name="line61"></a> 61 +</span><span class="marked1"><a name="line62"></a> 62 def each_index +</span><span class="marked0"><a name="line63"></a> 63 @resources.each_index do |i| +</span><span class="marked1"><a name="line64"></a> 64 yield i +</span><span class="inferred0"><a name="line65"></a> 65 end +</span><span class="marked1"><a name="line66"></a> 66 end +</span><span class="inferred0"><a name="line67"></a> 67 +</span><span class="marked1"><a name="line68"></a> 68 def lookup(resource) +</span><span class="marked0"><a name="line69"></a> 69 lookup_by = nil +</span><span class="marked1"><a name="line70"></a> 70 if resource.kind_of?(Chef::Resource) +</span><span class="marked0"><a name="line71"></a> 71 lookup_by = resource.to_s +</span><span class="marked1"><a name="line72"></a> 72 elsif resource.kind_of?(String) +</span><span class="marked0"><a name="line73"></a> 73 lookup_by = resource +</span><span class="inferred1"><a name="line74"></a> 74 else +</span><span class="marked0"><a name="line75"></a> 75 raise ArgumentError, "Must pass a Chef::Resource or String to lookup" +</span><span class="inferred1"><a name="line76"></a> 76 end +</span><span class="marked0"><a name="line77"></a> 77 res = @resources_by_name[lookup_by] +</span><span class="marked1"><a name="line78"></a> 78 unless res +</span><span class="marked0"><a name="line79"></a> 79 raise ArgumentError, "Cannot find a resource matching #{lookup_by} (did you define it first?)" +</span><span class="inferred1"><a name="line80"></a> 80 end +</span><span class="marked0"><a name="line81"></a> 81 @resources[res] +</span><span class="inferred1"><a name="line82"></a> 82 end +</span><span class="inferred0"><a name="line83"></a> 83 +</span><span class="inferred1"><a name="line84"></a> 84 # Find existing resources by searching the list of existing resources. Possible +</span><span class="inferred0"><a name="line85"></a> 85 # forms are: +</span><span class="inferred1"><a name="line86"></a> 86 # +</span><span class="inferred0"><a name="line87"></a> 87 # resources(:file => "foobar") +</span><span class="inferred1"><a name="line88"></a> 88 # resources(:file => [ "foobar", "baz" ]) +</span><span class="inferred0"><a name="line89"></a> 89 # resources("file[foobar]", "file[baz]") +</span><span class="inferred1"><a name="line90"></a> 90 # resources("file[foobar,baz]") +</span><span class="inferred0"><a name="line91"></a> 91 # +</span><span class="inferred1"><a name="line92"></a> 92 # Returns the matching resource, or an Array of matching resources. +</span><span class="inferred0"><a name="line93"></a> 93 # +</span><span class="inferred1"><a name="line94"></a> 94 # Raises an ArgumentError if you feed it bad lookup information +</span><span class="inferred0"><a name="line95"></a> 95 # Raises a Runtime Error if it can't find the resources you are looking for. +</span><span class="marked1"><a name="line96"></a> 96 def resources(*args) +</span><span class="marked0"><a name="line97"></a> 97 results = Array.new +</span><span class="marked1"><a name="line98"></a> 98 args.each do |arg| +</span><span class="marked0"><a name="line99"></a> 99 case arg +</span><span class="marked1"><a name="line100"></a>100 when Hash +</span><span class="marked0"><a name="line101"></a>101 results << find_resource_by_hash(arg) +</span><span class="marked1"><a name="line102"></a>102 when String +</span><span class="marked0"><a name="line103"></a>103 results << find_resource_by_string(arg) +</span><span class="inferred1"><a name="line104"></a>104 else +</span><span class="marked0"><a name="line105"></a>105 raise ArgumentError, "resources takes arguments as a hash or strings!" +</span><span class="inferred1"><a name="line106"></a>106 end +</span><span class="inferred0"><a name="line107"></a>107 end +</span><span class="marked1"><a name="line108"></a>108 flat_results = results.flatten +</span><span class="marked0"><a name="line109"></a>109 flat_results.length == 1 ? flat_results[0] : flat_results +</span><span class="inferred1"><a name="line110"></a>110 end +</span><span class="inferred0"><a name="line111"></a>111 +</span><span class="marked1"><a name="line112"></a>112 private +</span><span class="inferred0"><a name="line113"></a>113 +</span><span class="marked1"><a name="line114"></a>114 def find_resource_by_hash(arg) +</span><span class="marked0"><a name="line115"></a>115 results = Array.new +</span><span class="marked1"><a name="line116"></a>116 arg.each do |resource_name, name_list| +</span><span class="marked0"><a name="line117"></a>117 names = name_list.kind_of?(Array) ? name_list : [ name_list ] +</span><span class="marked1"><a name="line118"></a>118 names.each do |name| +</span><span class="marked0"><a name="line119"></a>119 res_name = "#{resource_name.to_s}[#{name}]" +</span><span class="marked1"><a name="line120"></a>120 results << lookup(res_name) +</span><span class="inferred0"><a name="line121"></a>121 end +</span><span class="inferred1"><a name="line122"></a>122 end +</span><span class="marked0"><a name="line123"></a>123 return results +</span><span class="inferred1"><a name="line124"></a>124 end +</span><span class="inferred0"><a name="line125"></a>125 +</span><span class="marked1"><a name="line126"></a>126 def find_resource_by_string(arg) +</span><span class="marked0"><a name="line127"></a>127 results = Array.new +</span><span class="marked1"><a name="line128"></a>128 case arg +</span><span class="marked0"><a name="line129"></a>129 when /^(.+)\[(.+?),(.+)\]$/ +</span><span class="marked1"><a name="line130"></a>130 resource_type = $1 +</span><span class="marked0"><a name="line131"></a>131 arg =~ /^.+\[(.+)\]$/ +</span><span class="marked1"><a name="line132"></a>132 resource_list = $1 +</span><span class="marked0"><a name="line133"></a>133 resource_list.split(",").each do |name| +</span><span class="marked1"><a name="line134"></a>134 resource_name = "#{resource_type}[#{name}]" +</span><span class="marked0"><a name="line135"></a>135 results << lookup(resource_name) +</span><span class="inferred1"><a name="line136"></a>136 end +</span><span class="marked0"><a name="line137"></a>137 when /^(.+)\[(.+)\]$/ +</span><span class="marked1"><a name="line138"></a>138 resource_type = $1 +</span><span class="marked0"><a name="line139"></a>139 name = $2 +</span><span class="marked1"><a name="line140"></a>140 resource_name = "#{resource_type}[#{name}]" +</span><span class="marked0"><a name="line141"></a>141 results << lookup(resource_name) +</span><span class="inferred1"><a name="line142"></a>142 else +</span><span class="marked0"><a name="line143"></a>143 raise ArgumentError, "You must have a string like resource_type[name]!" +</span><span class="inferred1"><a name="line144"></a>144 end +</span><span class="marked0"><a name="line145"></a>145 return results +</span><span class="inferred1"><a name="line146"></a>146 end +</span><span class="inferred0"><a name="line147"></a>147 +</span><span class="marked1"><a name="line148"></a>148 def is_chef_resource(arg) +</span><span class="marked0"><a name="line149"></a>149 unless arg.kind_of?(Chef::Resource) +</span><span class="marked1"><a name="line150"></a>150 raise ArgumentError, "Members must be Chef::Resource's" +</span><span class="inferred0"><a name="line151"></a>151 end +</span><span class="marked1"><a name="line152"></a>152 true +</span><span class="inferred0"><a name="line153"></a>153 end +</span><span class="inferred1"><a name="line154"></a>154 end +</span><span class="inferred0"><a name="line155"></a>155 end +</span></pre><hr/> + <p>Generated using the <a href='http://eigenclass.org/hiki.rb?rcov'>rcov code coverage analysis tool for Ruby</a> + version 0.8.1.2.</p> +<p><a href='http://validator.w3.org/check/referer'><img src='http://www.w3.org/Icons/valid-xhtml10' height='31' alt='Valid XHTML 1.0!' width='88'/> + </a> + <a href='http://jigsaw.w3.org/css-validator/check/referer'><img src='http://jigsaw.w3.org/css-validator/images/vcss' alt='Valid CSS!' style='border:0;width:88px;height:31px'/> + </a> + </p> + </body> + </html> diff --git a/coverage/lib-chef-resource_definition_rb.html b/coverage/lib-chef-resource_definition_rb.html new file mode 100644 index 0000000000..be359e9c51 --- /dev/null +++ b/coverage/lib-chef-resource_definition_rb.html @@ -0,0 +1,673 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html lang='en' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'><head><title>lib/chef/resource_definition.rb - C0 code coverage information</title> + <style type='text/css'>body { background-color: rgb(240, 240, 245); }</style> + <style type='text/css'>span.cross-ref-title { + font-size: 140%; +} +span.cross-ref a { + text-decoration: none; +} +span.cross-ref { + background-color:#f3f7fa; + border: 1px dashed #333; + margin: 1em; + padding: 0.5em; + overflow: hidden; +} +a.crossref-toggle { + text-decoration: none; +} +span.marked0 { + background-color: rgb(185, 210, 200); + display: block; +} +span.marked1 { + background-color: rgb(190, 215, 205); + display: block; +} +span.inferred0 { + background-color: rgb(175, 200, 200); + display: block; +} +span.inferred1 { + background-color: rgb(180, 205, 205); + display: block; +} +span.uncovered0 { + background-color: rgb(225, 110, 110); + display: block; +} +span.uncovered1 { + background-color: rgb(235, 120, 120); + display: block; +} +span.overview { + border-bottom: 8px solid black; +} +div.overview { + border-bottom: 8px solid black; +} +body { + font-family: verdana, arial, helvetica; +} +div.footer { + font-size: 68%; + margin-top: 1.5em; +} +h1, h2, h3, h4, h5, h6 { + margin-bottom: 0.5em; +} +h5 { + margin-top: 0.5em; +} +.hidden { + display: none; +} +div.separator { + height: 10px; +} +/* Commented out for better readability, esp. on IE */ +/* +table tr td, table tr th { + font-size: 68%; +} +td.value table tr td { + font-size: 11px; +} +*/ +table.percent_graph { + height: 12px; + border: #808080 1px solid; + empty-cells: show; +} +table.percent_graph td.covered { + height: 10px; + background: #00f000; +} +table.percent_graph td.uncovered { + height: 10px; + background: #e00000; +} +table.percent_graph td.NA { + height: 10px; + background: #eaeaea; +} +table.report { + border-collapse: collapse; + width: 100%; +} +table.report td.heading { + background: #dcecff; + border: #d0d0d0 1px solid; + font-weight: bold; + text-align: center; +} +table.report td.heading:hover { + background: #c0ffc0; +} +table.report td.text { + border: #d0d0d0 1px solid; +} +table.report td.value, +table.report td.lines_total, +table.report td.lines_code { + text-align: right; + border: #d0d0d0 1px solid; +} +table.report tr.light { + background-color: rgb(240, 240, 245); +} +table.report tr.dark { + background-color: rgb(230, 230, 235); +} +</style> + <script type='text/javascript'> +// <![CDATA[ + function toggleCode( id ) { + if ( document.getElementById ) + elem = document.getElementById( id ); + else if ( document.all ) + elem = eval( "document.all." + id ); + else + return false; + + elemStyle = elem.style; + + if ( elemStyle.display != "block" ) { + elemStyle.display = "block" + } else { + elemStyle.display = "none" + } + + return true; + } + + // Make cross-references hidden by default + document.writeln( "<style type=\"text/css\">span.cross-ref { display: none }</style>" ) + // ]]> +</script> + <style type='text/css'>span.run0 { + background-color: rgb(178, 204, 255); + display: block; +} +span.run1 { + background-color: rgb(178, 206, 255); + display: block; +} +span.run2 { + background-color: rgb(178, 209, 255); + display: block; +} +span.run3 { + background-color: rgb(178, 211, 255); + display: block; +} +span.run4 { + background-color: rgb(178, 214, 255); + display: block; +} +span.run5 { + background-color: rgb(178, 218, 255); + display: block; +} +span.run6 { + background-color: rgb(178, 220, 255); + display: block; +} +span.run7 { + background-color: rgb(178, 223, 255); + display: block; +} +span.run8 { + background-color: rgb(178, 225, 255); + display: block; +} +span.run9 { + background-color: rgb(178, 228, 255); + display: block; +} +span.run10 { + background-color: rgb(178, 232, 255); + display: block; +} +span.run11 { + background-color: rgb(178, 234, 255); + display: block; +} +span.run12 { + background-color: rgb(178, 237, 255); + display: block; +} +span.run13 { + background-color: rgb(178, 239, 255); + display: block; +} +span.run14 { + background-color: rgb(178, 242, 255); + display: block; +} +span.run15 { + background-color: rgb(178, 246, 255); + display: block; +} +span.run16 { + background-color: rgb(178, 248, 255); + display: block; +} +span.run17 { + background-color: rgb(178, 251, 255); + display: block; +} +span.run18 { + background-color: rgb(178, 253, 255); + display: block; +} +span.run19 { + background-color: rgb(178, 255, 253); + display: block; +} +span.run20 { + background-color: rgb(178, 255, 249); + display: block; +} +span.run21 { + background-color: rgb(178, 255, 247); + display: block; +} +span.run22 { + background-color: rgb(178, 255, 244); + display: block; +} +span.run23 { + background-color: rgb(178, 255, 242); + display: block; +} +span.run24 { + background-color: rgb(178, 255, 239); + display: block; +} +span.run25 { + background-color: rgb(178, 255, 235); + display: block; +} +span.run26 { + background-color: rgb(178, 255, 233); + display: block; +} +span.run27 { + background-color: rgb(178, 255, 230); + display: block; +} +span.run28 { + background-color: rgb(178, 255, 228); + display: block; +} +span.run29 { + background-color: rgb(178, 255, 225); + display: block; +} +span.run30 { + background-color: rgb(178, 255, 221); + display: block; +} +span.run31 { + background-color: rgb(178, 255, 219); + display: block; +} +span.run32 { + background-color: rgb(178, 255, 216); + display: block; +} +span.run33 { + background-color: rgb(178, 255, 214); + display: block; +} +span.run34 { + background-color: rgb(178, 255, 211); + display: block; +} +span.run35 { + background-color: rgb(178, 255, 207); + display: block; +} +span.run36 { + background-color: rgb(178, 255, 205); + display: block; +} +span.run37 { + background-color: rgb(178, 255, 202); + display: block; +} +span.run38 { + background-color: rgb(178, 255, 200); + display: block; +} +span.run39 { + background-color: rgb(178, 255, 197); + display: block; +} +span.run40 { + background-color: rgb(178, 255, 193); + display: block; +} +span.run41 { + background-color: rgb(178, 255, 191); + display: block; +} +span.run42 { + background-color: rgb(178, 255, 188); + display: block; +} +span.run43 { + background-color: rgb(178, 255, 186); + display: block; +} +span.run44 { + background-color: rgb(178, 255, 183); + display: block; +} +span.run45 { + background-color: rgb(178, 255, 179); + display: block; +} +span.run46 { + background-color: rgb(179, 255, 178); + display: block; +} +span.run47 { + background-color: rgb(182, 255, 178); + display: block; +} +span.run48 { + background-color: rgb(184, 255, 178); + display: block; +} +span.run49 { + background-color: rgb(187, 255, 178); + display: block; +} +span.run50 { + background-color: rgb(191, 255, 178); + display: block; +} +span.run51 { + background-color: rgb(193, 255, 178); + display: block; +} +span.run52 { + background-color: rgb(196, 255, 178); + display: block; +} +span.run53 { + background-color: rgb(198, 255, 178); + display: block; +} +span.run54 { + background-color: rgb(201, 255, 178); + display: block; +} +span.run55 { + background-color: rgb(205, 255, 178); + display: block; +} +span.run56 { + background-color: rgb(207, 255, 178); + display: block; +} +span.run57 { + background-color: rgb(210, 255, 178); + display: block; +} +span.run58 { + background-color: rgb(212, 255, 178); + display: block; +} +span.run59 { + background-color: rgb(215, 255, 178); + display: block; +} +span.run60 { + background-color: rgb(219, 255, 178); + display: block; +} +span.run61 { + background-color: rgb(221, 255, 178); + display: block; +} +span.run62 { + background-color: rgb(224, 255, 178); + display: block; +} +span.run63 { + background-color: rgb(226, 255, 178); + display: block; +} +span.run64 { + background-color: rgb(229, 255, 178); + display: block; +} +span.run65 { + background-color: rgb(233, 255, 178); + display: block; +} +span.run66 { + background-color: rgb(235, 255, 178); + display: block; +} +span.run67 { + background-color: rgb(238, 255, 178); + display: block; +} +span.run68 { + background-color: rgb(240, 255, 178); + display: block; +} +span.run69 { + background-color: rgb(243, 255, 178); + display: block; +} +span.run70 { + background-color: rgb(247, 255, 178); + display: block; +} +span.run71 { + background-color: rgb(249, 255, 178); + display: block; +} +span.run72 { + background-color: rgb(252, 255, 178); + display: block; +} +span.run73 { + background-color: rgb(255, 255, 178); + display: block; +} +span.run74 { + background-color: rgb(255, 252, 178); + display: block; +} +span.run75 { + background-color: rgb(255, 248, 178); + display: block; +} +span.run76 { + background-color: rgb(255, 246, 178); + display: block; +} +span.run77 { + background-color: rgb(255, 243, 178); + display: block; +} +span.run78 { + background-color: rgb(255, 240, 178); + display: block; +} +span.run79 { + background-color: rgb(255, 238, 178); + display: block; +} +span.run80 { + background-color: rgb(255, 234, 178); + display: block; +} +span.run81 { + background-color: rgb(255, 232, 178); + display: block; +} +span.run82 { + background-color: rgb(255, 229, 178); + display: block; +} +span.run83 { + background-color: rgb(255, 226, 178); + display: block; +} +span.run84 { + background-color: rgb(255, 224, 178); + display: block; +} +span.run85 { + background-color: rgb(255, 220, 178); + display: block; +} +span.run86 { + background-color: rgb(255, 218, 178); + display: block; +} +span.run87 { + background-color: rgb(255, 215, 178); + display: block; +} +span.run88 { + background-color: rgb(255, 212, 178); + display: block; +} +span.run89 { + background-color: rgb(255, 210, 178); + display: block; +} +span.run90 { + background-color: rgb(255, 206, 178); + display: block; +} +span.run91 { + background-color: rgb(255, 204, 178); + display: block; +} +span.run92 { + background-color: rgb(255, 201, 178); + display: block; +} +span.run93 { + background-color: rgb(255, 198, 178); + display: block; +} +span.run94 { + background-color: rgb(255, 196, 178); + display: block; +} +span.run95 { + background-color: rgb(255, 192, 178); + display: block; +} +span.run96 { + background-color: rgb(255, 189, 178); + display: block; +} +span.run97 { + background-color: rgb(255, 187, 178); + display: block; +} +span.run98 { + background-color: rgb(255, 184, 178); + display: block; +} +span.run99 { + background-color: rgb(255, 182, 178); + display: block; +} +span.run100 { + background-color: rgb(255, 178, 178); + display: block; +} +</style> + </head> + <body><h3>C0 code coverage information</h3> + <p>Generated on Mon Mar 10 00:31:55 -0700 2008 with <a href='http://eigenclass.org/hiki/rcov'>rcov 0.8.1.2</a> + </p> + <hr/> + <pre><span class='marked0'>Code reported as executed by Ruby looks like this... +</span><span class='marked1'>and this: this line is also marked as covered. +</span><span class='inferred0'>Lines considered as run by rcov, but not reported by Ruby, look like this, +</span><span class='inferred1'>and this: these lines were inferred by rcov (using simple heuristics). +</span><span class='uncovered0'>Finally, here's a line marked as not executed. +</span></pre> +<table class='report'><thead><tr><td class='heading'>Name</td> + <td class='heading'>Total lines</td> + <td class='heading'>Lines of code</td> + <td class='heading'>Total coverage</td> + <td class='heading'>Code coverage</td> + </tr> + </thead> + <tbody><tr class='light'><td><a href='lib-chef-resource_definition_rb.html'>lib/chef/resource_definition.rb</a> + </td> + <td class='lines_total'><tt>63</tt> + </td> + <td class='lines_code'><tt>33</tt> + </td> + <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_total'>100.0%</tt> + </td> + <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='100'/> + <td class='uncovered' width='0'/> + </tr> + </table> + </td> + </tr> + </table> + </td> + <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_code'>100.0%</tt> + </td> + <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='100'/> + <td class='uncovered' width='0'/> + </tr> + </table> + </td> + </tr> + </table> + </td> + </tr> + </tbody> + </table> +<pre><span class="inferred1"><a name="line1"></a> 1 # +</span><span class="inferred0"><a name="line2"></a> 2 # Author:: Adam Jacob (<adam@hjksolutions.com>) +</span><span class="inferred1"><a name="line3"></a> 3 # Copyright:: Copyright (c) 2008 HJK Solutions, LLC +</span><span class="inferred0"><a name="line4"></a> 4 # License:: GNU General Public License version 2 or later +</span><span class="inferred1"><a name="line5"></a> 5 # +</span><span class="inferred0"><a name="line6"></a> 6 # This program and entire repository is free software; you can +</span><span class="inferred1"><a name="line7"></a> 7 # redistribute it and/or modify it under the terms of the GNU +</span><span class="inferred0"><a name="line8"></a> 8 # General Public License as published by the Free Software +</span><span class="inferred1"><a name="line9"></a> 9 # Foundation; either version 2 of the License, or any later version. +</span><span class="inferred0"><a name="line10"></a>10 # +</span><span class="inferred1"><a name="line11"></a>11 # This program is distributed in the hope that it will be useful, +</span><span class="inferred0"><a name="line12"></a>12 # but WITHOUT ANY WARRANTY; without even the implied warranty of +</span><span class="inferred1"><a name="line13"></a>13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +</span><span class="inferred0"><a name="line14"></a>14 # GNU General Public License for more details. +</span><span class="inferred1"><a name="line15"></a>15 # +</span><span class="inferred0"><a name="line16"></a>16 # You should have received a copy of the GNU General Public License +</span><span class="inferred1"><a name="line17"></a>17 # along with this program; if not, write to the Free Software +</span><span class="inferred0"><a name="line18"></a>18 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +</span><span class="inferred1"><a name="line19"></a>19 # +</span><span class="inferred0"><a name="line20"></a>20 +</span><span class="marked1"><a name="line21"></a>21 require File.join(File.dirname(__FILE__), "mixin", "from_file") +</span><span class="inferred0"><a name="line22"></a>22 +</span><span class="marked1"><a name="line23"></a>23 class Chef +</span><span class="marked0"><a name="line24"></a>24 class ResourceDefinition +</span><span class="inferred1"><a name="line25"></a>25 +</span><span class="marked0"><a name="line26"></a>26 include Chef::Mixin::FromFile +</span><span class="inferred1"><a name="line27"></a>27 +</span><span class="marked0"><a name="line28"></a>28 attr_accessor :name, :params, :recipe +</span><span class="inferred1"><a name="line29"></a>29 +</span><span class="marked0"><a name="line30"></a>30 def initialize +</span><span class="marked1"><a name="line31"></a>31 @name = nil +</span><span class="marked0"><a name="line32"></a>32 @params = Hash.new +</span><span class="marked1"><a name="line33"></a>33 @recipe = nil +</span><span class="inferred0"><a name="line34"></a>34 end +</span><span class="inferred1"><a name="line35"></a>35 +</span><span class="marked0"><a name="line36"></a>36 def define(resource_name, prototype_params=nil, &block) +</span><span class="marked1"><a name="line37"></a>37 unless resource_name.kind_of?(Symbol) +</span><span class="marked0"><a name="line38"></a>38 raise ArgumentError, "You must use a symbol when defining a new resource!" +</span><span class="inferred1"><a name="line39"></a>39 end +</span><span class="marked0"><a name="line40"></a>40 @name = resource_name +</span><span class="marked1"><a name="line41"></a>41 if prototype_params +</span><span class="marked0"><a name="line42"></a>42 unless prototype_params.kind_of?(Hash) +</span><span class="marked1"><a name="line43"></a>43 raise ArgumentError, "You must pass a hash as the prototype parameters for a definition." +</span><span class="inferred0"><a name="line44"></a>44 end +</span><span class="marked1"><a name="line45"></a>45 @params = prototype_params +</span><span class="inferred0"><a name="line46"></a>46 end +</span><span class="marked1"><a name="line47"></a>47 if Kernel.block_given? +</span><span class="marked0"><a name="line48"></a>48 @recipe = block +</span><span class="inferred1"><a name="line49"></a>49 else +</span><span class="marked0"><a name="line50"></a>50 raise ArgumentError, "You must pass a block to a definition." +</span><span class="inferred1"><a name="line51"></a>51 end +</span><span class="marked0"><a name="line52"></a>52 true +</span><span class="inferred1"><a name="line53"></a>53 end +</span><span class="inferred0"><a name="line54"></a>54 +</span><span class="inferred1"><a name="line55"></a>55 # When we do the resource definition, we're really just setting new values for +</span><span class="inferred0"><a name="line56"></a>56 # the paramaters we prototyped at the top. This method missing is as simple as +</span><span class="inferred1"><a name="line57"></a>57 # it gets. +</span><span class="marked0"><a name="line58"></a>58 def method_missing(symbol, *args) +</span><span class="marked1"><a name="line59"></a>59 @params[symbol] = args.length == 1 ? args[0] : args +</span><span class="marked0"><a name="line60"></a>60 end +</span><span class="inferred1"><a name="line61"></a>61 +</span><span class="inferred0"><a name="line62"></a>62 end +</span><span class="inferred1"><a name="line63"></a>63 end +</span></pre><hr/> + <p>Generated using the <a href='http://eigenclass.org/hiki.rb?rcov'>rcov code coverage analysis tool for Ruby</a> + version 0.8.1.2.</p> +<p><a href='http://validator.w3.org/check/referer'><img src='http://www.w3.org/Icons/valid-xhtml10' height='31' alt='Valid XHTML 1.0!' width='88'/> + </a> + <a href='http://jigsaw.w3.org/css-validator/check/referer'><img src='http://jigsaw.w3.org/css-validator/images/vcss' alt='Valid CSS!' style='border:0;width:88px;height:31px'/> + </a> + </p> + </body> + </html> diff --git a/coverage/lib-chef-resource_rb.html b/coverage/lib-chef-resource_rb.html new file mode 100644 index 0000000000..08fe4b2571 --- /dev/null +++ b/coverage/lib-chef-resource_rb.html @@ -0,0 +1,733 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html lang='en' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'><head><title>lib/chef/resource.rb - C0 code coverage information</title> + <style type='text/css'>body { background-color: rgb(240, 240, 245); }</style> + <style type='text/css'>span.cross-ref-title { + font-size: 140%; +} +span.cross-ref a { + text-decoration: none; +} +span.cross-ref { + background-color:#f3f7fa; + border: 1px dashed #333; + margin: 1em; + padding: 0.5em; + overflow: hidden; +} +a.crossref-toggle { + text-decoration: none; +} +span.marked0 { + background-color: rgb(185, 210, 200); + display: block; +} +span.marked1 { + background-color: rgb(190, 215, 205); + display: block; +} +span.inferred0 { + background-color: rgb(175, 200, 200); + display: block; +} +span.inferred1 { + background-color: rgb(180, 205, 205); + display: block; +} +span.uncovered0 { + background-color: rgb(225, 110, 110); + display: block; +} +span.uncovered1 { + background-color: rgb(235, 120, 120); + display: block; +} +span.overview { + border-bottom: 8px solid black; +} +div.overview { + border-bottom: 8px solid black; +} +body { + font-family: verdana, arial, helvetica; +} +div.footer { + font-size: 68%; + margin-top: 1.5em; +} +h1, h2, h3, h4, h5, h6 { + margin-bottom: 0.5em; +} +h5 { + margin-top: 0.5em; +} +.hidden { + display: none; +} +div.separator { + height: 10px; +} +/* Commented out for better readability, esp. on IE */ +/* +table tr td, table tr th { + font-size: 68%; +} +td.value table tr td { + font-size: 11px; +} +*/ +table.percent_graph { + height: 12px; + border: #808080 1px solid; + empty-cells: show; +} +table.percent_graph td.covered { + height: 10px; + background: #00f000; +} +table.percent_graph td.uncovered { + height: 10px; + background: #e00000; +} +table.percent_graph td.NA { + height: 10px; + background: #eaeaea; +} +table.report { + border-collapse: collapse; + width: 100%; +} +table.report td.heading { + background: #dcecff; + border: #d0d0d0 1px solid; + font-weight: bold; + text-align: center; +} +table.report td.heading:hover { + background: #c0ffc0; +} +table.report td.text { + border: #d0d0d0 1px solid; +} +table.report td.value, +table.report td.lines_total, +table.report td.lines_code { + text-align: right; + border: #d0d0d0 1px solid; +} +table.report tr.light { + background-color: rgb(240, 240, 245); +} +table.report tr.dark { + background-color: rgb(230, 230, 235); +} +</style> + <script type='text/javascript'> +// <![CDATA[ + function toggleCode( id ) { + if ( document.getElementById ) + elem = document.getElementById( id ); + else if ( document.all ) + elem = eval( "document.all." + id ); + else + return false; + + elemStyle = elem.style; + + if ( elemStyle.display != "block" ) { + elemStyle.display = "block" + } else { + elemStyle.display = "none" + } + + return true; + } + + // Make cross-references hidden by default + document.writeln( "<style type=\"text/css\">span.cross-ref { display: none }</style>" ) + // ]]> +</script> + <style type='text/css'>span.run0 { + background-color: rgb(178, 204, 255); + display: block; +} +span.run1 { + background-color: rgb(178, 206, 255); + display: block; +} +span.run2 { + background-color: rgb(178, 209, 255); + display: block; +} +span.run3 { + background-color: rgb(178, 211, 255); + display: block; +} +span.run4 { + background-color: rgb(178, 214, 255); + display: block; +} +span.run5 { + background-color: rgb(178, 218, 255); + display: block; +} +span.run6 { + background-color: rgb(178, 220, 255); + display: block; +} +span.run7 { + background-color: rgb(178, 223, 255); + display: block; +} +span.run8 { + background-color: rgb(178, 225, 255); + display: block; +} +span.run9 { + background-color: rgb(178, 228, 255); + display: block; +} +span.run10 { + background-color: rgb(178, 232, 255); + display: block; +} +span.run11 { + background-color: rgb(178, 234, 255); + display: block; +} +span.run12 { + background-color: rgb(178, 237, 255); + display: block; +} +span.run13 { + background-color: rgb(178, 239, 255); + display: block; +} +span.run14 { + background-color: rgb(178, 242, 255); + display: block; +} +span.run15 { + background-color: rgb(178, 246, 255); + display: block; +} +span.run16 { + background-color: rgb(178, 248, 255); + display: block; +} +span.run17 { + background-color: rgb(178, 251, 255); + display: block; +} +span.run18 { + background-color: rgb(178, 253, 255); + display: block; +} +span.run19 { + background-color: rgb(178, 255, 253); + display: block; +} +span.run20 { + background-color: rgb(178, 255, 249); + display: block; +} +span.run21 { + background-color: rgb(178, 255, 247); + display: block; +} +span.run22 { + background-color: rgb(178, 255, 244); + display: block; +} +span.run23 { + background-color: rgb(178, 255, 242); + display: block; +} +span.run24 { + background-color: rgb(178, 255, 239); + display: block; +} +span.run25 { + background-color: rgb(178, 255, 235); + display: block; +} +span.run26 { + background-color: rgb(178, 255, 233); + display: block; +} +span.run27 { + background-color: rgb(178, 255, 230); + display: block; +} +span.run28 { + background-color: rgb(178, 255, 228); + display: block; +} +span.run29 { + background-color: rgb(178, 255, 225); + display: block; +} +span.run30 { + background-color: rgb(178, 255, 221); + display: block; +} +span.run31 { + background-color: rgb(178, 255, 219); + display: block; +} +span.run32 { + background-color: rgb(178, 255, 216); + display: block; +} +span.run33 { + background-color: rgb(178, 255, 214); + display: block; +} +span.run34 { + background-color: rgb(178, 255, 211); + display: block; +} +span.run35 { + background-color: rgb(178, 255, 207); + display: block; +} +span.run36 { + background-color: rgb(178, 255, 205); + display: block; +} +span.run37 { + background-color: rgb(178, 255, 202); + display: block; +} +span.run38 { + background-color: rgb(178, 255, 200); + display: block; +} +span.run39 { + background-color: rgb(178, 255, 197); + display: block; +} +span.run40 { + background-color: rgb(178, 255, 193); + display: block; +} +span.run41 { + background-color: rgb(178, 255, 191); + display: block; +} +span.run42 { + background-color: rgb(178, 255, 188); + display: block; +} +span.run43 { + background-color: rgb(178, 255, 186); + display: block; +} +span.run44 { + background-color: rgb(178, 255, 183); + display: block; +} +span.run45 { + background-color: rgb(178, 255, 179); + display: block; +} +span.run46 { + background-color: rgb(179, 255, 178); + display: block; +} +span.run47 { + background-color: rgb(182, 255, 178); + display: block; +} +span.run48 { + background-color: rgb(184, 255, 178); + display: block; +} +span.run49 { + background-color: rgb(187, 255, 178); + display: block; +} +span.run50 { + background-color: rgb(191, 255, 178); + display: block; +} +span.run51 { + background-color: rgb(193, 255, 178); + display: block; +} +span.run52 { + background-color: rgb(196, 255, 178); + display: block; +} +span.run53 { + background-color: rgb(198, 255, 178); + display: block; +} +span.run54 { + background-color: rgb(201, 255, 178); + display: block; +} +span.run55 { + background-color: rgb(205, 255, 178); + display: block; +} +span.run56 { + background-color: rgb(207, 255, 178); + display: block; +} +span.run57 { + background-color: rgb(210, 255, 178); + display: block; +} +span.run58 { + background-color: rgb(212, 255, 178); + display: block; +} +span.run59 { + background-color: rgb(215, 255, 178); + display: block; +} +span.run60 { + background-color: rgb(219, 255, 178); + display: block; +} +span.run61 { + background-color: rgb(221, 255, 178); + display: block; +} +span.run62 { + background-color: rgb(224, 255, 178); + display: block; +} +span.run63 { + background-color: rgb(226, 255, 178); + display: block; +} +span.run64 { + background-color: rgb(229, 255, 178); + display: block; +} +span.run65 { + background-color: rgb(233, 255, 178); + display: block; +} +span.run66 { + background-color: rgb(235, 255, 178); + display: block; +} +span.run67 { + background-color: rgb(238, 255, 178); + display: block; +} +span.run68 { + background-color: rgb(240, 255, 178); + display: block; +} +span.run69 { + background-color: rgb(243, 255, 178); + display: block; +} +span.run70 { + background-color: rgb(247, 255, 178); + display: block; +} +span.run71 { + background-color: rgb(249, 255, 178); + display: block; +} +span.run72 { + background-color: rgb(252, 255, 178); + display: block; +} +span.run73 { + background-color: rgb(255, 255, 178); + display: block; +} +span.run74 { + background-color: rgb(255, 252, 178); + display: block; +} +span.run75 { + background-color: rgb(255, 248, 178); + display: block; +} +span.run76 { + background-color: rgb(255, 246, 178); + display: block; +} +span.run77 { + background-color: rgb(255, 243, 178); + display: block; +} +span.run78 { + background-color: rgb(255, 240, 178); + display: block; +} +span.run79 { + background-color: rgb(255, 238, 178); + display: block; +} +span.run80 { + background-color: rgb(255, 234, 178); + display: block; +} +span.run81 { + background-color: rgb(255, 232, 178); + display: block; +} +span.run82 { + background-color: rgb(255, 229, 178); + display: block; +} +span.run83 { + background-color: rgb(255, 226, 178); + display: block; +} +span.run84 { + background-color: rgb(255, 224, 178); + display: block; +} +span.run85 { + background-color: rgb(255, 220, 178); + display: block; +} +span.run86 { + background-color: rgb(255, 218, 178); + display: block; +} +span.run87 { + background-color: rgb(255, 215, 178); + display: block; +} +span.run88 { + background-color: rgb(255, 212, 178); + display: block; +} +span.run89 { + background-color: rgb(255, 210, 178); + display: block; +} +span.run90 { + background-color: rgb(255, 206, 178); + display: block; +} +span.run91 { + background-color: rgb(255, 204, 178); + display: block; +} +span.run92 { + background-color: rgb(255, 201, 178); + display: block; +} +span.run93 { + background-color: rgb(255, 198, 178); + display: block; +} +span.run94 { + background-color: rgb(255, 196, 178); + display: block; +} +span.run95 { + background-color: rgb(255, 192, 178); + display: block; +} +span.run96 { + background-color: rgb(255, 189, 178); + display: block; +} +span.run97 { + background-color: rgb(255, 187, 178); + display: block; +} +span.run98 { + background-color: rgb(255, 184, 178); + display: block; +} +span.run99 { + background-color: rgb(255, 182, 178); + display: block; +} +span.run100 { + background-color: rgb(255, 178, 178); + display: block; +} +</style> + </head> + <body><h3>C0 code coverage information</h3> + <p>Generated on Mon Mar 10 00:31:54 -0700 2008 with <a href='http://eigenclass.org/hiki/rcov'>rcov 0.8.1.2</a> + </p> + <hr/> + <pre><span class='marked0'>Code reported as executed by Ruby looks like this... +</span><span class='marked1'>and this: this line is also marked as covered. +</span><span class='inferred0'>Lines considered as run by rcov, but not reported by Ruby, look like this, +</span><span class='inferred1'>and this: these lines were inferred by rcov (using simple heuristics). +</span><span class='uncovered0'>Finally, here's a line marked as not executed. +</span></pre> +<table class='report'><thead><tr><td class='heading'>Name</td> + <td class='heading'>Total lines</td> + <td class='heading'>Lines of code</td> + <td class='heading'>Total coverage</td> + <td class='heading'>Code coverage</td> + </tr> + </thead> + <tbody><tr class='light'><td><a href='lib-chef-resource_rb.html'>lib/chef/resource.rb</a> + </td> + <td class='lines_total'><tt>123</tt> + </td> + <td class='lines_code'><tt>90</tt> + </td> + <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_total'>100.0%</tt> + </td> + <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='100'/> + <td class='uncovered' width='0'/> + </tr> + </table> + </td> + </tr> + </table> + </td> + <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_code'>100.0%</tt> + </td> + <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='100'/> + <td class='uncovered' width='0'/> + </tr> + </table> + </td> + </tr> + </table> + </td> + </tr> + </tbody> + </table> +<pre><span class="inferred0"><a name="line1"></a> 1 # +</span><span class="inferred1"><a name="line2"></a> 2 # Author:: Adam Jacob (<adam@hjksolutions.com>) +</span><span class="inferred0"><a name="line3"></a> 3 # Copyright:: Copyright (c) 2008 HJK Solutions, LLC +</span><span class="inferred1"><a name="line4"></a> 4 # License:: GNU General Public License version 2 or later +</span><span class="inferred0"><a name="line5"></a> 5 # +</span><span class="inferred1"><a name="line6"></a> 6 # This program and entire repository is free software; you can +</span><span class="inferred0"><a name="line7"></a> 7 # redistribute it and/or modify it under the terms of the GNU +</span><span class="inferred1"><a name="line8"></a> 8 # General Public License as published by the Free Software +</span><span class="inferred0"><a name="line9"></a> 9 # Foundation; either version 2 of the License, or any later version. +</span><span class="inferred1"><a name="line10"></a> 10 # +</span><span class="inferred0"><a name="line11"></a> 11 # This program is distributed in the hope that it will be useful, +</span><span class="inferred1"><a name="line12"></a> 12 # but WITHOUT ANY WARRANTY; without even the implied warranty of +</span><span class="inferred0"><a name="line13"></a> 13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +</span><span class="inferred1"><a name="line14"></a> 14 # GNU General Public License for more details. +</span><span class="inferred0"><a name="line15"></a> 15 # +</span><span class="inferred1"><a name="line16"></a> 16 # You should have received a copy of the GNU General Public License +</span><span class="inferred0"><a name="line17"></a> 17 # along with this program; if not, write to the Free Software +</span><span class="inferred1"><a name="line18"></a> 18 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +</span><span class="inferred0"><a name="line19"></a> 19 # +</span><span class="inferred1"><a name="line20"></a> 20 +</span><span class="marked0"><a name="line21"></a> 21 require File.join(File.dirname(__FILE__), "mixin", "check_helper") +</span><span class="marked1"><a name="line22"></a> 22 require 'yaml' +</span><span class="inferred0"><a name="line23"></a> 23 +</span><span class="marked1"><a name="line24"></a> 24 class Chef +</span><span class="marked0"><a name="line25"></a> 25 class Resource +</span><span class="inferred1"><a name="line26"></a> 26 +</span><span class="marked0"><a name="line27"></a> 27 include Chef::Mixin::CheckHelper +</span><span class="inferred1"><a name="line28"></a> 28 +</span><span class="marked0"><a name="line29"></a> 29 attr_accessor :tag, :actions, :config, :params +</span><span class="marked1"><a name="line30"></a> 30 attr_reader :name, :noop, :resource_name, :collection, :notifies, :subscribes +</span><span class="inferred0"><a name="line31"></a> 31 +</span><span class="marked1"><a name="line32"></a> 32 def initialize(name, collection=nil, config=nil) +</span><span class="marked0"><a name="line33"></a> 33 @name = name +</span><span class="marked1"><a name="line34"></a> 34 if collection +</span><span class="marked0"><a name="line35"></a> 35 @collection = collection +</span><span class="inferred1"><a name="line36"></a> 36 else +</span><span class="marked0"><a name="line37"></a> 37 @collection = Chef::ResourceCollection.new() +</span><span class="inferred1"><a name="line38"></a> 38 end +</span><span class="marked0"><a name="line39"></a> 39 if config +</span><span class="marked1"><a name="line40"></a> 40 @config = config +</span><span class="inferred0"><a name="line41"></a> 41 else +</span><span class="marked1"><a name="line42"></a> 42 @config = Chef::Config.new() +</span><span class="inferred0"><a name="line43"></a> 43 end +</span><span class="marked1"><a name="line44"></a> 44 @tag = [ name.to_s ] +</span><span class="marked0"><a name="line45"></a> 45 @noop = nil +</span><span class="marked1"><a name="line46"></a> 46 @before = nil +</span><span class="marked0"><a name="line47"></a> 47 @actions = Hash.new +</span><span class="marked1"><a name="line48"></a> 48 @params = Hash.new +</span><span class="inferred0"><a name="line49"></a> 49 end +</span><span class="inferred1"><a name="line50"></a> 50 +</span><span class="marked0"><a name="line51"></a> 51 def name(name=nil) +</span><span class="marked1"><a name="line52"></a> 52 set_if_args(@name, name) do +</span><span class="marked0"><a name="line53"></a> 53 raise ArgumentError, "name must be a string!" unless name.kind_of?(String) +</span><span class="marked1"><a name="line54"></a> 54 @name = name +</span><span class="inferred0"><a name="line55"></a> 55 end +</span><span class="marked1"><a name="line56"></a> 56 end +</span><span class="inferred0"><a name="line57"></a> 57 +</span><span class="marked1"><a name="line58"></a> 58 def noop(tf=nil) +</span><span class="marked0"><a name="line59"></a> 59 set_if_args(@noop, tf) do +</span><span class="marked1"><a name="line60"></a> 60 raise ArgumentError, "noop must be true or false!" unless tf == true || tf == false +</span><span class="marked0"><a name="line61"></a> 61 @noop = tf +</span><span class="inferred1"><a name="line62"></a> 62 end +</span><span class="marked0"><a name="line63"></a> 63 end +</span><span class="inferred1"><a name="line64"></a> 64 +</span><span class="marked0"><a name="line65"></a> 65 def notifies(action, resources, timing=:delayed) +</span><span class="marked1"><a name="line66"></a> 66 timing = check_timing(timing) +</span><span class="marked0"><a name="line67"></a> 67 rarray = resources.kind_of?(Array) ? resources : [ resources ] +</span><span class="marked1"><a name="line68"></a> 68 rarray.each do |resource| +</span><span class="marked0"><a name="line69"></a> 69 action_sym = action.to_sym +</span><span class="marked1"><a name="line70"></a> 70 if @actions.has_key?(action_sym) +</span><span class="marked0"><a name="line71"></a> 71 @actions[action_sym][timing] << resource +</span><span class="inferred1"><a name="line72"></a> 72 else +</span><span class="marked0"><a name="line73"></a> 73 @actions[action_sym] = Hash.new +</span><span class="marked1"><a name="line74"></a> 74 @actions[action_sym][:delayed] = Array.new +</span><span class="marked0"><a name="line75"></a> 75 @actions[action_sym][:immediate] = Array.new +</span><span class="marked1"><a name="line76"></a> 76 @actions[action_sym][timing] << resource +</span><span class="inferred0"><a name="line77"></a> 77 end +</span><span class="inferred1"><a name="line78"></a> 78 end +</span><span class="marked0"><a name="line79"></a> 79 true +</span><span class="inferred1"><a name="line80"></a> 80 end +</span><span class="inferred0"><a name="line81"></a> 81 +</span><span class="marked1"><a name="line82"></a> 82 def resources(*args) +</span><span class="marked0"><a name="line83"></a> 83 @collection.resources(*args) +</span><span class="marked1"><a name="line84"></a> 84 end +</span><span class="inferred0"><a name="line85"></a> 85 +</span><span class="marked1"><a name="line86"></a> 86 def subscribes(action, resources, timing=:delayed) +</span><span class="marked0"><a name="line87"></a> 87 timing = check_timing(timing) +</span><span class="marked1"><a name="line88"></a> 88 rarray = resources.kind_of?(Array) ? resources : [ resources ] +</span><span class="marked0"><a name="line89"></a> 89 rarray.each do |resource| +</span><span class="marked1"><a name="line90"></a> 90 action_sym = action.to_sym +</span><span class="marked0"><a name="line91"></a> 91 if resource.actions.has_key?(action_sym) +</span><span class="marked1"><a name="line92"></a> 92 resource.actions[action_sym][timing] << self +</span><span class="inferred0"><a name="line93"></a> 93 else +</span><span class="marked1"><a name="line94"></a> 94 resource.actions[action_sym] = Hash.new +</span><span class="marked0"><a name="line95"></a> 95 resource.actions[action_sym][:delayed] = Array.new +</span><span class="marked1"><a name="line96"></a> 96 resource.actions[action_sym][:immediate] = Array.new +</span><span class="marked0"><a name="line97"></a> 97 resource.actions[action_sym][timing] << self +</span><span class="inferred1"><a name="line98"></a> 98 end +</span><span class="inferred0"><a name="line99"></a> 99 end +</span><span class="marked1"><a name="line100"></a>100 true +</span><span class="inferred0"><a name="line101"></a>101 end +</span><span class="inferred1"><a name="line102"></a>102 +</span><span class="marked0"><a name="line103"></a>103 def is(*args) +</span><span class="marked1"><a name="line104"></a>104 return *args +</span><span class="marked0"><a name="line105"></a>105 end +</span><span class="inferred1"><a name="line106"></a>106 +</span><span class="marked0"><a name="line107"></a>107 def to_s +</span><span class="marked1"><a name="line108"></a>108 "#{@resource_name}[#{@name}]" +</span><span class="marked0"><a name="line109"></a>109 end +</span><span class="inferred1"><a name="line110"></a>110 +</span><span class="marked0"><a name="line111"></a>111 private +</span><span class="inferred1"><a name="line112"></a>112 +</span><span class="marked0"><a name="line113"></a>113 def check_timing(timing) +</span><span class="marked1"><a name="line114"></a>114 unless timing == :delayed || timing == :immediate || timing == :immediately +</span><span class="marked0"><a name="line115"></a>115 raise ArgumentError, "Timing must be :delayed or :immediate(ly), you said #{timing}" +</span><span class="inferred1"><a name="line116"></a>116 end +</span><span class="marked0"><a name="line117"></a>117 if timing == :immediately +</span><span class="marked1"><a name="line118"></a>118 timing = :immediate +</span><span class="inferred0"><a name="line119"></a>119 end +</span><span class="marked1"><a name="line120"></a>120 timing +</span><span class="inferred0"><a name="line121"></a>121 end +</span><span class="inferred1"><a name="line122"></a>122 end +</span><span class="inferred0"><a name="line123"></a>123 end +</span></pre><hr/> + <p>Generated using the <a href='http://eigenclass.org/hiki.rb?rcov'>rcov code coverage analysis tool for Ruby</a> + version 0.8.1.2.</p> +<p><a href='http://validator.w3.org/check/referer'><img src='http://www.w3.org/Icons/valid-xhtml10' height='31' alt='Valid XHTML 1.0!' width='88'/> + </a> + <a href='http://jigsaw.w3.org/css-validator/check/referer'><img src='http://jigsaw.w3.org/css-validator/images/vcss' alt='Valid CSS!' style='border:0;width:88px;height:31px'/> + </a> + </p> + </body> + </html> diff --git a/coverage/lib-chef_rb.html b/coverage/lib-chef_rb.html new file mode 100644 index 0000000000..2d69949559 --- /dev/null +++ b/coverage/lib-chef_rb.html @@ -0,0 +1,636 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html lang='en' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'><head><title>lib/chef.rb - C0 code coverage information</title> + <style type='text/css'>body { background-color: rgb(240, 240, 245); }</style> + <style type='text/css'>span.cross-ref-title { + font-size: 140%; +} +span.cross-ref a { + text-decoration: none; +} +span.cross-ref { + background-color:#f3f7fa; + border: 1px dashed #333; + margin: 1em; + padding: 0.5em; + overflow: hidden; +} +a.crossref-toggle { + text-decoration: none; +} +span.marked0 { + background-color: rgb(185, 210, 200); + display: block; +} +span.marked1 { + background-color: rgb(190, 215, 205); + display: block; +} +span.inferred0 { + background-color: rgb(175, 200, 200); + display: block; +} +span.inferred1 { + background-color: rgb(180, 205, 205); + display: block; +} +span.uncovered0 { + background-color: rgb(225, 110, 110); + display: block; +} +span.uncovered1 { + background-color: rgb(235, 120, 120); + display: block; +} +span.overview { + border-bottom: 8px solid black; +} +div.overview { + border-bottom: 8px solid black; +} +body { + font-family: verdana, arial, helvetica; +} +div.footer { + font-size: 68%; + margin-top: 1.5em; +} +h1, h2, h3, h4, h5, h6 { + margin-bottom: 0.5em; +} +h5 { + margin-top: 0.5em; +} +.hidden { + display: none; +} +div.separator { + height: 10px; +} +/* Commented out for better readability, esp. on IE */ +/* +table tr td, table tr th { + font-size: 68%; +} +td.value table tr td { + font-size: 11px; +} +*/ +table.percent_graph { + height: 12px; + border: #808080 1px solid; + empty-cells: show; +} +table.percent_graph td.covered { + height: 10px; + background: #00f000; +} +table.percent_graph td.uncovered { + height: 10px; + background: #e00000; +} +table.percent_graph td.NA { + height: 10px; + background: #eaeaea; +} +table.report { + border-collapse: collapse; + width: 100%; +} +table.report td.heading { + background: #dcecff; + border: #d0d0d0 1px solid; + font-weight: bold; + text-align: center; +} +table.report td.heading:hover { + background: #c0ffc0; +} +table.report td.text { + border: #d0d0d0 1px solid; +} +table.report td.value, +table.report td.lines_total, +table.report td.lines_code { + text-align: right; + border: #d0d0d0 1px solid; +} +table.report tr.light { + background-color: rgb(240, 240, 245); +} +table.report tr.dark { + background-color: rgb(230, 230, 235); +} +</style> + <script type='text/javascript'> +// <![CDATA[ + function toggleCode( id ) { + if ( document.getElementById ) + elem = document.getElementById( id ); + else if ( document.all ) + elem = eval( "document.all." + id ); + else + return false; + + elemStyle = elem.style; + + if ( elemStyle.display != "block" ) { + elemStyle.display = "block" + } else { + elemStyle.display = "none" + } + + return true; + } + + // Make cross-references hidden by default + document.writeln( "<style type=\"text/css\">span.cross-ref { display: none }</style>" ) + // ]]> +</script> + <style type='text/css'>span.run0 { + background-color: rgb(178, 204, 255); + display: block; +} +span.run1 { + background-color: rgb(178, 206, 255); + display: block; +} +span.run2 { + background-color: rgb(178, 209, 255); + display: block; +} +span.run3 { + background-color: rgb(178, 211, 255); + display: block; +} +span.run4 { + background-color: rgb(178, 214, 255); + display: block; +} +span.run5 { + background-color: rgb(178, 218, 255); + display: block; +} +span.run6 { + background-color: rgb(178, 220, 255); + display: block; +} +span.run7 { + background-color: rgb(178, 223, 255); + display: block; +} +span.run8 { + background-color: rgb(178, 225, 255); + display: block; +} +span.run9 { + background-color: rgb(178, 228, 255); + display: block; +} +span.run10 { + background-color: rgb(178, 232, 255); + display: block; +} +span.run11 { + background-color: rgb(178, 234, 255); + display: block; +} +span.run12 { + background-color: rgb(178, 237, 255); + display: block; +} +span.run13 { + background-color: rgb(178, 239, 255); + display: block; +} +span.run14 { + background-color: rgb(178, 242, 255); + display: block; +} +span.run15 { + background-color: rgb(178, 246, 255); + display: block; +} +span.run16 { + background-color: rgb(178, 248, 255); + display: block; +} +span.run17 { + background-color: rgb(178, 251, 255); + display: block; +} +span.run18 { + background-color: rgb(178, 253, 255); + display: block; +} +span.run19 { + background-color: rgb(178, 255, 253); + display: block; +} +span.run20 { + background-color: rgb(178, 255, 249); + display: block; +} +span.run21 { + background-color: rgb(178, 255, 247); + display: block; +} +span.run22 { + background-color: rgb(178, 255, 244); + display: block; +} +span.run23 { + background-color: rgb(178, 255, 242); + display: block; +} +span.run24 { + background-color: rgb(178, 255, 239); + display: block; +} +span.run25 { + background-color: rgb(178, 255, 235); + display: block; +} +span.run26 { + background-color: rgb(178, 255, 233); + display: block; +} +span.run27 { + background-color: rgb(178, 255, 230); + display: block; +} +span.run28 { + background-color: rgb(178, 255, 228); + display: block; +} +span.run29 { + background-color: rgb(178, 255, 225); + display: block; +} +span.run30 { + background-color: rgb(178, 255, 221); + display: block; +} +span.run31 { + background-color: rgb(178, 255, 219); + display: block; +} +span.run32 { + background-color: rgb(178, 255, 216); + display: block; +} +span.run33 { + background-color: rgb(178, 255, 214); + display: block; +} +span.run34 { + background-color: rgb(178, 255, 211); + display: block; +} +span.run35 { + background-color: rgb(178, 255, 207); + display: block; +} +span.run36 { + background-color: rgb(178, 255, 205); + display: block; +} +span.run37 { + background-color: rgb(178, 255, 202); + display: block; +} +span.run38 { + background-color: rgb(178, 255, 200); + display: block; +} +span.run39 { + background-color: rgb(178, 255, 197); + display: block; +} +span.run40 { + background-color: rgb(178, 255, 193); + display: block; +} +span.run41 { + background-color: rgb(178, 255, 191); + display: block; +} +span.run42 { + background-color: rgb(178, 255, 188); + display: block; +} +span.run43 { + background-color: rgb(178, 255, 186); + display: block; +} +span.run44 { + background-color: rgb(178, 255, 183); + display: block; +} +span.run45 { + background-color: rgb(178, 255, 179); + display: block; +} +span.run46 { + background-color: rgb(179, 255, 178); + display: block; +} +span.run47 { + background-color: rgb(182, 255, 178); + display: block; +} +span.run48 { + background-color: rgb(184, 255, 178); + display: block; +} +span.run49 { + background-color: rgb(187, 255, 178); + display: block; +} +span.run50 { + background-color: rgb(191, 255, 178); + display: block; +} +span.run51 { + background-color: rgb(193, 255, 178); + display: block; +} +span.run52 { + background-color: rgb(196, 255, 178); + display: block; +} +span.run53 { + background-color: rgb(198, 255, 178); + display: block; +} +span.run54 { + background-color: rgb(201, 255, 178); + display: block; +} +span.run55 { + background-color: rgb(205, 255, 178); + display: block; +} +span.run56 { + background-color: rgb(207, 255, 178); + display: block; +} +span.run57 { + background-color: rgb(210, 255, 178); + display: block; +} +span.run58 { + background-color: rgb(212, 255, 178); + display: block; +} +span.run59 { + background-color: rgb(215, 255, 178); + display: block; +} +span.run60 { + background-color: rgb(219, 255, 178); + display: block; +} +span.run61 { + background-color: rgb(221, 255, 178); + display: block; +} +span.run62 { + background-color: rgb(224, 255, 178); + display: block; +} +span.run63 { + background-color: rgb(226, 255, 178); + display: block; +} +span.run64 { + background-color: rgb(229, 255, 178); + display: block; +} +span.run65 { + background-color: rgb(233, 255, 178); + display: block; +} +span.run66 { + background-color: rgb(235, 255, 178); + display: block; +} +span.run67 { + background-color: rgb(238, 255, 178); + display: block; +} +span.run68 { + background-color: rgb(240, 255, 178); + display: block; +} +span.run69 { + background-color: rgb(243, 255, 178); + display: block; +} +span.run70 { + background-color: rgb(247, 255, 178); + display: block; +} +span.run71 { + background-color: rgb(249, 255, 178); + display: block; +} +span.run72 { + background-color: rgb(252, 255, 178); + display: block; +} +span.run73 { + background-color: rgb(255, 255, 178); + display: block; +} +span.run74 { + background-color: rgb(255, 252, 178); + display: block; +} +span.run75 { + background-color: rgb(255, 248, 178); + display: block; +} +span.run76 { + background-color: rgb(255, 246, 178); + display: block; +} +span.run77 { + background-color: rgb(255, 243, 178); + display: block; +} +span.run78 { + background-color: rgb(255, 240, 178); + display: block; +} +span.run79 { + background-color: rgb(255, 238, 178); + display: block; +} +span.run80 { + background-color: rgb(255, 234, 178); + display: block; +} +span.run81 { + background-color: rgb(255, 232, 178); + display: block; +} +span.run82 { + background-color: rgb(255, 229, 178); + display: block; +} +span.run83 { + background-color: rgb(255, 226, 178); + display: block; +} +span.run84 { + background-color: rgb(255, 224, 178); + display: block; +} +span.run85 { + background-color: rgb(255, 220, 178); + display: block; +} +span.run86 { + background-color: rgb(255, 218, 178); + display: block; +} +span.run87 { + background-color: rgb(255, 215, 178); + display: block; +} +span.run88 { + background-color: rgb(255, 212, 178); + display: block; +} +span.run89 { + background-color: rgb(255, 210, 178); + display: block; +} +span.run90 { + background-color: rgb(255, 206, 178); + display: block; +} +span.run91 { + background-color: rgb(255, 204, 178); + display: block; +} +span.run92 { + background-color: rgb(255, 201, 178); + display: block; +} +span.run93 { + background-color: rgb(255, 198, 178); + display: block; +} +span.run94 { + background-color: rgb(255, 196, 178); + display: block; +} +span.run95 { + background-color: rgb(255, 192, 178); + display: block; +} +span.run96 { + background-color: rgb(255, 189, 178); + display: block; +} +span.run97 { + background-color: rgb(255, 187, 178); + display: block; +} +span.run98 { + background-color: rgb(255, 184, 178); + display: block; +} +span.run99 { + background-color: rgb(255, 182, 178); + display: block; +} +span.run100 { + background-color: rgb(255, 178, 178); + display: block; +} +</style> + </head> + <body><h3>C0 code coverage information</h3> + <p>Generated on Mon Mar 10 00:31:52 -0700 2008 with <a href='http://eigenclass.org/hiki/rcov'>rcov 0.8.1.2</a> + </p> + <hr/> + <pre><span class='marked0'>Code reported as executed by Ruby looks like this... +</span><span class='marked1'>and this: this line is also marked as covered. +</span><span class='inferred0'>Lines considered as run by rcov, but not reported by Ruby, look like this, +</span><span class='inferred1'>and this: these lines were inferred by rcov (using simple heuristics). +</span><span class='uncovered0'>Finally, here's a line marked as not executed. +</span></pre> +<table class='report'><thead><tr><td class='heading'>Name</td> + <td class='heading'>Total lines</td> + <td class='heading'>Lines of code</td> + <td class='heading'>Total coverage</td> + <td class='heading'>Code coverage</td> + </tr> + </thead> + <tbody><tr class='light'><td><a href='lib-chef_rb.html'>lib/chef.rb</a> + </td> + <td class='lines_total'><tt>26</tt> + </td> + <td class='lines_code'><tt>5</tt> + </td> + <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_total'>100.0%</tt> + </td> + <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='100'/> + <td class='uncovered' width='0'/> + </tr> + </table> + </td> + </tr> + </table> + </td> + <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_code'>100.0%</tt> + </td> + <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='100'/> + <td class='uncovered' width='0'/> + </tr> + </table> + </td> + </tr> + </table> + </td> + </tr> + </tbody> + </table> +<pre><span class="inferred1"><a name="line1"></a> 1 # Author:: Adam Jacob (<adam@hjksolutions.com>) +</span><span class="inferred0"><a name="line2"></a> 2 # Copyright:: Copyright (c) 2008 HJK Solutions, LLC +</span><span class="inferred1"><a name="line3"></a> 3 # License:: GNU General Public License version 2 or later +</span><span class="inferred0"><a name="line4"></a> 4 # +</span><span class="inferred1"><a name="line5"></a> 5 # This program and entire repository is free software; you can +</span><span class="inferred0"><a name="line6"></a> 6 # redistribute it and/or modify it under the terms of the GNU +</span><span class="inferred1"><a name="line7"></a> 7 # General Public License as published by the Free Software +</span><span class="inferred0"><a name="line8"></a> 8 # Foundation; either version 2 of the License, or any later version. +</span><span class="inferred1"><a name="line9"></a> 9 # +</span><span class="inferred0"><a name="line10"></a>10 # This program is distributed in the hope that it will be useful, +</span><span class="inferred1"><a name="line11"></a>11 # but WITHOUT ANY WARRANTY; without even the implied warranty of +</span><span class="inferred0"><a name="line12"></a>12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +</span><span class="inferred1"><a name="line13"></a>13 # GNU General Public License for more details. +</span><span class="inferred0"><a name="line14"></a>14 # +</span><span class="inferred1"><a name="line15"></a>15 # You should have received a copy of the GNU General Public License +</span><span class="inferred0"><a name="line16"></a>16 # along with this program; if not, write to the Free Software +</span><span class="inferred1"><a name="line17"></a>17 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +</span><span class="inferred0"><a name="line18"></a>18 # +</span><span class="inferred1"><a name="line19"></a>19 +</span><span class="marked0"><a name="line20"></a>20 require 'rubygems' +</span><span class="inferred1"><a name="line21"></a>21 +</span><span class="marked0"><a name="line22"></a>22 Dir[File.join(File.dirname(__FILE__), 'chef/**/*.rb')].sort.each { |lib| require lib } +</span><span class="inferred1"><a name="line23"></a>23 +</span><span class="marked0"><a name="line24"></a>24 class Chef +</span><span class="marked1"><a name="line25"></a>25 VERSION = '0.0.1' +</span><span class="inferred0"><a name="line26"></a>26 end +</span></pre><hr/> + <p>Generated using the <a href='http://eigenclass.org/hiki.rb?rcov'>rcov code coverage analysis tool for Ruby</a> + version 0.8.1.2.</p> +<p><a href='http://validator.w3.org/check/referer'><img src='http://www.w3.org/Icons/valid-xhtml10' height='31' alt='Valid XHTML 1.0!' width='88'/> + </a> + <a href='http://jigsaw.w3.org/css-validator/check/referer'><img src='http://jigsaw.w3.org/css-validator/images/vcss' alt='Valid CSS!' style='border:0;width:88px;height:31px'/> + </a> + </p> + </body> + </html> diff --git a/docs/recipe.rb b/docs/recipe.rb index 66d8b4c089..b132ff42ea 100644 --- a/docs/recipe.rb +++ b/docs/recipe.rb @@ -25,7 +25,7 @@ file "/etc/ldap.conf" do owner = "root" group = "root" mode = 0644 - requires = resources(:file => "/etc/nsswitch.conf") + requires = resources() end remote_file "nsswitch.conf" { diff --git a/examples/config.rb b/examples/config.rb new file mode 100644 index 0000000000..171554c416 --- /dev/null +++ b/examples/config.rb @@ -0,0 +1,20 @@ +# +# Example config +# + +nodes_from([ + Chef::Node::YAML => { + :search_path => [ "/etc/chef/nodes" ] + }, + Chef::Node::PuppetExternalNode => { + :command => "" + }, + :rest => { + :search_url => "http://localhost:3000/nodes/#{node_name}" + }, + :iclassify => { + :search_url => "http://localhost:3000/nodes/#{node_name}" + } +]) + + diff --git a/examples/node.rb b/examples/node.rb new file mode 100644 index 0000000000..d236e6a068 --- /dev/null +++ b/examples/node.rb @@ -0,0 +1,16 @@ +## +# Nodes should have a unique name +## +name "ops1prod" + +## +# Nodes can set arbitrary arguments +## +sunshine "in" +something "else" +that "is a cool ass trick" + +## +# Nodes should have recipes +## +recipes "operations-master", "operations-monitoring" diff --git a/examples/node.yml b/examples/node.yml new file mode 100644 index 0000000000..d61a14875d --- /dev/null +++ b/examples/node.yml @@ -0,0 +1,134 @@ +--- +parameters: + innodb_buffer_pool_size: 150M + kernel: Linux + serialnumber: 0123456789 + processorcount: "2" + operatingsystemrelease: 2.6.18-53.1.4.el5 + tinydns_ipaddress: 208.113.71.77 + rubysitedir: /usr/lib/ruby/site_ruby/1.8 + lsbrelease: ":core-3.1-amd64:core-3.1-ia32:core-3.1-noarch:graphics-3.1-amd64:graphics-3.1-ia32:graphics-3.1-noarch" + hardwaremodel: x86_64 + uniqueid: 007f0100 + ipaddress: 208.113.71.76 + swapfree: 2.00 GB + puppet_class: + - operations-master + - base + - iptables + - runit + - puppet-client + - sudo + - zsh + - subversion-client + - ruby + - man + - openssh + - build-essential + - rsync-client + - munin-node + - resolver + - iclassify-agent + - openldap-auth + - openldap-client + - nscd + - perl + - nagios-nrpe + - ntp-client + - ntp + - postfix + - emacs + - centos + - puppet-server + - mysql-server + - djbdns-server + - djbdns-base + - djbdns-public-cache + - openldap-server + - iclassify-server + - apache2 + - apache2-module-status + - apache2-module-alias + - apache2-module-auth_basic + - apache2-module-authn_file + - apache2-module-authz_default + - apache2-module-authz_groupfile + - apache2-module-authz_host + - apache2-module-authz_user + - apache2-module-autoindex + - apache2-module-dir + - apache2-module-env + - apache2-module-mime + - apache2-module-negotiation + - apache2-module-setenvif + - apache2-module-log_config + - perlbal + - mongrel-runit + - rails-twoohtwo + - mysql-client + - java + - wildcard-cert + - apache2-module-ldap + - gems-server + - operations-monitoring + - munin-moonin + - apache2-module-fcgid + - apache2-module-ssl + - apache2-module-authnz_ldap + - nagios-server + - subversion-server + - apache2-module-dav + - apache2-module-dav_svn + - trac + - apache2-module-proxy + - apache2-module-proxy_http + - apache2-module-rewrite + - apache2-module-deflate + - apache2-module-headers + puppet_env: + - prod + - prod + memorysize: "1.96" + fqdn: ops1prod.sfo.zoosk.com + kernelrelease: 2.6.18-53.1.4.el5 + ps: ps -ef + type: Node + mongrel_servers: "16" + hardwareisa: x86_64 + apache_listen_ports: + - "80" + - "443" + domain: sfo.zoosk.com + lsbdistdescription: CentOS release 5 (Final) + id: Node:1 + tinydns_internal_ipaddress: 127.0.01 + axfr_ipaddress: 208.113.71.77 + macaddress_eth0: 00:30:48:96:3D:72 + lsbdistrelease: "5" + memoryfree: 638.67 MB + manufacturer: Supermicro + sshrsakey: AAAAB3NzaC1yc2EAAAABIwAAAQEAzZBzuD14E6KJT3YKULXM9jEOIiC/efkn8+rK4yePLwDSNypfClZt8+ThUGlGQVZF0Z1kMa1hLfZD+Puhe9Vp4hMkTBmlvATiWEZduUvkZ7Fh56mnstjmwYoxkvP8FG/ItQtfNJY3UgmtdeeoVYw566P5E9HKKWFUQp5IpZBUpsttVuY/b7ro/ray1lY/bWJ7ykYVwcGWVjsM+W6N0je+mouLcDN3QJAMzMwVuf3MzagKcawvM6qPDJ2Lv6lxRiVn1HZwv+YoPS7+S0/wDl4tZo9+mDb1jdI++af27Q8hKUTjjyjlWUcHG9eDWYjMZPYbY5Qv6FWG6/fEwZ0zu+sVhQ== + lsbdistcodename: Final + slapd_type: master + macaddress_eth1: 00:30:48:96:3D:73 + productname: PDSMi + mysql_server_id: "1" + rubyversion: 1.8.5 + hostname: ops1prod + puppetversion: 0.24.1 + public_dns_cache_ipaddress: 192.168.1.110 + processor0: Intel(R) Xeon(R) CPU 3050 @ 2.13GHz + architecture: x86_64 + facterversion: 1.3.8 + swapsize: 2.00 GB + operatingsystem: CentOS + macaddress: 00:30:48:96:3D:72 + processor1: Intel(R) Xeon(R) CPU 3050 @ 2.13GHz + ec2: "false" + ipaddress_eth0: 208.113.71.76 + mongrel_port_number: "5000" + lsbdistid: CentOS + sshdsakey: AAAAB3NzaC1kc3MAAACBANC70lacMCW6+5QtqOAD7Z/GQ7ChywuX332sbZ9tk6PE6HpCy9PoEjs4MZSrYnqeXxXq2XTRwO4e9agf+6z2gzzOZP3QZj2qoVl7WgTVvvgn1c/KbKcO7/wZXKOv2qg6/vzgrgd0wYUp+1Of04uVdbxRshR2QMY7x67bKw3vvDCbAAAAFQCsW+LA/AA2JxmOCRlZC/DAZn/l4wAAAIEAi9Z1DnYg88KV4BQWGCSAdDkJ0O5maUC12GZPQUDKY+AQU+ilS9QBo3Su0Zo9rrlygNrqyVryIbH7fktz81zj410kskktT6JvUsIR5Ep6C/GTZD8+372AsVQQ+LE+Ot3PXPBntVq2uRRum9wRKul2EZ8+uOhh3gZV2l4WdEg/07sAAACANm3CUM/+grYwDg0Uv6dNgcwsQsXHxfSUbPHGVdiEuf7WjQhNgVQffEwGHOS1xvfv2nvbGFnTnTDuIOo45vhBUmbv9s7NuRhn++M8ZwL+pLAq7BbFCeP4y0WvKOTJdupiLrgVH3KGRFP0djpOagueNQr9zcscTJR3eagImkb8aPs= + ipaddress_eth1: 192.168.1.110 +classes: +- operations-master diff --git a/examples/sample_definition.rb b/examples/sample_definition.rb new file mode 100644 index 0000000000..fa4ddfe120 --- /dev/null +++ b/examples/sample_definition.rb @@ -0,0 +1,68 @@ +web_server "monchichi" do + one "something" + two "something else" +end + +define :runit_service, :directory => "/etc/sv", :downif => "/bin/false", :templatedir => nil do + require_recipe "runit" + + file "#{param[:directory]}-#{param[:name]}" do + path "#{param[:directory]}/#{param[:name]}" + insure "directory" + owner "root" + group "root" + mode 0755 + end + + file "#{param[:directory]}/#{param[:name]}/log" do + insure "directory" + owner "root" + group "root" + mode 0755 + end + + file "#{param[:directory]}/#{param[:name]}/log/main" do + insure "directory" + owner "root" + group "root" + mode 0755 + end + + symlink "/etc/init.d/#{param[:name]}" do + sv_dir = case node[:lsbdistid] + when 'CentOS': "/usr/local/bin/sv" + else: "/usr/bin/sv" + end + source_file = sv_dir + end + + symlink "/var/service/#{param[:name]}" do + source_file "#{param[:directory]}/#{param[:name]}" + end + + service "#{param[:name]}" do + has_restart true + has_status true + end + + template_file "#{param[:directory]}/#{param[:name]}/log/run" do + content "#{param[:templatedir]}/log-run.erb" + owner "root" + group "root" + mode 755 + notifies resource("service[#{param[:name]}]") + end + + template_file "#{param[:directory]}/#{param[:name]}/run" do + content "#{param[:templatedir]}/run.erb" + owner root + group root + mode 755 + notifies resource("service[#{param[:name]}]") + end + + exec "#{param[:name]}-down" do + command "/etc/init.d/#{param[:name]} down" + only_if "#{downif}" + end +end diff --git a/examples/sample_recipe.rb b/examples/sample_recipe.rb index 730d7d58ff..b48989c2bb 100644 --- a/examples/sample_recipe.rb +++ b/examples/sample_recipe.rb @@ -1,8 +1,8 @@ -include_recipe "openldap" -include_recipe "openldap::client" -include_recipe "openldap::server" -include_recipe "resolver" -include_recipe "base" +require_recipe "openldap" +require_recipe "openldap::client" +require_recipe "openldap::server" +require_recipe "resolver" +require_recipe "base" service "apache2" do insure "running" @@ -14,7 +14,7 @@ file "/etc/nsswitch.conf" do owner "root" group "root" mode 0644 - notify :restart, resources(:service => "openldap"), :immediately + notify :restart, resources(:service => "openldap"), :now end file "/etc/ldap.conf" do @@ -22,7 +22,6 @@ file "/etc/ldap.conf" do owner "root" group "root" mode 0644 - requires resources(:file => "/etc/nsswitch.conf") end file "/srv/monkey" do diff --git a/lib/marionette.rb b/lib/chef.rb index 9ad45671f8..dc61e950a0 100644 --- a/lib/marionette.rb +++ b/lib/chef.rb @@ -19,8 +19,8 @@ require 'rubygems' -Dir[File.join(File.dirname(__FILE__), 'marionette/**/*.rb')].sort.each { |lib| require lib } +Dir[File.join(File.dirname(__FILE__), 'chef/**/*.rb')].sort.each { |lib| require lib } -class Marionette +class Chef VERSION = '0.0.1' end diff --git a/lib/chef/config.rb b/lib/chef/config.rb new file mode 100644 index 0000000000..6c0402bdda --- /dev/null +++ b/lib/chef/config.rb @@ -0,0 +1,69 @@ +# +# Author:: Adam Jacob (<adam@hjksolutions.com>) +# Copyright:: Copyright (c) 2008 HJK Solutions, LLC +# License:: GNU General Public License version 2 or later +# +# This program and entire repository is free software; you can +# redistribute it and/or modify it under the terms of the GNU +# General Public License as published by the Free Software +# Foundation; either version 2 of the License, or any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# + +require File.join(File.dirname(__FILE__), "mixin", "check_helper") + +class Chef + class Config + + include Chef::Mixin::CheckHelper + + def initialize + set_defaults + end + + def self.load_file(file) + config = Chef::Config.new + if File.exists?(file) && File.readable?(file) + begin + config.instance_eval(IO.read(file), file, 1) + rescue NoMethodError => e + new_message = "You probably tried to use a config variable that doesn't exist!\n" + new_message += e.message + raise e.exception(new_message) + end + else + raise IOError, "Cannot find or read #{file}!" + end + config + end + + def cookbook_path(*args) + if args.length == 0 + @cookbook_path + else + flat_args = args.flatten + flat_args.each do |a| + unless a.kind_of?(String) + raise ArgumentError, "You must pass strings to cookbook_path!" + end + end + @cookbook_path = flat_args + end + end + + def set_defaults + @cookbook_path = [ + "/etc/chef/site-cookbook", + "/etc/chef/cookbook", + ] + end + end +end
\ No newline at end of file diff --git a/lib/marionette/mixin/check_arguments.rb b/lib/chef/mixin/check_helper.rb index ba38e3e734..a4208c7e49 100644 --- a/lib/marionette/mixin/check_arguments.rb +++ b/lib/chef/mixin/check_helper.rb @@ -17,17 +17,17 @@ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # -class Marionette +class Chef module Mixin - module CheckArguments - def check_symbol_or_string(to_check, field_name) - case to_check - when Symbol, String - true + module CheckHelper + def set_if_args(thing, arguments) + raise ArgumentError, "Must call set_if_args with a block!" unless Kernel.block_given? + if arguments != nil + yield(arguments) else - raise ArgumentError, "you must pass a symbol or string to #{field_name}!" + thing end end end end -end
\ No newline at end of file +end diff --git a/lib/chef/mixin/from_file.rb b/lib/chef/mixin/from_file.rb new file mode 100644 index 0000000000..68f614c07a --- /dev/null +++ b/lib/chef/mixin/from_file.rb @@ -0,0 +1,32 @@ +# Author:: Adam Jacob (<adam@hjksolutions.com>) +# Copyright:: Copyright (c) 2008 HJK Solutions, LLC +# License:: GNU General Public License version 2 or later +# +# This program and entire repository is free software; you can +# redistribute it and/or modify it under the terms of the GNU +# General Public License as published by the Free Software +# Foundation; either version 2 of the License, or any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# + +class Chef + module Mixin + module FromFile + def from_file(filename) + if File.exists?(filename) && File.readable?(filename) + self.instance_eval(IO.read(filename), filename, 1) + else + raise IOError, "Cannot open or read #{filename}!" + end + end + end + end +end diff --git a/lib/chef/node.rb b/lib/chef/node.rb new file mode 100644 index 0000000000..bcda384d09 --- /dev/null +++ b/lib/chef/node.rb @@ -0,0 +1,91 @@ +# +# Author:: Adam Jacob (<adam@hjksolutions.com>) +# Copyright:: Copyright (c) 2008 HJK Solutions, LLC +# License:: GNU General Public License version 2 or later +# +# This program and entire repository is free software; you can +# redistribute it and/or modify it under the terms of the GNU +# General Public License as published by the Free Software +# Foundation; either version 2 of the License, or any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# + +require File.join(File.dirname(__FILE__), "mixin", "check_helper") +require File.join(File.dirname(__FILE__), "mixin", "from_file") + +class Chef + class Node + + attr_accessor :attribute, :recipe_list + + include Chef::Mixin::CheckHelper + include Chef::Mixin::FromFile + + def initialize() + @name = nil + @attribute = Hash.new + @recipe_list = Array.new + end + + def name(arg=nil) + set_if_args(@name, arg) do |a| + case a + when String + @name = a + else + raise ArgumentError, "The nodes name must be a string" + end + end + end + + def [](attrib) + if @attribute.has_key?(attrib) + @attribute[attrib] + elsif @attribute.has_key?(attrib.to_s) + @attribute[attrib.to_s] + else + nil + end + end + + def attribute?(attrib) + result = false + result = @attribute.has_key?(attrib) + return result if result + return @attribute.has_key?(attrib.to_sym) + end + + def recipe?(recipe_name) + @recipe_list.detect { |r| r == recipe_name } ? true : false + end + + def recipes(*args) + if args.length > 0 + @recipe_list = args.flatten + else + @recipe_list + end + end + + def method_missing(symbol, *args) + if args.length != 0 + @attribute[symbol] = args.length == 1 ? args[0] : args + else + if self[symbol] + @attribute[symbol] + else + raise ArgumentError, "Attribute #{symbol.to_s} is not defined!" + end + end + end + + end +end
\ No newline at end of file diff --git a/lib/chef/recipe.rb b/lib/chef/recipe.rb new file mode 100644 index 0000000000..17d14ef0bf --- /dev/null +++ b/lib/chef/recipe.rb @@ -0,0 +1,96 @@ +# +# Author:: Adam Jacob (<adam@hjksolutions.com>) +# Copyright:: Copyright (c) 2008 HJK Solutions, LLC +# License:: GNU General Public License version 2 or later +# +# This program and entire repository is free software; you can +# redistribute it and/or modify it under the terms of the GNU +# General Public License as published by the Free Software +# Foundation; either version 2 of the License, or any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# + +require File.join(File.dirname(__FILE__), "mixin", "from_file") + +class Chef + class Recipe + + include Chef::Mixin::FromFile + + attr_accessor :module_name, :recipe_name, :recipe, :node, :collection, + :definitions, :config, :params + + def initialize(module_name, recipe_name, node, collection=nil, definitions=nil, config=nil) + @module_name = module_name + @recipe_name = recipe_name + @node = node + if collection + @collection = collection + else + @collection = Chef::ResourceCollection.new() + end + if config + @config = config + else + @config = Chef::Config.new() + end + if definitions + @definitions = definitions + else + @definitions = Hash.new + end + @params = Hash.new + end + + def resources(*args) + @collection.resources(*args) + end + + def method_missing(method_symbol, *args, &block) + resource = nil + # If we have a definition that matches, we want to use that instead. This should + # let you do some really crazy over-riding of "native" types, if you really want + # to. + if @definitions.has_key?(method_symbol) + new_def = @definitions[method_symbol].dup + new_def.instance_eval(&block) + new_recipe = Chef::Recipe.new(@module_name, @recipe_name, @node, @collection, @definitions, @config) + new_recipe.params = new_def.params + new_recipe.instance_eval(&new_def.recipe) + else + method_name = method_symbol.to_s + # Otherwise, we're rocking the regular resource call route. + rname = nil + case method_name + when /^(.+)_(.+)$/ + rname = "Chef::Resource::#{$1.capitalize}#{$2.capitalize}" + when /^(.+)$/ + rname = "Chef::Resource::#{$1.capitalize}" + end + begin + args << @collection + args << @config + resource = eval(rname).new(*args) + resource.params = @params + resource.instance_eval(&block) + rescue Exception => e + if e.kind_of?(NameError) && e.to_s =~ /Chef::Resource/ + raise NameError, "Cannot find #{rname} for #{method_name}\nOriginal: #{e.to_s}" + else + raise e + end + end + @collection << resource + resource + end + end + end +end
\ No newline at end of file diff --git a/lib/chef/resource.rb b/lib/chef/resource.rb new file mode 100644 index 0000000000..2d7b90ed7f --- /dev/null +++ b/lib/chef/resource.rb @@ -0,0 +1,123 @@ +# +# Author:: Adam Jacob (<adam@hjksolutions.com>) +# Copyright:: Copyright (c) 2008 HJK Solutions, LLC +# License:: GNU General Public License version 2 or later +# +# This program and entire repository is free software; you can +# redistribute it and/or modify it under the terms of the GNU +# General Public License as published by the Free Software +# Foundation; either version 2 of the License, or any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# + +require File.join(File.dirname(__FILE__), "mixin", "check_helper") +require 'yaml' + +class Chef + class Resource + + include Chef::Mixin::CheckHelper + + attr_accessor :tag, :actions, :config, :params + attr_reader :name, :noop, :resource_name, :collection, :notifies, :subscribes + + def initialize(name, collection=nil, config=nil) + @name = name + if collection + @collection = collection + else + @collection = Chef::ResourceCollection.new() + end + if config + @config = config + else + @config = Chef::Config.new() + end + @tag = [ name.to_s ] + @noop = nil + @before = nil + @actions = Hash.new + @params = Hash.new + end + + def name(name=nil) + set_if_args(@name, name) do + raise ArgumentError, "name must be a string!" unless name.kind_of?(String) + @name = name + end + end + + def noop(tf=nil) + set_if_args(@noop, tf) do + raise ArgumentError, "noop must be true or false!" unless tf == true || tf == false + @noop = tf + end + end + + def notifies(action, resources, timing=:delayed) + timing = check_timing(timing) + rarray = resources.kind_of?(Array) ? resources : [ resources ] + rarray.each do |resource| + action_sym = action.to_sym + if @actions.has_key?(action_sym) + @actions[action_sym][timing] << resource + else + @actions[action_sym] = Hash.new + @actions[action_sym][:delayed] = Array.new + @actions[action_sym][:immediate] = Array.new + @actions[action_sym][timing] << resource + end + end + true + end + + def resources(*args) + @collection.resources(*args) + end + + def subscribes(action, resources, timing=:delayed) + timing = check_timing(timing) + rarray = resources.kind_of?(Array) ? resources : [ resources ] + rarray.each do |resource| + action_sym = action.to_sym + if resource.actions.has_key?(action_sym) + resource.actions[action_sym][timing] << self + else + resource.actions[action_sym] = Hash.new + resource.actions[action_sym][:delayed] = Array.new + resource.actions[action_sym][:immediate] = Array.new + resource.actions[action_sym][timing] << self + end + end + true + end + + def is(*args) + return *args + end + + def to_s + "#{@resource_name}[#{@name}]" + end + + private + + def check_timing(timing) + unless timing == :delayed || timing == :immediate || timing == :immediately + raise ArgumentError, "Timing must be :delayed or :immediate(ly), you said #{timing}" + end + if timing == :immediately + timing = :immediate + end + timing + end + end +end
\ No newline at end of file diff --git a/lib/marionette/resource/file.rb b/lib/chef/resource/file.rb index f19b8f7b17..0a2edb56a5 100644 --- a/lib/marionette/resource/file.rb +++ b/lib/chef/resource/file.rb @@ -1,3 +1,4 @@ +# # Author:: Adam Jacob (<adam@hjksolutions.com>) # Copyright:: Copyright (c) 2008 HJK Solutions, LLC # License:: GNU General Public License version 2 or later @@ -17,14 +18,14 @@ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # -class Marionette +class Chef class Resource - class File < Marionette::Resource + class File < Chef::Resource attr_reader :backup, :checksum, :insure, :group, :mode, :owner, :path - def initialize(name, dg=nil, deps=nil) + def initialize(name, collection=nil, config=nil) @resource_name = :file - super(name, dg) + super(name, collection, config) @path = name @backup = true @checksum = "md5sum" diff --git a/lib/chef/resource_collection.rb b/lib/chef/resource_collection.rb new file mode 100644 index 0000000000..dc93cfb4fa --- /dev/null +++ b/lib/chef/resource_collection.rb @@ -0,0 +1,155 @@ +# +# Author:: Adam Jacob (<adam@hjksolutions.com>) +# Copyright:: Copyright (c) 2008 HJK Solutions, LLC +# License:: GNU General Public License version 2 or later +# +# This program and entire repository is free software; you can +# redistribute it and/or modify it under the terms of the GNU +# General Public License as published by the Free Software +# Foundation; either version 2 of the License, or any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# + +class Chef + class ResourceCollection + include Enumerable + + def initialize + @resources = Array.new + @resources_by_name = Hash.new + end + + def [](index) + @resources[index] + end + + def []=(index, arg) + is_chef_resource(arg) + @resources[index] = arg + @resources_by_name[arg.to_s] = index + end + + def <<(*args) + args.flatten.each do |a| + is_chef_resource(a) + @resources << a + @resources_by_name[a.to_s] = @resources.length - 1 + end + end + + def push(*args) + args.flatten.each do |a| + is_chef_resource(a) + @resources.push(a) + @resources_by_name[a.to_s] = @resources.length - 1 + end + end + + def each + @resources.each do |r| + yield r + end + end + + def each_index + @resources.each_index do |i| + yield i + end + end + + def lookup(resource) + lookup_by = nil + if resource.kind_of?(Chef::Resource) + lookup_by = resource.to_s + elsif resource.kind_of?(String) + lookup_by = resource + else + raise ArgumentError, "Must pass a Chef::Resource or String to lookup" + end + res = @resources_by_name[lookup_by] + unless res + raise ArgumentError, "Cannot find a resource matching #{lookup_by} (did you define it first?)" + end + @resources[res] + end + + # Find existing resources by searching the list of existing resources. Possible + # forms are: + # + # resources(:file => "foobar") + # resources(:file => [ "foobar", "baz" ]) + # resources("file[foobar]", "file[baz]") + # resources("file[foobar,baz]") + # + # Returns the matching resource, or an Array of matching resources. + # + # Raises an ArgumentError if you feed it bad lookup information + # Raises a Runtime Error if it can't find the resources you are looking for. + def resources(*args) + results = Array.new + args.each do |arg| + case arg + when Hash + results << find_resource_by_hash(arg) + when String + results << find_resource_by_string(arg) + else + raise ArgumentError, "resources takes arguments as a hash or strings!" + end + end + flat_results = results.flatten + flat_results.length == 1 ? flat_results[0] : flat_results + end + + private + + def find_resource_by_hash(arg) + results = Array.new + arg.each do |resource_name, name_list| + names = name_list.kind_of?(Array) ? name_list : [ name_list ] + names.each do |name| + res_name = "#{resource_name.to_s}[#{name}]" + results << lookup(res_name) + end + end + return results + end + + def find_resource_by_string(arg) + results = Array.new + case arg + when /^(.+)\[(.+?),(.+)\]$/ + resource_type = $1 + arg =~ /^.+\[(.+)\]$/ + resource_list = $1 + resource_list.split(",").each do |name| + resource_name = "#{resource_type}[#{name}]" + results << lookup(resource_name) + end + when /^(.+)\[(.+)\]$/ + resource_type = $1 + name = $2 + resource_name = "#{resource_type}[#{name}]" + results << lookup(resource_name) + else + raise ArgumentError, "You must have a string like resource_type[name]!" + end + return results + end + + def is_chef_resource(arg) + unless arg.kind_of?(Chef::Resource) + raise ArgumentError, "Members must be Chef::Resource's" + end + true + end + end +end
\ No newline at end of file diff --git a/lib/chef/resource_definition.rb b/lib/chef/resource_definition.rb new file mode 100644 index 0000000000..ddc529b7d2 --- /dev/null +++ b/lib/chef/resource_definition.rb @@ -0,0 +1,63 @@ +# +# Author:: Adam Jacob (<adam@hjksolutions.com>) +# Copyright:: Copyright (c) 2008 HJK Solutions, LLC +# License:: GNU General Public License version 2 or later +# +# This program and entire repository is free software; you can +# redistribute it and/or modify it under the terms of the GNU +# General Public License as published by the Free Software +# Foundation; either version 2 of the License, or any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# + +require File.join(File.dirname(__FILE__), "mixin", "from_file") + +class Chef + class ResourceDefinition + + include Chef::Mixin::FromFile + + attr_accessor :name, :params, :recipe + + def initialize + @name = nil + @params = Hash.new + @recipe = nil + end + + def define(resource_name, prototype_params=nil, &block) + unless resource_name.kind_of?(Symbol) + raise ArgumentError, "You must use a symbol when defining a new resource!" + end + @name = resource_name + if prototype_params + unless prototype_params.kind_of?(Hash) + raise ArgumentError, "You must pass a hash as the prototype parameters for a definition." + end + @params = prototype_params + end + if Kernel.block_given? + @recipe = block + else + raise ArgumentError, "You must pass a block to a definition." + end + true + end + + # When we do the resource definition, we're really just setting new values for + # the paramaters we prototyped at the top. This method missing is as simple as + # it gets. + def method_missing(symbol, *args) + @params[symbol] = args.length == 1 ? args[0] : args + end + + end +end
\ No newline at end of file diff --git a/lib/marionette/mixin/graph_resources.rb b/lib/marionette/mixin/graph_resources.rb deleted file mode 100644 index 7721b5d91a..0000000000 --- a/lib/marionette/mixin/graph_resources.rb +++ /dev/null @@ -1,85 +0,0 @@ -# Author:: Adam Jacob (<adam@hjksolutions.com>) -# Copyright:: Copyright (c) 2008 HJK Solutions, LLC -# License:: GNU General Public License version 2 or later -# -# This program and entire repository is free software; you can -# redistribute it and/or modify it under the terms of the GNU -# General Public License as published by the Free Software -# Foundation; either version 2 of the License, or any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -# - -require 'rubygems' -require 'rgl/adjacency' -require 'rgl/topsort' -require 'rgl/dot' - -class Marionette - module Mixin - module GraphResources - # Find existing resources by searching the list of existing resources. Takes - # a hash of :resource_name => name, or :resource_name => [ name1, name2 ]. - # - # Returns one or an Array of matching resources. - # - # Raises a Runtime Error if it can't find the resources you are looking for. - def resources(args) - unless args.kind_of?(Hash) - raise ArgumentError, "resource requires a hash of :resources => names" - end - - to_find = Array.new - args.each do |resource_name, name_matches| - names = name_matches.kind_of?(Array) ? name_matches : [ name_matches ] - names.each do |name| - to_find.push({ - :resource_name => resource_name, - :name => name, - :found => false, - :object => nil} - ) - end - end - - @dg.each_vertex do |vres| - next if vres == :top - to_find.each do |resource| - if vres.resource_name == resource[:resource_name] - if vres.name == resource[:name] - resource[:found] = true - resource[:object] = vres - break - end - end - end - end - - results = Array.new - errors = Array.new - to_find.each do |r| - if r[:found] - results.push(r) - else - errors.push(r) - end - end - if errors.length > 0 - msg = "Cannot find resources (maybe not evaluated yet?):\n" - errors.each do |e| - msg << " #{e[:resource_name].to_s}: #{e[:name].to_s}\n" - end - raise RuntimeError, msg - end - results.length == 1 ? results[0][:object] : results.collect { |r| r[:object] } - end - end - end -end diff --git a/lib/marionette/recipe.rb b/lib/marionette/recipe.rb deleted file mode 100644 index e008400d55..0000000000 --- a/lib/marionette/recipe.rb +++ /dev/null @@ -1,74 +0,0 @@ -# -# Author:: Adam Jacob (<adam@hjksolutions.com>) -# Copyright:: Copyright (c) 2008 HJK Solutions, LLC -# License:: GNU General Public License version 2 or later -# -# This program and entire repository is free software; you can -# redistribute it and/or modify it under the terms of the GNU -# General Public License as published by the Free Software -# Foundation; either version 2 of the License, or any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -# - -class Marionette - class Recipe - - include Marionette::Mixin::GraphResources - - attr_accessor :module_name, :recipe_name, :recipe, :node, :dg, :deps - - def initialize(module_name, recipe_name, node, dg=nil, deps=nil) - @module_name = module_name - @recipe_name = recipe_name - @node = node - if dg - @dg = dg - else - @dg = RGL::DirectedAdjacencyGraph.new() - @dg.add_vertex(:top) - end - if deps - @deps = deps - else - @deps = RGL::DirectedAdjacencyGraph.new() - end - @last_resource = :top - @in_order = Array.new - end - - def method_missing(method_symbol, *args, &block) - method_name = method_symbol.to_s - resource = nil - rname = nil - case method_name - when /^(.+)_(.+)$/ - rname = "Marionette::Resource::#{$1.capitalize}#{$2.capitalize}" - when /^(.+)$/ - rname = "Marionette::Resource::#{$1.capitalize}" - end - begin - args << @dg - args << @deps - resource = eval(rname).new(*args) - resource.instance_eval(&block) - rescue Exception => e - if e.kind_of?(NameError) && e.to_s =~ /Marionette::Resource/ - raise NameError, "Cannot find #{rname} for #{method_name}\nOriginal: #{e.to_s}" - else - raise e - end - end - @dg.add_vertex(resource) - @dg.add_edge(@last_resource, resource) - @last_resource = resource - end - end -end
\ No newline at end of file diff --git a/lib/marionette/resource.rb b/lib/marionette/resource.rb deleted file mode 100644 index 3100c2d7cb..0000000000 --- a/lib/marionette/resource.rb +++ /dev/null @@ -1,154 +0,0 @@ -# Author:: Adam Jacob (<adam@hjksolutions.com>) -# Copyright:: Copyright (c) 2008 HJK Solutions, LLC -# License:: GNU General Public License version 2 or later -# -# This program and entire repository is free software; you can -# redistribute it and/or modify it under the terms of the GNU -# General Public License as published by the Free Software -# Foundation; either version 2 of the License, or any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -# - -require 'rubygems' -require 'yaml' - -class Marionette - class Resource - - include Marionette::Mixin::GraphResources - - attr_accessor :tag, :actions - attr_reader :name, :noop, :tag, :resource_name, :dg, :deps, :notifies, :subscribes - - def initialize(name, dg=nil, deps=nil) - @name = name - if dg - @dg = dg - else - @dg = RGL::DirectedAdjacencyGraph.new() - end - if deps - @deps = deps - else - @deps = RGL::DirectedAdjacencyGraph.new() - end - @tag = [ name.to_s ] - @noop = nil - @tag = nil - @before = nil - @actions = Hash.new - end - - def name(name=nil) - set_if_args(@name, name) do - raise ArgumentError, "name must be a string!" unless name.kind_of?(String) - @name = name - end - end - - def noop(tf=nil) - set_if_args(@noop, tf) do - raise ArgumentError, "noop must be true or false!" unless tf == true || tf == false - @noop = tf - end - end - - def requires(resources=nil) - rarray = resources.kind_of?(Array) ? resources : [ resources ] - rarray.each do |resource| - @deps.add_vertex(self) - @deps.add_vertex(resource) - @deps.add_edge(resource, self) - end - true - end - - def before(resources) - rarray = resources.kind_of?(Array) ? resources : [ resources ] - rarray.each do |resource| - @deps.add_vertex(self) - @deps.add_vertex(resource) - @deps.add_edge(self, resource) - end - true - end - - def notifies(*notify_actions) - resources = notify_actions.pop - rarray = resources.kind_of?(Array) ? resources : [ resources ] - rarray.each do |resource| - @deps.add_vertex(self) - @deps.add_vertex(resource) - @deps.add_edge(self, resource) - notify_actions.each do |action| - action_sym = action.to_sym - if @actions.has_key?(action_sym) - @actions[action_sym] << resource - else - @actions[action_sym] = [ resource ] - end - end - end - true - end - - def subscribes(*subscribe_actions) - resources = subscribe_actions.pop - rarray = resources.kind_of?(Array) ? resources : [ resources ] - rarray.each do |resource| - @deps.add_vertex(self) - @deps.add_vertex(resource) - @deps.add_edge(resource, self) - subscribe_actions.each do |action| - action_sym = action.to_sym - if @actions.has_key?(action_sym) - resource.actions[action_sym] << self - else - resource.actions[action_sym] = [ self ] - end - end - end - true - end - - def tag(args=nil) - set_if_args(@tag, args) do - if args.kind_of?(Array) - args.each do |t| - @tag << t - end - else - @tag << args - end - @tag - end - end - - def to_s - "#{@resource_name} #{@name}" - end - - def valid?() - return false unless self.name - true - end - - private - def set_if_args(thing, arguments) - raise ArgumentError, "Must call set_if_args with a block!" unless Kernel.block_given? - if arguments != nil - yield(arguments) - else - thing - end - end - end -end
\ No newline at end of file diff --git a/spec/data/bad-config.rb b/spec/data/bad-config.rb new file mode 100644 index 0000000000..5477a69366 --- /dev/null +++ b/spec/data/bad-config.rb @@ -0,0 +1 @@ +monkey_soup("tastes nice")
\ No newline at end of file diff --git a/spec/data/config.rb b/spec/data/config.rb new file mode 100644 index 0000000000..2b1fcdc341 --- /dev/null +++ b/spec/data/config.rb @@ -0,0 +1,6 @@ +# +# Sample Chef Config File +# + +cookbook_path = "/etc/chef/cookbook", "/etc/chef/site-cookbook" + diff --git a/spec/data/cookbooks/openldap/variables/default.rb b/spec/data/cookbooks/openldap/variables/default.rb new file mode 100644 index 0000000000..d5ef90f6c4 --- /dev/null +++ b/spec/data/cookbooks/openldap/variables/default.rb @@ -0,0 +1,11 @@ + +case chef_env +when "prod" + ldap_server "ops1prod" + ldap_basedn "dc=hjksolutions,dc=com" + ldap_replication_password "RiotAct" +when "corp" + ldap_server "ops1prod" + ldap_basedn "dc=hjksolutions,dc=com" + ldap_replication_password "KickingMeDown" +end diff --git a/spec/data/definitions/test.rb b/spec/data/definitions/test.rb new file mode 100644 index 0000000000..b0d0effc27 --- /dev/null +++ b/spec/data/definitions/test.rb @@ -0,0 +1,5 @@ +define :rico_suave, :rich => "smooth" do + zen_master "test" do + something "#{params[:rich]}" + end +end
\ No newline at end of file diff --git a/spec/data/nodes/test.rb b/spec/data/nodes/test.rb new file mode 100644 index 0000000000..d1288779f6 --- /dev/null +++ b/spec/data/nodes/test.rb @@ -0,0 +1,15 @@ +## +# Nodes should have a unique name +## +name "ops1prod" + +## +# Nodes can set arbitrary arguments +## +sunshine "in" +something "else" + +## +# Nodes should have recipes +## +recipes "operations-master", "operations-monitoring" diff --git a/spec/data/recipes/test.rb b/spec/data/recipes/test.rb new file mode 100644 index 0000000000..ce79f7109f --- /dev/null +++ b/spec/data/recipes/test.rb @@ -0,0 +1,7 @@ + +file "/etc/nsswitch.conf" do + insure "present" + owner "root" + group "root" + mode 0644 +end diff --git a/spec/lib/chef/resource/cat.rb b/spec/lib/chef/resource/cat.rb new file mode 100644 index 0000000000..d9f3c657e0 --- /dev/null +++ b/spec/lib/chef/resource/cat.rb @@ -0,0 +1,39 @@ +# Author:: Adam Jacob (<adam@hjksolutions.com>) +# Copyright:: Copyright (c) 2008 HJK Solutions, LLC +# License:: GNU General Public License version 2 or later +# +# This program and entire repository is free software; you can +# redistribute it and/or modify it under the terms of the GNU +# General Public License as published by the Free Software +# Foundation; either version 2 of the License, or any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# + +class Chef + class Resource + class Cat < Chef::Resource + + def initialize(name, collection=nil, config=nil) + @resource_name = :cat + super(name, collection, config) + end + + def pretty_kitty(arg=nil) + set_if_args(@pretty_kitty, arg) do + case arg + when true, false + @pretty_kitty = arg + end + end + end + end + end +end
\ No newline at end of file diff --git a/spec/lib/marionette/resource/zen_master.rb b/spec/lib/chef/resource/zen_master.rb index 31b300d841..3559b3272c 100644 --- a/spec/lib/marionette/resource/zen_master.rb +++ b/spec/lib/chef/resource/zen_master.rb @@ -17,14 +17,14 @@ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # -class Marionette +class Chef class Resource - class ZenMaster < Marionette::Resource + class ZenMaster < Chef::Resource attr_reader :peace - def initialize(name, dg=nil, deps=nil) + def initialize(name, collection=nil, config=nil) @resource_name = :zen_master - super(name, dg) + super(name, collection, config) end def peace(tf) diff --git a/spec/rcov.opts b/spec/rcov.opts new file mode 100644 index 0000000000..88fa154776 --- /dev/null +++ b/spec/rcov.opts @@ -0,0 +1,2 @@ +--exclude +spec,bin,/Library/Ruby/Gems/1.8/gems/rcov-0.8.1.2.0/lib/rcov.rb diff --git a/spec/spec.opts b/spec/spec.opts index f94cf2d923..3725faa2b2 100644 --- a/spec/spec.opts +++ b/spec/spec.opts @@ -1,5 +1,5 @@ --color --format -progress +specdoc --loadby mtime diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 452da0c2a3..a57179cdd2 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -17,6 +17,6 @@ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # -require File.join(File.dirname(__FILE__), "..", "lib", "marionette") +require File.join(File.dirname(__FILE__), "..", "lib", "chef") Dir[File.join(File.dirname(__FILE__), 'lib', '**', '*.rb')].sort.each { |lib| require lib } diff --git a/spec/unit/marionette_spec.rb b/spec/unit/chef_spec.rb index 7c76c8baeb..a75e3ad548 100644 --- a/spec/unit/marionette_spec.rb +++ b/spec/unit/chef_spec.rb @@ -20,8 +20,8 @@ require File.join(File.dirname(__FILE__), "..", "spec_helper") -describe Marionette do +describe Chef do it "should have a version defined" do - Marionette::VERSION.should match(/(\d+)\.(\d+)\.(\d+)/) + Chef::VERSION.should match(/(\d+)\.(\d+)\.(\d+)/) end end
\ No newline at end of file diff --git a/spec/unit/node.rb b/spec/unit/compile_spec.rb index 57c8cdd7f1..1a986b8f44 100644 --- a/spec/unit/node.rb +++ b/spec/unit/compile_spec.rb @@ -1,3 +1,4 @@ +# # Author:: Adam Jacob (<adam@hjksolutions.com>) # Copyright:: Copyright (c) 2008 HJK Solutions, LLC # License:: GNU General Public License version 2 or later @@ -19,25 +20,26 @@ require File.join(File.dirname(__FILE__), "..", "spec_helper") -describe Marionette::Node do - before(:each) do - @node = Marionette::Node.new("latte") - end - - it "should have a name" do - @resource.name.should eql("latte") - end - - it "should create a new Marionette::Node" do - @resource.should be_a_kind_of(Marionette::Node) - end - - it "should not be valid without a name" do - lambda { @resource.name = nil }.should raise_error(ArgumentError) - end - - it "should always have a string for name" do - lambda { @resource.name = Hash.new }.should raise_error(ArgumentError) - end - -end
\ No newline at end of file +# describe Chef::Compile do +# before(:each) do +# config = Chef::Config.new +# config.cookbook_path = [ File.join(File.dirname(__FILE__), "..", "cookbooks") ] +# @compile = Chef::Compile.new(config) +# end +# +# it "should require a node object to compile" do +# +# end +# +# it "should load up all variables" do +# +# end +# +# it "should load up all definitions" do +# +# end +# +# it "should load up all recipes" do +# +# end +# end
\ No newline at end of file diff --git a/spec/unit/config_spec.rb b/spec/unit/config_spec.rb new file mode 100644 index 0000000000..dec94796e0 --- /dev/null +++ b/spec/unit/config_spec.rb @@ -0,0 +1,72 @@ +# +# Author:: Adam Jacob (<adam@hjksolutions.com>) +# Copyright:: Copyright (c) 2008 HJK Solutions, LLC +# License:: GNU General Public License version 2 or later +# +# This program and entire repository is free software; you can +# redistribute it and/or modify it under the terms of the GNU +# General Public License as published by the Free Software +# Foundation; either version 2 of the License, or any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# + +require File.join(File.dirname(__FILE__), "..", "spec_helper") + +describe Chef::Config do + before(:each) do + @config = Chef::Config.new + end + + it "should load a .rb file in context" do + lambda { + Chef::Config.load_file(File.join(File.dirname(__FILE__), "..", "data", "config.rb")) + }.should_not raise_error + end + + it "should raise a NoMethodError with an explanation if you have a bad config file" do + lambda { + Chef::Config.load_file(File.join(File.dirname(__FILE__), "..", "data", "bad-config.rb")) + }.should raise_error(NoMethodError) + end + + it "should raise an IOError if it can't find the file" do + lambda { + Chef::Config.load_file("/tmp/timmytimmytimmy") + }.should raise_error(IOError) + end + + it "should have a default cookbook_path" do + @config.cookbook_path.should be_kind_of(Array) + end + + it "should allow you to set a cookbook_path with a string" do + @config.cookbook_path("/etc/chef/cookbook") + @config.cookbook_path.should eql(["/etc/chef/cookbook"]) + end + + it "should allow you to set a cookbook_path with multiple strings" do + @config.cookbook_path("/etc/chef/cookbook", "/etc/chef/upstream-cookbooks") + @config.cookbook_path.should eql([ + "/etc/chef/cookbook", + "/etc/chef/upstream-cookbooks" + ]) + end + + it "should allow you to set a cookbook_path with an array" do + @config.cookbook_path ["one", "two"] + @config.cookbook_path.should eql(["one", "two"]) + end + + it "should not allow you to set a cookbook_path with anything else" do + lambda { @config.cookbook_path :symbol }.should raise_error(ArgumentError) + end + +end
\ No newline at end of file diff --git a/spec/unit/mixin/graph_resources_spec.rb b/spec/unit/mixin/graph_resources_spec.rb deleted file mode 100644 index 9fbb4f4c3e..0000000000 --- a/spec/unit/mixin/graph_resources_spec.rb +++ /dev/null @@ -1,41 +0,0 @@ -# -# Author:: Adam Jacob (<adam@hjksolutions.com>) -# Copyright:: Copyright (c) 2008 HJK Solutions, LLC -# License:: GNU General Public License version 2 or later -# -# This program and entire repository is free software; you can -# redistribute it and/or modify it under the terms of the GNU -# General Public License as published by the Free Software -# Foundation; either version 2 of the License, or any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -# - -require File.join(File.dirname(__FILE__), "..", "..", "spec_helper") - -describe Marionette::Mixin::GraphResources do - it "should find a resource by symbol and name, or array of names" do - @recipe = Marionette::Recipe.new("one", "two", "three") - %w{monkey dog cat}.each do |name| - @recipe.zen_master name do - peace = true - end - end - doggie = @recipe.resources(:zen_master => "dog") - doggie.name.should eql("dog") # clever, I know - multi_zen = [ "dog", "monkey" ] - zen_array = @recipe.resources(:zen_master => multi_zen) - zen_array.length.should eql(2) - zen_array.each_index do |i| - zen_array[i].name.should eql(multi_zen[i]) - zen_array[i].resource_name.should eql(:zen_master) - end - end -end
\ No newline at end of file diff --git a/spec/unit/node_spec.rb b/spec/unit/node_spec.rb new file mode 100644 index 0000000000..e5a92486e5 --- /dev/null +++ b/spec/unit/node_spec.rb @@ -0,0 +1,108 @@ +# +# Author:: Adam Jacob (<adam@hjksolutions.com>) +# Copyright:: Copyright (c) 2008 HJK Solutions, LLC +# License:: GNU General Public License version 2 or later +# +# This program and entire repository is free software; you can +# redistribute it and/or modify it under the terms of the GNU +# General Public License as published by the Free Software +# Foundation; either version 2 of the License, or any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# + +require File.join(File.dirname(__FILE__), "..", "spec_helper") + +describe Chef::Node do + before(:each) do + @node = Chef::Node.new() + end + + it "should create a new Chef::Node" do + @node.should be_a_kind_of(Chef::Node) + end + + it "should allow you to set a name with name(something)" do + lambda { @node.name("latte") }.should_not raise_error + end + + it "should return the name with name()" do + @node.name("latte") + @node.name.should eql("latte") + end + + it "should always have a string for name" do + lambda { @node.name(Hash.new) }.should raise_error(ArgumentError) + end + + it "should have attributes" do + @node.attribute.should be_a_kind_of(Hash) + end + + it "should allow attributes to be accessed by name or symbol directly on node[]" do + @node.attribute["locust"] = "something" + @node[:locust].should eql("something") + @node["locust"].should eql("something") + end + + it "should return nil if it cannot find an attribute with node[]" do + @node["secret"].should eql(nil) + end + + it "should allow you to query whether an attribute exists with attribute?" do + @node.attribute["locust"] = "something" + @node.attribute?("locust").should eql(true) + @node.attribute?("no dice").should eql(false) + end + + it "should have an array of recipes that should be applied" do + @node.recipes.should be_a_kind_of(Array) + end + + it "should allow you to query whether or not it has a recipe applied with recipe?" do + @node.recipes << "sunrise" + @node.recipe?("sunrise").should eql(true) + @node.recipe?("not at home").should eql(false) + end + + it "should allow you to set recipes with arguments" do + @node.recipes "one", "two" + @node.recipe?("one").should eql(true) + @node.recipe?("two").should eql(true) + end + + it "should allow you to set an attribute via method_missing" do + @node.sunshine "is bright" + @node.attribute[:sunshine].should eql("is bright") + end + + it "should allow you get get an attribute via method_missing" do + @node.sunshine "is bright" + @node.sunshine.should eql("is bright") + end + + it "should raise an ArgumentError if you ask for an attribute that doesn't exist via method_missing" do + lambda { @node.sunshine }.should raise_error(ArgumentError) + end + + it "should load a node from a ruby file" do + @node.from_file(File.join(File.dirname(__FILE__), "..", "data", "nodes", "test.rb")) + @node.name.should eql("ops1prod") + @node.sunshine.should eql("in") + @node.something.should eql("else") + @node.recipes.should eql(["operations-master", "operations-monitoring"]) + end + + it "should raise an exception if the file cannot be found or read" do + lambda { @node.from_file("/tmp/monkeydiving") }.should raise_error(IOError) + end + + +end
\ No newline at end of file diff --git a/spec/unit/recipe_spec.rb b/spec/unit/recipe_spec.rb index 69f70e6862..11080a2d82 100644 --- a/spec/unit/recipe_spec.rb +++ b/spec/unit/recipe_spec.rb @@ -1,3 +1,4 @@ +# # Author:: Adam Jacob (<adam@hjksolutions.com>) # Copyright:: Copyright (c) 2008 HJK Solutions, LLC # License:: GNU General Public License version 2 or later @@ -19,50 +20,69 @@ require File.join(File.dirname(__FILE__), "..", "spec_helper") -describe Marionette::Recipe do +describe Chef::Recipe do before(:each) do - @recipe = Marionette::Recipe.new("hjk", "test", "node") + @recipe = Chef::Recipe.new("hjk", "test", "node") end - it "should load our zen_master resource" do + it "should load a two word (zen_master) resource" do lambda do @recipe.zen_master "monkey" do - peace = true + peace true + end + end.should_not raise_error(ArgumentError) + end + + it "should load a one word (cat) resource" do + lambda do + @recipe.cat "loulou" do + pretty_kitty true end end.should_not raise_error(ArgumentError) end - it "should add our zen_master as a vertex" do + it "should throw an error if you access a resource that we can't find" do + lambda { @recipe.not_home { || } }.should raise_error(NameError) + end + + it "should allow regular errors (not NameErrors) to pass unchanged" do + lambda { + @recipe.cat { || raise ArgumentError, "You Suck" } + }.should raise_error(ArgumentError) + end + + it "should add our zen_master to the collection" do @recipe.zen_master "monkey" do - peace = true - end - @recipe.dg.each_vertex do |v| - next if v == :top - v.should be_kind_of(Marionette::Resource::ZenMaster) + peace true end + @recipe.collection.lookup("zen_master[monkey]").name.should eql("monkey") end - it "should graph our zen masters in the order they appear" do + it "should add our zen masters to the collection in the order they appear" do %w{monkey dog cat}.each do |name| @recipe.zen_master name do - peace = true + peace true end end - index = 0 - @recipe.dg.topsort_iterator do |v| - case v - when :top - index.should eql(0) - when v.name == "monkey" - index.should eql(1) - when v.name == "dog" - index.should eql(2) - when v.name == "cat" - index.should eql(3) + @recipe.collection.each_index do |i| + case i + when 0 + @recipe.collection[i].name.should eql("monkey") + when 1 + @recipe.collection[i].name.should eql("dog") + when 2 + @recipe.collection[i].name.should eql("cat") end - index += 1 end end + + it "should return the new resource after creating it" do + res = @recipe.zen_master "makoto" do + peace true + end + res.resource_name.should eql(:zen_master) + res.name.should eql("makoto") + end it "should handle an instance_eval properly" do code = <<-CODE @@ -73,5 +93,35 @@ CODE lambda { @recipe.instance_eval(code) }.should_not raise_error @recipe.resources(:zen_master => "gnome").name.should eql("gnome") end + + it "should execute defined resources" do + crow_define = Chef::ResourceDefinition.new + crow_define.define :crow, :peace => false, :something => true do + zen_master "lao tzu" do + peace params[:peace] + something params[:something] + end + end + @recipe.definitions[:crow] = crow_define + @recipe.crow "mine" do + peace true + end + @recipe.resources(:zen_master => "lao tzu").name.should eql("lao tzu") + @recipe.resources(:zen_master => "lao tzu").something.should eql(true) + end + + it "should load a node from a ruby file" do + @recipe.from_file(File.join(File.dirname(__FILE__), "..", "data", "recipes", "test.rb")) + res = @recipe.resources(:file => "/etc/nsswitch.conf") + res.name.should eql("/etc/nsswitch.conf") + res.insure.should eql("present") + res.owner.should eql("root") + res.group.should eql("root") + res.mode.should eql(0644) + end + + it "should raise an exception if the file cannot be found or read" do + lambda { @recipe.from_file("/tmp/monkeydiving") }.should raise_error(IOError) + end end
\ No newline at end of file diff --git a/spec/unit/resource/file_spec.rb b/spec/unit/resource/file_spec.rb index 62b6498473..85aaac1311 100644 --- a/spec/unit/resource/file_spec.rb +++ b/spec/unit/resource/file_spec.rb @@ -19,15 +19,15 @@ require File.join(File.dirname(__FILE__), "..", "..", "spec_helper") -describe Marionette::Resource::File do +describe Chef::Resource::File do before(:each) do - @resource = Marionette::Resource::File.new("fakey_fakerton") + @resource = Chef::Resource::File.new("fakey_fakerton") end - it "should create a new Marionette::Resource::File" do - @resource.should be_a_kind_of(Marionette::Resource) - @resource.should be_a_kind_of(Marionette::Resource::File) + it "should create a new Chef::Resource::File" do + @resource.should be_a_kind_of(Chef::Resource) + @resource.should be_a_kind_of(Chef::Resource::File) end it "should have a name" do diff --git a/spec/unit/resource_collection_spec.rb b/spec/unit/resource_collection_spec.rb new file mode 100644 index 0000000000..6f6f195513 --- /dev/null +++ b/spec/unit/resource_collection_spec.rb @@ -0,0 +1,173 @@ +# Author:: Adam Jacob (<adam@hjksolutions.com>) +# Copyright:: Copyright (c) 2008 HJK Solutions, LLC +# License:: GNU General Public License version 2 or later +# +# This program and entire repository is free software; you can +# redistribute it and/or modify it under the terms of the GNU +# General Public License as published by the Free Software +# Foundation; either version 2 of the License, or any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# + +require File.join(File.dirname(__FILE__), "..", "spec_helper") + +describe Chef::ResourceCollection do + + before(:each) do + @rc = Chef::ResourceCollection.new() + @resource = Chef::Resource::ZenMaster.new("makoto") + end + + it "should return a Chef::ResourceCollection" do + @rc.should be_kind_of(Chef::ResourceCollection) + end + + it "should accept Chef::Resources" do + lambda { @rc[0] = @resource }.should_not raise_error + lambda { @rc[0] = "string" }.should raise_error + end + + it "should accept Chef::Resources through pushing" do + lambda { @rc.push(@resource) }.should_not raise_error + lambda { @rc.push("string") }.should raise_error + end + + it "should allow you to fetch Chef::Resources by position" do + @rc[0] = @resource + @rc[0].should eql(@resource) + end + + it "should accept the << operator" do + lambda { @rc << @resource }.should_not raise_error + end + + it "should allow you to iterate over every resource in the collection" do + load_up_resources + results = Array.new + lambda { + @rc.each do |r| + results << r.name + end + }.should_not raise_error + results.each_index do |i| + case i + when 0 + results[i].should eql("dog") + when 1 + results[i].should eql("cat") + when 2 + results[i].should eql("monkey") + end + end + end + + it "should allow you to iterate over every resource by index" do + load_up_resources + results = Array.new + lambda { + @rc.each_index do |i| + results << @rc[i].name + end + }.should_not raise_error() + results.each_index do |i| + case i + when 0 + results[i].should eql("dog") + when 1 + results[i].should eql("cat") + when 2 + results[i].should eql("monkey") + end + end + end + + it "should allow you to find resources by name via lookup" do + zmr = Chef::Resource::ZenMaster.new("dog") + @rc << zmr + @rc.lookup(zmr.to_s).should eql(zmr) + + zmr = Chef::Resource::ZenMaster.new("cat") + @rc[0] = zmr + @rc.lookup(zmr).should eql(zmr) + + zmr = Chef::Resource::ZenMaster.new("monkey") + @rc.push(zmr) + @rc.lookup(zmr).should eql(zmr) + end + + it "should raise an exception if you send something strange to lookup" do + lambda { @rc.lookup(:symbol) }.should raise_error(ArgumentError) + end + + it "should raise an exception if it cannot find a resource with lookup" do + lambda { @rc.lookup("zen_master[dog]") }.should raise_error(ArgumentError) + end + + it "should find a resource by symbol and name (:zen_master => monkey)" do + load_up_resources + @rc.resources(:zen_master => "monkey").name.should eql("monkey") + end + + it "should find a resource by symbol and array of names (:zen_master => [a,b])" do + load_up_resources + results = @rc.resources(:zen_master => [ "monkey", "dog" ]) + results.length.should eql(2) + check_by_names(results, "monkey", "dog") + end + + it "should find resources of multiple kinds (:zen_master => a, :file => b)" do + load_up_resources + results = @rc.resources(:zen_master => "monkey", :file => "something") + results.length.should eql(2) + check_by_names(results, "monkey", "something") + end + + it "should find a resource by string zen_master[a]" do + load_up_resources + @rc.resources("zen_master[monkey]").name.should eql("monkey") + end + + it "should find resources by strings of zen_master[a,b]" do + load_up_resources + results = @rc.resources("zen_master[monkey,dog]") + results.length.should eql(2) + check_by_names(results, "monkey", "dog") + end + + it "should find resources of multiple types by strings of zen_master[a]" do + load_up_resources + results = @rc.resources("zen_master[monkey]", "file[something]") + results.length.should eql(2) + check_by_names(results, "monkey", "something") + end + + it "should raise an exception if you pass a bad name to resources" do + lambda { @rc.resources("michael jackson") }.should raise_error(ArgumentError) + end + + it "should raise an exception if you pass something other than a string or hash to resource" do + lambda { @rc.resources([Array.new]) }.should raise_error(ArgumentError) + end + + def check_by_names(results, *names) + names.each do |res_name| + results.detect{ |res| res.name == res_name }.should_not eql(nil) + end + end + + def load_up_resources + %w{dog cat monkey}.each do |n| + @rc << Chef::Resource::ZenMaster.new(n) + end + @rc << Chef::Resource::File.new("something") + end + +end
\ No newline at end of file diff --git a/spec/unit/resource_definition_spec.rb b/spec/unit/resource_definition_spec.rb new file mode 100644 index 0000000000..8bcd9c52f9 --- /dev/null +++ b/spec/unit/resource_definition_spec.rb @@ -0,0 +1,85 @@ +# +# Author:: Adam Jacob (<adam@hjksolutions.com>) +# Copyright:: Copyright (c) 2008 HJK Solutions, LLC +# License:: GNU General Public License version 2 or later +# +# This program and entire repository is free software; you can +# redistribute it and/or modify it under the terms of the GNU +# General Public License as published by the Free Software +# Foundation; either version 2 of the License, or any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# + +require File.join(File.dirname(__FILE__), "..", "spec_helper") + +describe Chef::ResourceDefinition do + before(:each) do + @def = Chef::ResourceDefinition.new() + end + + it "should accept a new definition with a symbol for a name" do + lambda { + @def.define :smoke do + end + }.should_not raise_error(ArgumentError) + lambda { + @def.define "george washington" do + end + }.should raise_error(ArgumentError) + @def.name.should eql(:smoke) + end + + it "should accept a new definition with a hash" do + lambda { + @def.define :smoke, :cigar => "cuban", :cigarette => "marlboro" do + end + }.should_not raise_error(ArgumentError) + end + + it "should expose the prototype hash params in the params hash" do + @def.define :smoke, :cigar => "cuban", :cigarette => "marlboro" do + end + @def.params[:cigar].should eql("cuban") + @def.params[:cigarette].should eql("marlboro") + end + + it "should store the block passed to define as a proc under recipe" do + @def.define :smoke do + "I am what I am" + end + @def.recipe.should be_a_kind_of(Proc) + @def.recipe.call.should eql("I am what I am") + end + + it "should set paramaters based on method_missing" do + @def.mind "to fly" + @def.params[:mind].should eql("to fly") + end + + it "should raise an exception if prototype_params is not a hash" do + lambda { + @def.define :monkey, Array.new do + end + }.should raise_error(ArgumentError) + end + + it "should raise an exception if define is called without a block" do + lambda { + @def.define :monkey + }.should raise_error(ArgumentError) + end + + it "should load a description from a file" do + @def.from_file(File.join(File.dirname(__FILE__), "..", "data", "definitions", "test.rb")) + @def.name.should eql(:rico_suave) + @def.params[:rich].should eql("smooth") + end +end
\ No newline at end of file diff --git a/spec/unit/resource_spec.rb b/spec/unit/resource_spec.rb index ccabda6043..f767fe8348 100644 --- a/spec/unit/resource_spec.rb +++ b/spec/unit/resource_spec.rb @@ -1,3 +1,4 @@ +# # Author:: Adam Jacob (<adam@hjksolutions.com>) # Copyright:: Copyright (c) 2008 HJK Solutions, LLC # License:: GNU General Public License version 2 or later @@ -19,17 +20,22 @@ require File.join(File.dirname(__FILE__), "..", "spec_helper") -describe Marionette::Resource do +describe Chef::Resource do before(:each) do - @resource = Marionette::Resource.new("funk") + @resource = Chef::Resource.new("funk") end + it "should create a new Chef::Resource" do + @resource.should be_a_kind_of(Chef::Resource) + end + it "should have a name" do @resource.name.should eql("funk") end - it "should create a new Marionette::Resource" do - @resource.should be_a_kind_of(Marionette::Resource) + it "should let you set a new name" do + @resource.name "monkey" + @resource.name.should eql("monkey") end it "should not be valid without a name" do @@ -46,69 +52,87 @@ describe Marionette::Resource do lambda { @resource.noop "eat it" }.should raise_error(ArgumentError) end - it "should make itself dependent on required resources" do - lambda { - @resource.dg.add_vertex(Marionette::Resource::ZenMaster.new("coffee")) - }.should_not raise_error - lambda { - @resource.requires @resource.resources(:zen_master => "coffee") - }.should_not raise_error - - @resource.deps.topsort_iterator.to_a[0].name.should eql("coffee") - @resource.deps.topsort_iterator.to_a[1].name.should eql("funk") + it "should make notified resources appear in the actions hash" do + @resource.collection << Chef::Resource::ZenMaster.new("coffee") + @resource.notifies :reload, @resource.resources(:zen_master => "coffee") + @resource.actions[:reload][:delayed][0].name.should eql("coffee") end - it "should make before resources appear later in the graph" do - lambda { - @resource.dg.add_vertex(Marionette::Resource::ZenMaster.new("coffee")) - }.should_not raise_error - lambda { - @resource.before @resource.resources(:zen_master => "coffee") - }.should_not raise_error - - @resource.deps.topsort_iterator.to_a[0].name.should eql("funk") - @resource.deps.topsort_iterator.to_a[1].name.should eql("coffee") + it "should make notified resources be capable of acting immediately" do + @resource.collection << Chef::Resource::ZenMaster.new("coffee") + @resource.notifies :reload, @resource.resources(:zen_master => "coffee"), :immediate + @resource.actions[:reload][:immediate][0].name.should eql("coffee") end - it "should make notified resources appear in the actions hash" do - @resource.dg.add_vertex(Marionette::Resource::ZenMaster.new("coffee")) - @resource.notifies :reload, @resource.resources(:zen_master => "coffee") - @resource.actions[:reload][0].name.should eql("coffee") + it "should raise an exception if told to act in other than :delay or :immediate(ly)" do + @resource.collection << Chef::Resource::ZenMaster.new("coffee") + lambda { + @resource.notifies :reload, @resource.resources(:zen_master => "coffee"), :someday + }.should raise_error(ArgumentError) end - it "should make notified resources happen later in the graph" do - @resource.dg.add_vertex(Marionette::Resource::ZenMaster.new("coffee")) + it "should allow multiple notified resources appear in the actions hash" do + @resource.collection << Chef::Resource::ZenMaster.new("coffee") @resource.notifies :reload, @resource.resources(:zen_master => "coffee") - @resource.deps.topsort_iterator.to_a[0].name.should eql("funk") - @resource.deps.topsort_iterator.to_a[1].name.should eql("coffee") + @resource.actions[:reload][:delayed][0].name.should eql("coffee") + @resource.collection << Chef::Resource::ZenMaster.new("beans") + @resource.notifies :reload, @resource.resources(:zen_master => "beans") + @resource.actions[:reload][:delayed][1].name.should eql("beans") end - it "should make subscribed resources appear in the actions hash" do - @resource.dg.add_vertex(Marionette::Resource::ZenMaster.new("coffee")) + it "should make resources appear in the actions hash of subscribed nodes" do + @resource.collection << Chef::Resource::ZenMaster.new("coffee") zr = @resource.resources(:zen_master => "coffee") @resource.subscribes :reload, zr - zr.actions[:reload][0].name.should eql("funk") + zr.actions[:reload][:delayed][0].name.should eql("funk") end - - it "should make subscribed resources happen earlier in the graph" do - @resource.dg.add_vertex(Marionette::Resource::ZenMaster.new("coffee")) + + it "should make resources appear in the actions hash of subscribed nodes" do + @resource.collection << Chef::Resource::ZenMaster.new("coffee") zr = @resource.resources(:zen_master => "coffee") @resource.subscribes :reload, zr - @resource.deps.topsort_iterator.to_a[1].name.should eql("funk") - @resource.deps.topsort_iterator.to_a[0].name.should eql("coffee") + zr.actions[:reload][:delayed][0].name.should eql("funk") + + @resource.collection << Chef::Resource::ZenMaster.new("bean") + zrb = @resource.resources(:zen_master => "bean") + zrb.subscribes :reload, zr + zr.actions[:reload][:delayed][1].name.should eql("bean") + end + + it "should make subscribed resources be capable of acting immediately" do + @resource.collection << Chef::Resource::ZenMaster.new("coffee") + zr = @resource.resources(:zen_master => "coffee") + @resource.subscribes :reload, zr, :immediately + zr.actions[:reload][:immediate][0].name.should eql("funk") end it "should return a value if not defined" do - zm = Marionette::Resource::ZenMaster.new("coffee") + zm = Chef::Resource::ZenMaster.new("coffee") zm.something(true).should eql(true) zm.something.should eql(true) zm.something(false).should eql(false) zm.something.should eql(false) end + it "should become a string like resource_name[name]" do + zm = Chef::Resource::ZenMaster.new("coffee") + zm.to_s.should eql("zen_master[coffee]") + end + + it "should return the arguments passed with 'is'" do + zm = Chef::Resource::ZenMaster.new("coffee") + res = zm.is("one", "two", "three") + res.should eql([ "one", "two", "three" ]) + end + + it "should allow arguments preceeded by is to methods" do + @resource.noop(@resource.is(true)) + @resource.noop.should eql(true) + end + # it "should serialize to yaml" do # yaml_output = <<-DESC -#--- !ruby/object:Marionette::Resource +#--- !ruby/object:Chef::Resource #alias: #before: #name: funk diff --git a/tasks/rspec.rb b/tasks/rspec.rb index 077840d31d..80b0a79557 100644 --- a/tasks/rspec.rb +++ b/tasks/rspec.rb @@ -10,24 +10,24 @@ require 'spec/rake/spectask' require 'spec/rake/spectask' require 'spec/translator' -MARIONETTE_ROOT = File.join(File.dirname(__FILE__), "..") +CHEF_ROOT = File.join(File.dirname(__FILE__), "..") task :default => :spec desc "Run all specs in spec directory" Spec::Rake::SpecTask.new(:spec) do |t| - t.spec_opts = ['--options', "\"#{MARIONETTE_ROOT}/spec/spec.opts\""] + t.spec_opts = ['--options', "\"#{CHEF_ROOT}/spec/spec.opts\""] t.spec_files = FileList['spec/**/*_spec.rb'] end namespace :spec do desc "Run all specs in spec directory with RCov" Spec::Rake::SpecTask.new(:rcov) do |t| - t.spec_opts = ['--options', "\"#{MARIONETTE_ROOT}/spec/spec.opts\""] + t.spec_opts = ['--options', "\"#{CHEF_ROOT}/spec/spec.opts\""] t.spec_files = FileList['spec/**/*_spec.rb'] t.rcov = true t.rcov_opts = lambda do - IO.readlines("#{MARIONETTE_ROOT}/spec/rcov.opts").map {|l| l.chomp.split " "}.flatten + IO.readlines("#{CHEF_ROOT}/spec/rcov.opts").map {|l| l.chomp.split " "}.flatten end end @@ -40,7 +40,7 @@ namespace :spec do [:unit].each do |sub| desc "Run the specs under spec/#{sub}" Spec::Rake::SpecTask.new(sub) do |t| - t.spec_opts = ['--options', "\"#{MARIONETTE_ROOT}/spec/spec.opts\""] + t.spec_opts = ['--options', "\"#{CHEF_ROOT}/spec/spec.opts\""] t.spec_files = FileList["spec/#{sub}/**/*_spec.rb"] end end @@ -48,7 +48,7 @@ namespace :spec do desc "Translate/upgrade specs using the built-in translator" task :translate do translator = ::Spec::Translator.new - dir = MARIONETTE_ROOT + '/spec' + dir = CHEF_ROOT + '/spec' translator.translate(dir, dir) end end
\ No newline at end of file |