doc/coverage/index.html in mattock-0.0.1 vs doc/coverage/index.html in mattock-0.1.0

- old
+ new

@@ -21,31 +21,31 @@ <body> <div id="loading"> <img src="./assets/0.5.3/loading.gif" alt="loading"/> </div> <div id="wrapper" style="display:none;"> - <div class="timestamp">Generated <abbr class="timeago" title="2012-01-21T01:32:01-08:00">2012-01-21T01:32:01-08:00</abbr></div> + <div class="timestamp">Generated <abbr class="timeago" title="2012-01-28T02:02:54-08:00">2012-01-28T02:02:54-08:00</abbr></div> <ul class="group_tabs"></ul> <div id="content"> <div class="file_list_container" id="AllFiles"> <h2> <span class="group_name">All Files</span> - (<span class="covered_percent"><span class="green">93.0%</span></span> + (<span class="covered_percent"><span class="green">92.79%</span></span> covered at <span class="covered_strength"> <span class="green"> - 2.98 + 2.62 </span> </span> hits/line) </h2> <a name="AllFiles"></a> <div> - <b>9</b> files in total. - <b>343</b> relevant lines. - <span class="green"><b>319</b> lines covered</span> and - <span class="red"><b>24</b> lines missed </span> + <b>12</b> files in total. + <b>416</b> relevant lines. + <span class="green"><b>386</b> lines covered</span> and + <span class="red"><b>30</b> lines missed </span> </div> <table class="file_list"> <thead> <tr> <th>File</th> @@ -68,37 +68,47 @@ <td>0</td> <td>1.0</td> </tr> <tr> + <td class="strong"><a href="#a4dd8526c71e3e42410b37403d8cb37f6ca70df4" class="src_link" title="lib/mattock/cascading-definition.rb">lib/mattock/cascading-definition.rb</a></td> + <td class="green strong">100.0 %</td> + <td>32</td> + <td>16</td> + <td>16</td> + <td>0</td> + <td>3.2</td> + </tr> + + <tr> <td class="strong"><a href="#19e9811ada5819ea8e2c6a644088d4ba8e773a5b" class="src_link" title="lib/mattock/command-line.rb">lib/mattock/command-line.rb</a></td> <td class="green strong">93.1 %</td> <td>157</td> <td>87</td> <td>81</td> <td>6</td> - <td>2.9</td> + <td>3.0</td> </tr> <tr> <td class="strong"><a href="#937bd4854d7605194eaf61c021175d6a0f31e6e8" class="src_link" title="lib/mattock/command-task.rb">lib/mattock/command-task.rb</a></td> - <td class="green strong">93.1 %</td> - <td>51</td> - <td>29</td> - <td>27</td> - <td>2</td> + <td class="yellow strong">84.21 %</td> + <td>33</td> + <td>19</td> + <td>16</td> + <td>3</td> <td>1.2</td> </tr> <tr> <td class="strong"><a href="#151b5abc8f09f0fc2932ac98c07e3b516a518e3e" class="src_link" title="lib/mattock/configurable.rb">lib/mattock/configurable.rb</a></td> - <td class="green strong">98.7 %</td> - <td>129</td> - <td>77</td> - <td>76</td> - <td>1</td> - <td>8.8</td> + <td class="green strong">96.67 %</td> + <td>153</td> + <td>90</td> + <td>87</td> + <td>3</td> + <td>8.1</td> </tr> <tr> <td class="strong"><a href="#dbfbe3e96d32b3e7eea8b666117072d5da6e3e60" class="src_link" title="lib/mattock/remote-command-task.rb">lib/mattock/remote-command-task.rb</a></td> <td class="yellow strong">88.89 %</td> @@ -108,17 +118,27 @@ <td>2</td> <td>1.4</td> </tr> <tr> + <td class="strong"><a href="#7cc8f09739f0b95d0fd16321baf73b5d3c6eb35b" class="src_link" title="lib/mattock/task.rb">lib/mattock/task.rb</a></td> + <td class="green strong">94.74 %</td> + <td>35</td> + <td>19</td> + <td>18</td> + <td>1</td> + <td>0.9</td> + </tr> + + <tr> <td class="strong"><a href="#a2c73f0ba96e60116ee8696673802b6ebaddc38c" class="src_link" title="lib/mattock/tasklib.rb">lib/mattock/tasklib.rb</a></td> - <td class="green strong">97.5 %</td> - <td>76</td> - <td>40</td> - <td>39</td> + <td class="green strong">96.77 %</td> + <td>57</td> + <td>31</td> + <td>30</td> <td>1</td> - <td>3.8</td> + <td>3.4</td> </tr> <tr> <td class="strong"><a href="#d473017bbd055a2863ae4f15284c3cc7d86dd38e" class="src_link" title="lib/mattock/template-host.rb">lib/mattock/template-host.rb</a></td> <td class="red strong">63.33 %</td> @@ -129,16 +149,16 @@ <td>0.6</td> </tr> <tr> <td class="strong"><a href="#d05b479afa4321ddf827a6b5af14020183ee07b9" class="src_link" title="lib/mattock/testing/mock-command-line.rb">lib/mattock/testing/mock-command-line.rb</a></td> - <td class="green strong">92.86 %</td> - <td>26</td> - <td>14</td> - <td>13</td> - <td>1</td> - <td>1.4</td> + <td class="green strong">94.44 %</td> + <td>67</td> + <td>36</td> + <td>34</td> + <td>2</td> + <td>1.2</td> </tr> <tr> <td class="strong"><a href="#ba419266ded63c6767eeb8c594191949ebb1b061" class="src_link" title="lib/mattock/testing/rake-example-group.rb">lib/mattock/testing/rake-example-group.rb</a></td> <td class="green strong">100.0 %</td> @@ -147,10 +167,20 @@ <td>44</td> <td>0</td> <td>5.7</td> </tr> + <tr> + <td class="strong"><a href="#b325ca10da29fcd26651ac26205d38639667a9a7" class="src_link" title="lib/mattock/testing/record-commands.rb">lib/mattock/testing/record-commands.rb</a></td> + <td class="green strong">95.45 %</td> + <td>38</td> + <td>22</td> + <td>21</td> + <td>1</td> + <td>1.7</td> + </tr> + </tbody> </table> </div> @@ -205,10 +235,220 @@ </ol> </pre> </div> + <div class="source_table" id="a4dd8526c71e3e42410b37403d8cb37f6ca70df4"> + <div class="header"> + <h3>lib/mattock/cascading-definition.rb</h3> + <h4><span class="green">100.0 %</span> covered</h4> + <div> + <b>16</b> relevant lines. + <span class="green"><b>16</b> lines covered</span> and + <span class="red"><b>0</b> lines missed.</span> + </div> + </div> + + <pre> + <ol> + + <li class="covered" data-hits="1" data-linenumber="1"> + <span class="hits">1</span> + + <code class="ruby">require 'mattock/configurable'</code> + </li> + + <li class="never" data-hits="" data-linenumber="2"> + + + <code class="ruby"></code> + </li> + + <li class="covered" data-hits="1" data-linenumber="3"> + <span class="hits">1</span> + + <code class="ruby">module Mattock</code> + </li> + + <li class="covered" data-hits="1" data-linenumber="4"> + <span class="hits">1</span> + + <code class="ruby"> module CascadingDefinition</code> + </li> + + <li class="covered" data-hits="1" data-linenumber="5"> + <span class="hits">1</span> + + <code class="ruby"> include Configurable</code> + </li> + + <li class="never" data-hits="" data-linenumber="6"> + + + <code class="ruby"></code> + </li> + + <li class="covered" data-hits="1" data-linenumber="7"> + <span class="hits">1</span> + + <code class="ruby"> def initialize(*tasklibs)</code> + </li> + + <li class="covered" data-hits="6" data-linenumber="8"> + <span class="hits">6</span> + + <code class="ruby"> setup_defaults</code> + </li> + + <li class="covered" data-hits="6" data-linenumber="9"> + <span class="hits">6</span> + + <code class="ruby"> default_configuration(*tasklibs)</code> + </li> + + <li class="never" data-hits="" data-linenumber="10"> + + + <code class="ruby"></code> + </li> + + <li class="covered" data-hits="6" data-linenumber="11"> + <span class="hits">6</span> + + <code class="ruby"> yield self if block_given?</code> + </li> + + <li class="never" data-hits="" data-linenumber="12"> + + + <code class="ruby"></code> + </li> + + <li class="covered" data-hits="6" data-linenumber="13"> + <span class="hits">6</span> + + <code class="ruby"> resolve_configuration</code> + </li> + + <li class="covered" data-hits="6" data-linenumber="14"> + <span class="hits">6</span> + + <code class="ruby"> confirm_configuration</code> + </li> + + <li class="never" data-hits="" data-linenumber="15"> + + + <code class="ruby"></code> + </li> + + <li class="covered" data-hits="6" data-linenumber="16"> + <span class="hits">6</span> + + <code class="ruby"> define</code> + </li> + + <li class="never" data-hits="" data-linenumber="17"> + + + <code class="ruby"> end</code> + </li> + + <li class="never" data-hits="" data-linenumber="18"> + + + <code class="ruby"></code> + </li> + + <li class="covered" data-hits="1" data-linenumber="19"> + <span class="hits">1</span> + + <code class="ruby"> def default_configuration(*tasklibs)</code> + </li> + + <li class="never" data-hits="" data-linenumber="20"> + + + <code class="ruby"> end</code> + </li> + + <li class="never" data-hits="" data-linenumber="21"> + + + <code class="ruby"></code> + </li> + + <li class="covered" data-hits="1" data-linenumber="22"> + <span class="hits">1</span> + + <code class="ruby"> def resolve_configuration</code> + </li> + + <li class="never" data-hits="" data-linenumber="23"> + + + <code class="ruby"> end</code> + </li> + + <li class="never" data-hits="" data-linenumber="24"> + + + <code class="ruby"></code> + </li> + + <li class="covered" data-hits="1" data-linenumber="25"> + <span class="hits">1</span> + + <code class="ruby"> def confirm_configuration</code> + </li> + + <li class="covered" data-hits="6" data-linenumber="26"> + <span class="hits">6</span> + + <code class="ruby"> check_required</code> + </li> + + <li class="never" data-hits="" data-linenumber="27"> + + + <code class="ruby"> end</code> + </li> + + <li class="never" data-hits="" data-linenumber="28"> + + + <code class="ruby"></code> + </li> + + <li class="covered" data-hits="1" data-linenumber="29"> + <span class="hits">1</span> + + <code class="ruby"> def define</code> + </li> + + <li class="never" data-hits="" data-linenumber="30"> + + + <code class="ruby"> end</code> + </li> + + <li class="never" data-hits="" data-linenumber="31"> + + + <code class="ruby"> end</code> + </li> + + <li class="never" data-hits="" data-linenumber="32"> + + + <code class="ruby">end</code> + </li> + + </ol> + </pre> +</div> + <div class="source_table" id="19e9811ada5819ea8e2c6a644088d4ba8e773a5b"> <div class="header"> <h3>lib/mattock/command-line.rb</h3> <h4><span class="green">93.1 %</span> covered</h4> <div> @@ -321,12 +561,12 @@ <span class="hits">1</span> <code class="ruby"> def exit_code</code> </li> - <li class="covered" data-hits="6" data-linenumber="18"> - <span class="hits">6</span> + <li class="covered" data-hits="11" data-linenumber="18"> + <span class="hits">11</span> <code class="ruby"> @process_status.exitstatus</code> </li> <li class="never" data-hits="" data-linenumber="19"> @@ -1168,25 +1408,25 @@ </div> <div class="source_table" id="937bd4854d7605194eaf61c021175d6a0f31e6e8"> <div class="header"> <h3>lib/mattock/command-task.rb</h3> - <h4><span class="green">93.1 %</span> covered</h4> + <h4><span class="yellow">84.21 %</span> covered</h4> <div> - <b>29</b> relevant lines. - <span class="green"><b>27</b> lines covered</span> and - <span class="red"><b>2</b> lines missed.</span> + <b>19</b> relevant lines. + <span class="green"><b>16</b> lines covered</span> and + <span class="red"><b>3</b> lines missed.</span> </div> </div> <pre> <ol> <li class="covered" data-hits="1" data-linenumber="1"> <span class="hits">1</span> - <code class="ruby">require 'mattock/tasklib'</code> + <code class="ruby">require 'mattock/task'</code> </li> <li class="covered" data-hits="1" data-linenumber="2"> <span class="hits">1</span> @@ -1206,284 +1446,176 @@ </li> <li class="covered" data-hits="1" data-linenumber="5"> <span class="hits">1</span> - <code class="ruby"> module NeededPredicate</code> + <code class="ruby"> class CommandTask &lt; Task</code> </li> <li class="covered" data-hits="1" data-linenumber="6"> <span class="hits">1</span> - <code class="ruby"> def needed_predicate(&amp;block)</code> - </li> - - <li class="covered" data-hits="2" data-linenumber="7"> - <span class="hits">2</span> - - <code class="ruby"> (class &lt;&lt; self; self; end).instance_eval do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="8"> - <span class="hits">1</span> - - <code class="ruby"> define_method(:needed?, &amp;block)</code> - </li> - - <li class="never" data-hits="" data-linenumber="9"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="10"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="11"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="12"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="13"> - <span class="hits">1</span> - - <code class="ruby"> class CommandTask &lt; TaskLib</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="14"> - <span class="hits">1</span> - <code class="ruby"> setting(:task_name, :run)</code> </li> - <li class="covered" data-hits="1" data-linenumber="15"> + <li class="covered" data-hits="1" data-linenumber="7"> <span class="hits">1</span> <code class="ruby"> setting(:command)</code> </li> - <li class="covered" data-hits="1" data-linenumber="16"> + <li class="covered" data-hits="1" data-linenumber="8"> <span class="hits">1</span> <code class="ruby"> setting(:verify_command, nil)</code> </li> - <li class="never" data-hits="" data-linenumber="17"> + <li class="never" data-hits="" data-linenumber="9"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="18"> + <li class="covered" data-hits="1" data-linenumber="10"> <span class="hits">1</span> <code class="ruby"> def verify_command</code> </li> - <li class="covered" data-hits="3" data-linenumber="19"> - <span class="hits">3</span> + <li class="covered" data-hits="4" data-linenumber="11"> + <span class="hits">4</span> <code class="ruby"> if @verify_command.respond_to?(:call)</code> </li> - <li class="missed" data-hits="0" data-linenumber="20"> + <li class="missed" data-hits="0" data-linenumber="12"> <code class="ruby"> @verify_command = @verify_command.call</code> </li> - <li class="never" data-hits="" data-linenumber="21"> + <li class="never" data-hits="" data-linenumber="13"> <code class="ruby"> end</code> </li> - <li class="covered" data-hits="3" data-linenumber="22"> - <span class="hits">3</span> + <li class="covered" data-hits="4" data-linenumber="14"> + <span class="hits">4</span> <code class="ruby"> @verify_command</code> </li> - <li class="never" data-hits="" data-linenumber="23"> + <li class="never" data-hits="" data-linenumber="15"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="24"> + <li class="never" data-hits="" data-linenumber="16"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="25"> + <li class="covered" data-hits="1" data-linenumber="17"> <span class="hits">1</span> <code class="ruby"> def decorated(cmd)</code> </li> - <li class="missed" data-hits="0" data-linenumber="26"> + <li class="missed" data-hits="0" data-linenumber="18"> <code class="ruby"> cmd</code> </li> - <li class="never" data-hits="" data-linenumber="27"> + <li class="never" data-hits="" data-linenumber="19"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="28"> + <li class="never" data-hits="" data-linenumber="20"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="29"> + <li class="covered" data-hits="1" data-linenumber="21"> <span class="hits">1</span> - <code class="ruby"> def command_task</code> + <code class="ruby"> def action</code> </li> - <li class="never" data-hits="" data-linenumber="30"> - - - <code class="ruby"> @command_task ||=</code> - </li> - - <li class="never" data-hits="" data-linenumber="31"> - - - <code class="ruby"> begin</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="32"> + <li class="covered" data-hits="1" data-linenumber="22"> <span class="hits">1</span> - <code class="ruby"> task task_name do</code> + <code class="ruby"> decorated(command).must_succeed!</code> </li> - <li class="covered" data-hits="1" data-linenumber="33"> - <span class="hits">1</span> + <li class="never" data-hits="" data-linenumber="23"> - <code class="ruby"> decorated(command).must_succeed!</code> - </li> - - <li class="never" data-hits="" data-linenumber="34"> - - <code class="ruby"> end</code> - </li> - - <li class="covered" data-hits="3" data-linenumber="35"> - <span class="hits">3</span> - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="36"> - - <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="37"> + <li class="never" data-hits="" data-linenumber="24"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="38"> + <li class="covered" data-hits="1" data-linenumber="25"> <span class="hits">1</span> - <code class="ruby"> def define</code> + <code class="ruby"> def needed?</code> </li> - <li class="covered" data-hits="1" data-linenumber="39"> + <li class="covered" data-hits="1" data-linenumber="26"> <span class="hits">1</span> - <code class="ruby"> in_namespace do</code> + <code class="ruby"> unless verify_command.nil?</code> </li> - <li class="covered" data-hits="1" data-linenumber="40"> + <li class="covered" data-hits="1" data-linenumber="27"> <span class="hits">1</span> - <code class="ruby"> command_task</code> + <code class="ruby"> !decorated(verify_command).succeeds?</code> </li> - <li class="covered" data-hits="1" data-linenumber="41"> - <span class="hits">1</span> + <li class="never" data-hits="" data-linenumber="28"> - <code class="ruby"> unless verify_command.nil?</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="42"> - <span class="hits">1</span> - <code class="ruby"> needed = decorated(verify_command)</code> + <code class="ruby"> else</code> </li> - <li class="covered" data-hits="1" data-linenumber="43"> - <span class="hits">1</span> + <li class="missed" data-hits="0" data-linenumber="29"> - <code class="ruby"> command_task.extend NeededPredicate</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="44"> - <span class="hits">1</span> - <code class="ruby"> command_task.needed_predicate do</code> + <code class="ruby"> super</code> </li> - <li class="covered" data-hits="1" data-linenumber="45"> - <span class="hits">1</span> + <li class="never" data-hits="" data-linenumber="30"> - <code class="ruby"> !needed.succeeds?</code> - </li> - - <li class="never" data-hits="" data-linenumber="46"> - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="47"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="48"> - - <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="49"> + <li class="never" data-hits="" data-linenumber="31"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="50"> + <li class="never" data-hits="" data-linenumber="32"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="51"> + <li class="never" data-hits="" data-linenumber="33"> <code class="ruby">end</code> </li> @@ -1492,15 +1624,15 @@ </div> <div class="source_table" id="151b5abc8f09f0fc2932ac98c07e3b516a518e3e"> <div class="header"> <h3>lib/mattock/configurable.rb</h3> - <h4><span class="green">98.7 %</span> covered</h4> + <h4><span class="green">96.67 %</span> covered</h4> <div> - <b>77</b> relevant lines. - <span class="green"><b>76</b> lines covered</span> and - <span class="red"><b>1</b> lines missed.</span> + <b>90</b> relevant lines. + <span class="green"><b>87</b> lines covered</span> and + <span class="red"><b>3</b> lines missed.</span> </div> </div> <pre> <ol> @@ -1605,12 +1737,12 @@ <span class="hits">1</span> <code class="ruby"> def default_values</code> </li> - <li class="covered" data-hits="92" data-linenumber="18"> - <span class="hits">92</span> + <li class="covered" data-hits="97" data-linenumber="18"> + <span class="hits">97</span> <code class="ruby"> @default_values ||= {}</code> </li> <li class="never" data-hits="" data-linenumber="19"> @@ -1653,18 +1785,18 @@ <span class="hits">31</span> <code class="ruby"> default_values.each_pair do |name,value|</code> </li> - <li class="covered" data-hits="42" data-linenumber="26"> - <span class="hits">42</span> + <li class="covered" data-hits="43" data-linenumber="26"> + <span class="hits">43</span> <code class="ruby"> instance.__send__(&quot;#{name}=&quot;, value)</code> </li> - <li class="covered" data-hits="42" data-linenumber="27"> - <span class="hits">42</span> + <li class="covered" data-hits="43" data-linenumber="27"> + <span class="hits">43</span> <code class="ruby"> if Configurable === value</code> </li> <li class="covered" data-hits="5" data-linenumber="28"> @@ -1731,18 +1863,18 @@ <span class="hits">27</span> <code class="ruby"> default_values.each_pair do |name,value|</code> </li> - <li class="covered" data-hits="35" data-linenumber="39"> - <span class="hits">35</span> + <li class="covered" data-hits="36" data-linenumber="39"> + <span class="hits">36</span> <code class="ruby"> set_value = instance.__send__(name)</code> </li> - <li class="covered" data-hits="35" data-linenumber="40"> - <span class="hits">35</span> + <li class="covered" data-hits="36" data-linenumber="40"> + <span class="hits">36</span> <code class="ruby"> if value == RequiredField and set_value == RequiredField</code> </li> <li class="covered" data-hits="3" data-linenumber="41"> @@ -1761,12 +1893,12 @@ <code class="ruby"> end</code> </li> - <li class="covered" data-hits="32" data-linenumber="44"> - <span class="hits">32</span> + <li class="covered" data-hits="33" data-linenumber="44"> + <span class="hits">33</span> <code class="ruby"> if Configurable === set_value</code> </li> <li class="covered" data-hits="4" data-linenumber="45"> @@ -1818,464 +1950,608 @@ </li> <li class="covered" data-hits="1" data-linenumber="53"> <span class="hits">1</span> + <code class="ruby"> def copy_settings(from, to)</code> + </li> + + <li class="covered" data-hits="3" data-linenumber="54"> + <span class="hits">3</span> + + <code class="ruby"> if Configurable &gt; superclass</code> + </li> + + <li class="covered" data-hits="2" data-linenumber="55"> + <span class="hits">2</span> + + <code class="ruby"> superclass.copy_settings(from, to)</code> + </li> + + <li class="never" data-hits="" data-linenumber="56"> + + + <code class="ruby"> end</code> + </li> + + <li class="covered" data-hits="3" data-linenumber="57"> + <span class="hits">3</span> + + <code class="ruby"> default_values.keys.each do |field|</code> + </li> + + <li class="covered" data-hits="8" data-linenumber="58"> + <span class="hits">8</span> + + <code class="ruby"> begin</code> + </li> + + <li class="covered" data-hits="8" data-linenumber="59"> + <span class="hits">8</span> + + <code class="ruby"> to.__send__(&quot;#{field}=&quot;, from.__send__(field))</code> + </li> + + <li class="never" data-hits="" data-linenumber="60"> + + + <code class="ruby"> rescue NoMethodError</code> + </li> + + <li class="never" data-hits="" data-linenumber="61"> + + + <code class="ruby"> #shrug it off</code> + </li> + + <li class="never" data-hits="" data-linenumber="62"> + + + <code class="ruby"> end</code> + </li> + + <li class="never" data-hits="" data-linenumber="63"> + + + <code class="ruby"> end</code> + </li> + + <li class="never" data-hits="" data-linenumber="64"> + + + <code class="ruby"> end</code> + </li> + + <li class="never" data-hits="" data-linenumber="65"> + + + <code class="ruby"></code> + </li> + + <li class="covered" data-hits="1" data-linenumber="66"> + <span class="hits">1</span> + <code class="ruby"> def nested(hash=nil)</code> </li> - <li class="covered" data-hits="2" data-linenumber="54"> + <li class="covered" data-hits="2" data-linenumber="67"> <span class="hits">2</span> <code class="ruby"> obj = Class.new(Struct).new</code> </li> - <li class="covered" data-hits="2" data-linenumber="55"> + <li class="covered" data-hits="2" data-linenumber="68"> <span class="hits">2</span> <code class="ruby"> obj.settings(hash || {})</code> </li> - <li class="covered" data-hits="2" data-linenumber="56"> + <li class="covered" data-hits="2" data-linenumber="69"> <span class="hits">2</span> <code class="ruby"> return obj</code> </li> - <li class="never" data-hits="" data-linenumber="57"> + <li class="never" data-hits="" data-linenumber="70"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="58"> + <li class="never" data-hits="" data-linenumber="71"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="59"> + <li class="covered" data-hits="1" data-linenumber="72"> <span class="hits">1</span> <code class="ruby"> def nil_fields(*names)</code> </li> - <li class="covered" data-hits="2" data-linenumber="60"> + <li class="covered" data-hits="2" data-linenumber="73"> <span class="hits">2</span> <code class="ruby"> names.each do |name|</code> </li> - <li class="covered" data-hits="3" data-linenumber="61"> + <li class="covered" data-hits="3" data-linenumber="74"> <span class="hits">3</span> <code class="ruby"> setting(name, nil)</code> </li> - <li class="never" data-hits="" data-linenumber="62"> + <li class="never" data-hits="" data-linenumber="75"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="63"> + <li class="never" data-hits="" data-linenumber="76"> <code class="ruby"> end</code> </li> - <li class="covered" data-hits="1" data-linenumber="64"> + <li class="covered" data-hits="1" data-linenumber="77"> <span class="hits">1</span> <code class="ruby"> alias nil_field nil_fields</code> </li> - <li class="never" data-hits="" data-linenumber="65"> + <li class="never" data-hits="" data-linenumber="78"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="66"> + <li class="covered" data-hits="1" data-linenumber="79"> <span class="hits">1</span> <code class="ruby"> def required_fields(*names)</code> </li> - <li class="covered" data-hits="2" data-linenumber="67"> + <li class="covered" data-hits="2" data-linenumber="80"> <span class="hits">2</span> <code class="ruby"> names.each do |name|</code> </li> - <li class="covered" data-hits="2" data-linenumber="68"> + <li class="covered" data-hits="2" data-linenumber="81"> <span class="hits">2</span> <code class="ruby"> setting(name)</code> </li> - <li class="never" data-hits="" data-linenumber="69"> + <li class="never" data-hits="" data-linenumber="82"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="70"> + <li class="never" data-hits="" data-linenumber="83"> <code class="ruby"> end</code> </li> - <li class="covered" data-hits="1" data-linenumber="71"> + <li class="covered" data-hits="1" data-linenumber="84"> <span class="hits">1</span> <code class="ruby"> alias required_field required_fields</code> </li> - <li class="never" data-hits="" data-linenumber="72"> + <li class="never" data-hits="" data-linenumber="85"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="73"> + <li class="covered" data-hits="1" data-linenumber="86"> <span class="hits">1</span> <code class="ruby"> def setting(name, default_value = RequiredField)</code> </li> - <li class="covered" data-hits="17" data-linenumber="74"> - <span class="hits">17</span> + <li class="covered" data-hits="18" data-linenumber="87"> + <span class="hits">18</span> <code class="ruby"> name = name.to_sym</code> </li> - <li class="covered" data-hits="17" data-linenumber="75"> - <span class="hits">17</span> + <li class="covered" data-hits="18" data-linenumber="88"> + <span class="hits">18</span> <code class="ruby"> attr_accessor(name)</code> </li> - <li class="covered" data-hits="17" data-linenumber="76"> - <span class="hits">17</span> + <li class="covered" data-hits="18" data-linenumber="89"> + <span class="hits">18</span> <code class="ruby"> if default_values.has_key?(name) and default_values[name] != default_value</code> </li> - <li class="missed" data-hits="0" data-linenumber="77"> + <li class="missed" data-hits="0" data-linenumber="90"> <code class="ruby"> warn &quot;Changing default value of #{self.name}##{name} from #{default_values[name].inspect} to #{default_value.inspect}&quot;</code> </li> - <li class="never" data-hits="" data-linenumber="78"> + <li class="never" data-hits="" data-linenumber="91"> <code class="ruby"> end</code> </li> - <li class="covered" data-hits="17" data-linenumber="79"> - <span class="hits">17</span> + <li class="covered" data-hits="18" data-linenumber="92"> + <span class="hits">18</span> <code class="ruby"> default_values[name] = default_value</code> </li> - <li class="never" data-hits="" data-linenumber="80"> + <li class="never" data-hits="" data-linenumber="93"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="81"> + <li class="never" data-hits="" data-linenumber="94"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="82"> + <li class="covered" data-hits="1" data-linenumber="95"> <span class="hits">1</span> <code class="ruby"> def settings(hash)</code> </li> - <li class="covered" data-hits="1" data-linenumber="83"> + <li class="covered" data-hits="1" data-linenumber="96"> <span class="hits">1</span> <code class="ruby"> hash.each_pair do |name, value|</code> </li> - <li class="covered" data-hits="2" data-linenumber="84"> + <li class="covered" data-hits="2" data-linenumber="97"> <span class="hits">2</span> <code class="ruby"> setting(name, value)</code> </li> - <li class="never" data-hits="" data-linenumber="85"> + <li class="never" data-hits="" data-linenumber="98"> <code class="ruby"> end</code> </li> - <li class="covered" data-hits="1" data-linenumber="86"> + <li class="covered" data-hits="1" data-linenumber="99"> <span class="hits">1</span> <code class="ruby"> return self</code> </li> - <li class="never" data-hits="" data-linenumber="87"> + <li class="never" data-hits="" data-linenumber="100"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="88"> + <li class="never" data-hits="" data-linenumber="101"> + <code class="ruby"></code> + </li> + + <li class="covered" data-hits="1" data-linenumber="102"> + <span class="hits">1</span> + + <code class="ruby"> def included(mod)</code> + </li> + + <li class="covered" data-hits="5" data-linenumber="103"> + <span class="hits">5</span> + + <code class="ruby"> mod.extend ClassMethods</code> + </li> + + <li class="never" data-hits="" data-linenumber="104"> + + + <code class="ruby"> end</code> + </li> + + <li class="never" data-hits="" data-linenumber="105"> + + <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="89"> + <li class="covered" data-hits="1" data-linenumber="106"> + <span class="hits">1</span> + <code class="ruby"> extend ClassMethods</code> + </li> + + <li class="never" data-hits="" data-linenumber="107"> + <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="90"> + <li class="covered" data-hits="1" data-linenumber="108"> <span class="hits">1</span> - <code class="ruby"> def self.included(mod)</code> + <code class="ruby"> def copy_settings_to(other)</code> </li> - <li class="covered" data-hits="3" data-linenumber="91"> - <span class="hits">3</span> + <li class="covered" data-hits="1" data-linenumber="109"> + <span class="hits">1</span> - <code class="ruby"> mod.extend ClassMethods</code> + <code class="ruby"> self.class.copy_settings(self, other)</code> </li> - <li class="never" data-hits="" data-linenumber="92"> + <li class="never" data-hits="" data-linenumber="110"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="93"> + <li class="never" data-hits="" data-linenumber="111"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="94"> + <li class="covered" data-hits="1" data-linenumber="112"> <span class="hits">1</span> <code class="ruby"> def setup_defaults</code> </li> - <li class="covered" data-hits="10" data-linenumber="95"> + <li class="covered" data-hits="10" data-linenumber="113"> <span class="hits">10</span> <code class="ruby"> self.class.set_defaults_on(self)</code> </li> - <li class="covered" data-hits="10" data-linenumber="96"> + <li class="covered" data-hits="10" data-linenumber="114"> <span class="hits">10</span> <code class="ruby"> self</code> </li> - <li class="never" data-hits="" data-linenumber="97"> + <li class="never" data-hits="" data-linenumber="115"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="98"> + <li class="never" data-hits="" data-linenumber="116"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="99"> + <li class="covered" data-hits="1" data-linenumber="117"> <span class="hits">1</span> <code class="ruby"> def check_required</code> </li> - <li class="covered" data-hits="9" data-linenumber="100"> + <li class="covered" data-hits="9" data-linenumber="118"> <span class="hits">9</span> <code class="ruby"> missing = self.class.missing_required_fields_on(self)</code> </li> - <li class="covered" data-hits="9" data-linenumber="101"> + <li class="covered" data-hits="9" data-linenumber="119"> <span class="hits">9</span> <code class="ruby"> unless missing.empty?</code> </li> - <li class="covered" data-hits="2" data-linenumber="102"> - <span class="hits">2</span> + <li class="covered" data-hits="5" data-linenumber="120"> + <span class="hits">5</span> - <code class="ruby"> raise &quot;Required field#{missing.length &gt; 1 ? &quot;s&quot; : &quot;&quot;} #{missing.join(&quot;, &quot;)} unset on #{self.inspect}&quot;</code> + <code class="ruby"> raise &quot;Required field#{missing.length &gt; 1 ? &quot;s&quot; : &quot;&quot;} #{missing.map{|field| field.to_s.inspect}.join(&quot;, &quot;)} unset on #{self.inspect}&quot;</code> </li> - <li class="never" data-hits="" data-linenumber="103"> + <li class="never" data-hits="" data-linenumber="121"> <code class="ruby"> end</code> </li> - <li class="covered" data-hits="7" data-linenumber="104"> + <li class="covered" data-hits="7" data-linenumber="122"> <span class="hits">7</span> <code class="ruby"> self</code> </li> - <li class="never" data-hits="" data-linenumber="105"> + <li class="never" data-hits="" data-linenumber="123"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="106"> + <li class="never" data-hits="" data-linenumber="124"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="107"> + <li class="covered" data-hits="1" data-linenumber="125"> <span class="hits">1</span> <code class="ruby"> def setting(name, default_value = nil)</code> </li> - <li class="covered" data-hits="3" data-linenumber="108"> + <li class="covered" data-hits="3" data-linenumber="126"> <span class="hits">3</span> <code class="ruby"> self.class.setting(name, default_value)</code> </li> - <li class="covered" data-hits="3" data-linenumber="109"> + <li class="covered" data-hits="3" data-linenumber="127"> <span class="hits">3</span> <code class="ruby"> instance_variable_set(&quot;@#{name}&quot;, default_value)</code> </li> - <li class="never" data-hits="" data-linenumber="110"> + <li class="never" data-hits="" data-linenumber="128"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="111"> + <li class="never" data-hits="" data-linenumber="129"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="112"> + <li class="covered" data-hits="1" data-linenumber="130"> <span class="hits">1</span> <code class="ruby"> def settings(hash)</code> </li> - <li class="covered" data-hits="2" data-linenumber="113"> + <li class="covered" data-hits="2" data-linenumber="131"> <span class="hits">2</span> <code class="ruby"> hash.each_pair do |name, value|</code> </li> - <li class="covered" data-hits="3" data-linenumber="114"> + <li class="covered" data-hits="3" data-linenumber="132"> <span class="hits">3</span> <code class="ruby"> setting(name, value)</code> </li> - <li class="never" data-hits="" data-linenumber="115"> + <li class="never" data-hits="" data-linenumber="133"> <code class="ruby"> end</code> </li> - <li class="covered" data-hits="2" data-linenumber="116"> + <li class="covered" data-hits="2" data-linenumber="134"> <span class="hits">2</span> <code class="ruby"> return self</code> </li> - <li class="never" data-hits="" data-linenumber="117"> + <li class="never" data-hits="" data-linenumber="135"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="118"> + <li class="never" data-hits="" data-linenumber="136"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="119"> + <li class="covered" data-hits="1" data-linenumber="137"> <span class="hits">1</span> <code class="ruby"> def required_fields(*names)</code> </li> - <li class="covered" data-hits="1" data-linenumber="120"> + <li class="covered" data-hits="1" data-linenumber="138"> <span class="hits">1</span> <code class="ruby"> self.class.required_fields(*names)</code> </li> - <li class="covered" data-hits="1" data-linenumber="121"> + <li class="covered" data-hits="1" data-linenumber="139"> <span class="hits">1</span> <code class="ruby"> self</code> </li> - <li class="never" data-hits="" data-linenumber="122"> + <li class="never" data-hits="" data-linenumber="140"> <code class="ruby"> end</code> </li> - <li class="covered" data-hits="1" data-linenumber="123"> + <li class="covered" data-hits="1" data-linenumber="141"> <span class="hits">1</span> <code class="ruby"> alias required_field required_fields</code> </li> - <li class="never" data-hits="" data-linenumber="124"> + <li class="never" data-hits="" data-linenumber="142"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="125"> + <li class="covered" data-hits="1" data-linenumber="143"> <span class="hits">1</span> + <code class="ruby"> def nil_fields(*names)</code> + </li> + + <li class="missed" data-hits="0" data-linenumber="144"> + + + <code class="ruby"> self.class.nil_fields(*names)</code> + </li> + + <li class="missed" data-hits="0" data-linenumber="145"> + + + <code class="ruby"> self</code> + </li> + + <li class="never" data-hits="" data-linenumber="146"> + + + <code class="ruby"> end</code> + </li> + + <li class="covered" data-hits="1" data-linenumber="147"> + <span class="hits">1</span> + + <code class="ruby"> alias nil_field nil_fields</code> + </li> + + <li class="never" data-hits="" data-linenumber="148"> + + + <code class="ruby"></code> + </li> + + <li class="covered" data-hits="1" data-linenumber="149"> + <span class="hits">1</span> + <code class="ruby"> class Struct</code> </li> - <li class="covered" data-hits="1" data-linenumber="126"> + <li class="covered" data-hits="1" data-linenumber="150"> <span class="hits">1</span> <code class="ruby"> include Configurable</code> </li> - <li class="never" data-hits="" data-linenumber="127"> + <li class="never" data-hits="" data-linenumber="151"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="128"> + <li class="never" data-hits="" data-linenumber="152"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="129"> + <li class="never" data-hits="" data-linenumber="153"> <code class="ruby">end</code> </li> @@ -2479,475 +2755,589 @@ </ol> </pre> </div> - <div class="source_table" id="a2c73f0ba96e60116ee8696673802b6ebaddc38c"> + <div class="source_table" id="7cc8f09739f0b95d0fd16321baf73b5d3c6eb35b"> <div class="header"> - <h3>lib/mattock/tasklib.rb</h3> - <h4><span class="green">97.5 %</span> covered</h4> + <h3>lib/mattock/task.rb</h3> + <h4><span class="green">94.74 %</span> covered</h4> <div> - <b>40</b> relevant lines. - <span class="green"><b>39</b> lines covered</span> and + <b>19</b> relevant lines. + <span class="green"><b>18</b> lines covered</span> and <span class="red"><b>1</b> lines missed.</span> </div> </div> <pre> <ol> <li class="covered" data-hits="1" data-linenumber="1"> <span class="hits">1</span> - <code class="ruby">require 'ostruct'</code> + <code class="ruby">require 'mattock/cascading-definition'</code> </li> <li class="covered" data-hits="1" data-linenumber="2"> <span class="hits">1</span> - <code class="ruby">require 'rake/tasklib'</code> + <code class="ruby">require 'rake/task'</code> </li> - <li class="covered" data-hits="1" data-linenumber="3"> - <span class="hits">1</span> + <li class="never" data-hits="" data-linenumber="3"> - <code class="ruby">require 'mattock/configurable'</code> - </li> - - <li class="never" data-hits="" data-linenumber="4"> - <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="5"> + <li class="covered" data-hits="1" data-linenumber="4"> <span class="hits">1</span> <code class="ruby">module Mattock</code> </li> - <li class="covered" data-hits="1" data-linenumber="6"> + <li class="covered" data-hits="1" data-linenumber="5"> <span class="hits">1</span> - <code class="ruby"> class TaskLib &lt; Rake::TaskLib</code> + <code class="ruby"> class Task &lt; Rake::Task</code> </li> - <li class="covered" data-hits="1" data-linenumber="7"> + <li class="covered" data-hits="1" data-linenumber="6"> <span class="hits">1</span> - <code class="ruby"> include Configurable</code> + <code class="ruby"> include CascadingDefinition</code> </li> - <li class="never" data-hits="" data-linenumber="8"> + <li class="never" data-hits="" data-linenumber="7"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="9"> + <li class="covered" data-hits="1" data-linenumber="8"> <span class="hits">1</span> - <code class="ruby"> attr_writer :namespace_name</code> + <code class="ruby"> setting :task_name</code> </li> - <li class="covered" data-hits="1" data-linenumber="10"> - <span class="hits">1</span> + <li class="never" data-hits="" data-linenumber="9"> - <code class="ruby"> def self.default_namespace(name)</code> + + <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="11"> + <li class="covered" data-hits="1" data-linenumber="10"> <span class="hits">1</span> - <code class="ruby"> setting(:namespace_name, name)</code> + <code class="ruby"> def action</code> </li> - <li class="never" data-hits="" data-linenumber="12"> + <li class="never" data-hits="" data-linenumber="11"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="13"> + <li class="never" data-hits="" data-linenumber="12"> <code class="ruby"></code> </li> + <li class="covered" data-hits="1" data-linenumber="13"> + <span class="hits">1</span> + + <code class="ruby"> def task_args</code> + </li> + <li class="covered" data-hits="1" data-linenumber="14"> <span class="hits">1</span> - <code class="ruby"> def initialize(*tasklibs)</code> + <code class="ruby"> [task_name]</code> </li> - <li class="covered" data-hits="6" data-linenumber="15"> - <span class="hits">6</span> + <li class="never" data-hits="" data-linenumber="15"> - <code class="ruby"> @tasks = []</code> + + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="16"> <code class="ruby"></code> </li> - <li class="covered" data-hits="6" data-linenumber="17"> - <span class="hits">6</span> + <li class="covered" data-hits="1" data-linenumber="17"> + <span class="hits">1</span> - <code class="ruby"> default_configuration(*tasklibs)</code> + <code class="ruby"> def task_class</code> </li> - <li class="never" data-hits="" data-linenumber="18"> + <li class="covered" data-hits="1" data-linenumber="18"> + <span class="hits">1</span> + <code class="ruby"> return @task_class if @task_class</code> + </li> + + <li class="covered" data-hits="1" data-linenumber="19"> + <span class="hits">1</span> - <code class="ruby"></code> + <code class="ruby"> @task_class = Class.new(self.class) do</code> </li> - <li class="covered" data-hits="6" data-linenumber="19"> - <span class="hits">6</span> + <li class="covered" data-hits="1" data-linenumber="20"> + <span class="hits">1</span> - <code class="ruby"> yield self if block_given?</code> + <code class="ruby"> define_method :initialize, Rake::Task.instance_method(:initialize)</code> </li> - <li class="never" data-hits="" data-linenumber="20"> + <li class="never" data-hits="" data-linenumber="21"> - <code class="ruby"></code> + <code class="ruby"> end</code> </li> - <li class="covered" data-hits="6" data-linenumber="21"> - <span class="hits">6</span> + <li class="never" data-hits="" data-linenumber="22"> - <code class="ruby"> resolve_configuration</code> + + <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="22"> + <li class="never" data-hits="" data-linenumber="23"> <code class="ruby"></code> </li> - <li class="covered" data-hits="6" data-linenumber="23"> - <span class="hits">6</span> + <li class="covered" data-hits="1" data-linenumber="24"> + <span class="hits">1</span> - <code class="ruby"> define</code> + <code class="ruby"> def inspect</code> </li> - <li class="never" data-hits="" data-linenumber="24"> + <li class="missed" data-hits="0" data-linenumber="25"> + <code class="ruby"> &quot;Mattock::Task&quot;</code> + </li> + + <li class="never" data-hits="" data-linenumber="26"> + + <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="25"> + <li class="never" data-hits="" data-linenumber="27"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="26"> + <li class="covered" data-hits="1" data-linenumber="28"> <span class="hits">1</span> - <code class="ruby"> attr_reader :tasks</code> + <code class="ruby"> def define</code> </li> - <li class="never" data-hits="" data-linenumber="27"> + <li class="covered" data-hits="1" data-linenumber="29"> + <span class="hits">1</span> + <code class="ruby"> task =task_class.define_task(*task_args) do</code> + </li> + + <li class="covered" data-hits="1" data-linenumber="30"> + <span class="hits">1</span> - <code class="ruby"></code> + <code class="ruby"> action</code> </li> - <li class="covered" data-hits="1" data-linenumber="28"> + <li class="never" data-hits="" data-linenumber="31"> + + + <code class="ruby"> end</code> + </li> + + <li class="covered" data-hits="1" data-linenumber="32"> <span class="hits">1</span> - <code class="ruby"> def task(*args)</code> + <code class="ruby"> copy_settings_to(task)</code> </li> - <li class="covered" data-hits="11" data-linenumber="29"> - <span class="hits">11</span> + <li class="never" data-hits="" data-linenumber="33"> - <code class="ruby"> a_task = super</code> + + <code class="ruby"> end</code> </li> - <li class="covered" data-hits="11" data-linenumber="30"> - <span class="hits">11</span> + <li class="never" data-hits="" data-linenumber="34"> - <code class="ruby"> @tasks &lt;&lt; a_task</code> + + <code class="ruby"> end</code> </li> - <li class="covered" data-hits="11" data-linenumber="31"> - <span class="hits">11</span> + <li class="never" data-hits="" data-linenumber="35"> - <code class="ruby"> return a_task</code> + + <code class="ruby">end</code> </li> - <li class="never" data-hits="" data-linenumber="32"> + </ol> + </pre> +</div> + + <div class="source_table" id="a2c73f0ba96e60116ee8696673802b6ebaddc38c"> + <div class="header"> + <h3>lib/mattock/tasklib.rb</h3> + <h4><span class="green">96.77 %</span> covered</h4> + <div> + <b>31</b> relevant lines. + <span class="green"><b>30</b> lines covered</span> and + <span class="red"><b>1</b> lines missed.</span> + </div> + </div> + + <pre> + <ol> + + <li class="covered" data-hits="1" data-linenumber="1"> + <span class="hits">1</span> + <code class="ruby">require 'rake/tasklib'</code> + </li> + + <li class="covered" data-hits="1" data-linenumber="2"> + <span class="hits">1</span> - <code class="ruby"> end</code> + <code class="ruby">require 'mattock/cascading-definition'</code> </li> - <li class="never" data-hits="" data-linenumber="33"> + <li class="never" data-hits="" data-linenumber="3"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="34"> + <li class="covered" data-hits="1" data-linenumber="4"> <span class="hits">1</span> - <code class="ruby"> def default_configuration(*tasklibs)</code> + <code class="ruby">module Mattock</code> </li> - <li class="covered" data-hits="6" data-linenumber="35"> - <span class="hits">6</span> + <li class="covered" data-hits="1" data-linenumber="5"> + <span class="hits">1</span> - <code class="ruby"> setup_defaults</code> + <code class="ruby"> class TaskLib &lt; Rake::TaskLib</code> </li> - <li class="never" data-hits="" data-linenumber="36"> + <li class="covered" data-hits="1" data-linenumber="6"> + <span class="hits">1</span> + <code class="ruby"> include CascadingDefinition</code> + </li> + + <li class="never" data-hits="" data-linenumber="7"> + + <code class="ruby"></code> + </li> + + <li class="covered" data-hits="1" data-linenumber="8"> + <span class="hits">1</span> + + <code class="ruby"> attr_writer :namespace_name</code> + </li> + + <li class="covered" data-hits="1" data-linenumber="9"> + <span class="hits">1</span> + + <code class="ruby"> def self.default_namespace(name)</code> + </li> + + <li class="covered" data-hits="1" data-linenumber="10"> + <span class="hits">1</span> + + <code class="ruby"> setting(:namespace_name, name)</code> + </li> + + <li class="never" data-hits="" data-linenumber="11"> + + <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="37"> + <li class="never" data-hits="" data-linenumber="12"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="38"> + <li class="covered" data-hits="1" data-linenumber="13"> <span class="hits">1</span> - <code class="ruby"> def resolve_configuration</code> + <code class="ruby"> attr_reader :tasks</code> </li> - <li class="covered" data-hits="6" data-linenumber="39"> - <span class="hits">6</span> + <li class="never" data-hits="" data-linenumber="14"> - <code class="ruby"> check_required</code> + + <code class="ruby"></code> </li> - <li class="never" data-hits="" data-linenumber="40"> + <li class="covered" data-hits="1" data-linenumber="15"> + <span class="hits">1</span> + <code class="ruby"> def initialize(*toolkits)</code> + </li> + + <li class="covered" data-hits="5" data-linenumber="16"> + <span class="hits">5</span> + <code class="ruby"> @tasks = []</code> + </li> + + <li class="covered" data-hits="5" data-linenumber="17"> + <span class="hits">5</span> + + <code class="ruby"> super</code> + </li> + + <li class="never" data-hits="" data-linenumber="18"> + + <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="41"> + <li class="never" data-hits="" data-linenumber="19"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="42"> + <li class="covered" data-hits="1" data-linenumber="20"> <span class="hits">1</span> - <code class="ruby"> def define</code> + <code class="ruby"> def task(*args)</code> </li> - <li class="never" data-hits="" data-linenumber="43"> + <li class="covered" data-hits="10" data-linenumber="21"> + <span class="hits">10</span> + <code class="ruby"> a_task = super</code> + </li> + + <li class="covered" data-hits="10" data-linenumber="22"> + <span class="hits">10</span> + <code class="ruby"> @tasks &lt;&lt; a_task</code> + </li> + + <li class="covered" data-hits="10" data-linenumber="23"> + <span class="hits">10</span> + + <code class="ruby"> return a_task</code> + </li> + + <li class="never" data-hits="" data-linenumber="24"> + + <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="44"> + <li class="never" data-hits="" data-linenumber="25"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="45"> + <li class="covered" data-hits="1" data-linenumber="26"> <span class="hits">1</span> <code class="ruby"> def in_namespace(*tasknames)</code> </li> - <li class="covered" data-hits="11" data-linenumber="46"> - <span class="hits">11</span> + <li class="covered" data-hits="10" data-linenumber="27"> + <span class="hits">10</span> <code class="ruby"> if tasknames.empty?</code> </li> - <li class="covered" data-hits="6" data-linenumber="47"> - <span class="hits">6</span> + <li class="covered" data-hits="5" data-linenumber="28"> + <span class="hits">5</span> <code class="ruby"> if block_given?</code> </li> - <li class="covered" data-hits="6" data-linenumber="48"> - <span class="hits">6</span> + <li class="covered" data-hits="5" data-linenumber="29"> + <span class="hits">5</span> <code class="ruby"> if @namespace_name.nil?</code> </li> - <li class="missed" data-hits="0" data-linenumber="49"> + <li class="missed" data-hits="0" data-linenumber="30"> <code class="ruby"> yield</code> </li> - <li class="never" data-hits="" data-linenumber="50"> + <li class="never" data-hits="" data-linenumber="31"> <code class="ruby"> else</code> </li> - <li class="covered" data-hits="6" data-linenumber="51"> - <span class="hits">6</span> + <li class="covered" data-hits="5" data-linenumber="32"> + <span class="hits">5</span> <code class="ruby"> namespace @namespace_name do</code> </li> - <li class="covered" data-hits="6" data-linenumber="52"> - <span class="hits">6</span> + <li class="covered" data-hits="5" data-linenumber="33"> + <span class="hits">5</span> <code class="ruby"> yield</code> </li> - <li class="never" data-hits="" data-linenumber="53"> + <li class="never" data-hits="" data-linenumber="34"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="54"> + <li class="never" data-hits="" data-linenumber="35"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="55"> + <li class="never" data-hits="" data-linenumber="36"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="56"> + <li class="never" data-hits="" data-linenumber="37"> <code class="ruby"> else</code> </li> - <li class="covered" data-hits="5" data-linenumber="57"> + <li class="covered" data-hits="5" data-linenumber="38"> <span class="hits">5</span> <code class="ruby"> tasknames.map do |taskname|</code> </li> - <li class="covered" data-hits="5" data-linenumber="58"> + <li class="covered" data-hits="5" data-linenumber="39"> <span class="hits">5</span> <code class="ruby"> [@namespace_name, taskname].compact.join(&quot;:&quot;)</code> </li> - <li class="never" data-hits="" data-linenumber="59"> + <li class="never" data-hits="" data-linenumber="40"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="60"> + <li class="never" data-hits="" data-linenumber="41"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="61"> + <li class="never" data-hits="" data-linenumber="42"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="62"> + <li class="never" data-hits="" data-linenumber="43"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="63"> + <li class="covered" data-hits="1" data-linenumber="44"> <span class="hits">1</span> <code class="ruby"> def root_task</code> </li> - <li class="covered" data-hits="5" data-linenumber="64"> + <li class="covered" data-hits="5" data-linenumber="45"> <span class="hits">5</span> <code class="ruby"> @namespace_name || :default</code> </li> - <li class="never" data-hits="" data-linenumber="65"> + <li class="never" data-hits="" data-linenumber="46"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="66"> + <li class="never" data-hits="" data-linenumber="47"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="67"> + <li class="covered" data-hits="1" data-linenumber="48"> <span class="hits">1</span> <code class="ruby"> def default_namespace</code> </li> - <li class="never" data-hits="" data-linenumber="68"> + <li class="never" data-hits="" data-linenumber="49"> <code class="ruby"> nil</code> </li> - <li class="never" data-hits="" data-linenumber="69"> + <li class="never" data-hits="" data-linenumber="50"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="70"> + <li class="never" data-hits="" data-linenumber="51"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="71"> + <li class="covered" data-hits="1" data-linenumber="52"> <span class="hits">1</span> <code class="ruby"> def [](taskname)</code> </li> - <li class="covered" data-hits="5" data-linenumber="72"> + <li class="covered" data-hits="5" data-linenumber="53"> <span class="hits">5</span> <code class="ruby"> in_namespace(taskname).first</code> </li> - <li class="never" data-hits="" data-linenumber="73"> + <li class="never" data-hits="" data-linenumber="54"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="74"> + <li class="never" data-hits="" data-linenumber="55"> <code class="ruby"> end</code> </li> - <li class="covered" data-hits="1" data-linenumber="75"> + <li class="covered" data-hits="1" data-linenumber="56"> <span class="hits">1</span> <code class="ruby"> Tasklib = TaskLib #Because I can never remember</code> </li> - <li class="never" data-hits="" data-linenumber="76"> + <li class="never" data-hits="" data-linenumber="57"> <code class="ruby">end</code> </li> @@ -3298,15 +3688,15 @@ </div> <div class="source_table" id="d05b479afa4321ddf827a6b5af14020183ee07b9"> <div class="header"> <h3>lib/mattock/testing/mock-command-line.rb</h3> - <h4><span class="green">92.86 %</span> covered</h4> + <h4><span class="green">94.44 %</span> covered</h4> <div> - <b>14</b> relevant lines. - <span class="green"><b>13</b> lines covered</span> and - <span class="red"><b>1</b> lines missed.</span> + <b>36</b> relevant lines. + <span class="green"><b>34</b> lines covered</span> and + <span class="red"><b>2</b> lines missed.</span> </div> </div> <pre> <ol> @@ -3462,10 +3852,256 @@ </li> <li class="never" data-hits="" data-linenumber="26"> + <code class="ruby"></code> + </li> + + <li class="covered" data-hits="1" data-linenumber="27"> + <span class="hits">1</span> + + <code class="ruby"> module CommandLineExampleGroup</code> + </li> + + <li class="covered" data-hits="1" data-linenumber="28"> + <span class="hits">1</span> + + <code class="ruby"> def self.included(group)</code> + </li> + + <li class="covered" data-hits="1" data-linenumber="29"> + <span class="hits">1</span> + + <code class="ruby"> group.class_eval do</code> + </li> + + <li class="covered" data-hits="1" data-linenumber="30"> + <span class="hits">1</span> + + <code class="ruby"> let :pairs do</code> + </li> + + <li class="covered" data-hits="1" data-linenumber="31"> + <span class="hits">1</span> + + <code class="ruby"> []</code> + </li> + + <li class="never" data-hits="" data-linenumber="32"> + + + <code class="ruby"> end</code> + </li> + + <li class="never" data-hits="" data-linenumber="33"> + + + <code class="ruby"></code> + </li> + + <li class="covered" data-hits="1" data-linenumber="34"> + <span class="hits">1</span> + + <code class="ruby"> before :each do</code> + </li> + + <li class="covered" data-hits="1" data-linenumber="35"> + <span class="hits">1</span> + + <code class="ruby"> Mattock::CommandLine.should_receive(:execute) do |cmd|</code> + </li> + + <li class="covered" data-hits="2" data-linenumber="36"> + <span class="hits">2</span> + + <code class="ruby"> pattern, res = pairs.shift</code> + </li> + + <li class="covered" data-hits="2" data-linenumber="37"> + <span class="hits">2</span> + + <code class="ruby"> pattern =~ cmd</code> + </li> + + <li class="covered" data-hits="2" data-linenumber="38"> + <span class="hits">2</span> + + <code class="ruby"> Mattock::MockCommandResult.create(*res)</code> + </li> + + <li class="never" data-hits="" data-linenumber="39"> + + + <code class="ruby"> end.any_number_of_times</code> + </li> + + <li class="never" data-hits="" data-linenumber="40"> + + + <code class="ruby"> end</code> + </li> + + <li class="never" data-hits="" data-linenumber="41"> + + + <code class="ruby"></code> + </li> + + <li class="covered" data-hits="1" data-linenumber="42"> + <span class="hits">1</span> + + <code class="ruby"> after :each do</code> + </li> + + <li class="covered" data-hits="1" data-linenumber="43"> + <span class="hits">1</span> + + <code class="ruby"> pairs.should have_all_been_called</code> + </li> + + <li class="never" data-hits="" data-linenumber="44"> + + + <code class="ruby"> end</code> + </li> + + <li class="never" data-hits="" data-linenumber="45"> + + + <code class="ruby"> end</code> + </li> + + <li class="never" data-hits="" data-linenumber="46"> + + + <code class="ruby"> end</code> + </li> + + <li class="never" data-hits="" data-linenumber="47"> + + + <code class="ruby"></code> + </li> + + <li class="covered" data-hits="1" data-linenumber="48"> + <span class="hits">1</span> + + <code class="ruby"> def expect_command(cmd, *result)</code> + </li> + + <li class="covered" data-hits="2" data-linenumber="49"> + <span class="hits">2</span> + + <code class="ruby"> pairs &lt;&lt; [cmd, result]</code> + </li> + + <li class="never" data-hits="" data-linenumber="50"> + + + <code class="ruby"> end</code> + </li> + + <li class="never" data-hits="" data-linenumber="51"> + + + <code class="ruby"></code> + </li> + + <li class="covered" data-hits="1" data-linenumber="52"> + <span class="hits">1</span> + + <code class="ruby"> module Matchers</code> + </li> + + <li class="covered" data-hits="1" data-linenumber="53"> + <span class="hits">1</span> + + <code class="ruby"> extend RSpec::Matchers::DSL</code> + </li> + + <li class="never" data-hits="" data-linenumber="54"> + + + <code class="ruby"></code> + </li> + + <li class="covered" data-hits="1" data-linenumber="55"> + <span class="hits">1</span> + + <code class="ruby"> define :have_all_been_called do</code> + </li> + + <li class="covered" data-hits="1" data-linenumber="56"> + <span class="hits">1</span> + + <code class="ruby"> match do |list|</code> + </li> + + <li class="covered" data-hits="1" data-linenumber="57"> + <span class="hits">1</span> + + <code class="ruby"> list.empty?</code> + </li> + + <li class="never" data-hits="" data-linenumber="58"> + + + <code class="ruby"> end</code> + </li> + + <li class="never" data-hits="" data-linenumber="59"> + + + <code class="ruby"></code> + </li> + + <li class="covered" data-hits="1" data-linenumber="60"> + <span class="hits">1</span> + + <code class="ruby"> failure_message_for_should do |list|</code> + </li> + + <li class="missed" data-hits="0" data-linenumber="61"> + + + <code class="ruby"> &quot;Expected all commands to be run, but: #{list.map{|item| item[0].source.inspect}.join(&quot;, &quot;)} #{list.length &gt; 1 ? &quot;were&quot; : &quot;was&quot;} not.&quot;</code> + </li> + + <li class="never" data-hits="" data-linenumber="62"> + + + <code class="ruby"> end</code> + </li> + + <li class="never" data-hits="" data-linenumber="63"> + + + <code class="ruby"> end</code> + </li> + + <li class="never" data-hits="" data-linenumber="64"> + + + <code class="ruby"> end</code> + </li> + + <li class="covered" data-hits="1" data-linenumber="65"> + <span class="hits">1</span> + + <code class="ruby"> include Matchers</code> + </li> + + <li class="never" data-hits="" data-linenumber="66"> + + + <code class="ruby"> end</code> + </li> + + <li class="never" data-hits="" data-linenumber="67"> + + <code class="ruby">end</code> </li> </ol> </pre> @@ -3952,9 +4588,255 @@ <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="79"> + + + <code class="ruby">end</code> + </li> + + </ol> + </pre> +</div> + + <div class="source_table" id="b325ca10da29fcd26651ac26205d38639667a9a7"> + <div class="header"> + <h3>lib/mattock/testing/record-commands.rb</h3> + <h4><span class="green">95.45 %</span> covered</h4> + <div> + <b>22</b> relevant lines. + <span class="green"><b>21</b> lines covered</span> and + <span class="red"><b>1</b> lines missed.</span> + </div> + </div> + + <pre> + <ol> + + <li class="covered" data-hits="1" data-linenumber="1"> + <span class="hits">1</span> + + <code class="ruby">require 'mattock/command-line'</code> + </li> + + <li class="never" data-hits="" data-linenumber="2"> + + + <code class="ruby"></code> + </li> + + <li class="covered" data-hits="1" data-linenumber="3"> + <span class="hits">1</span> + + <code class="ruby">module Mattock</code> + </li> + + <li class="covered" data-hits="1" data-linenumber="4"> + <span class="hits">1</span> + + <code class="ruby"> class CommandLine</code> + </li> + + <li class="covered" data-hits="1" data-linenumber="5"> + <span class="hits">1</span> + + <code class="ruby"> @@commands = []</code> + </li> + + <li class="covered" data-hits="1" data-linenumber="6"> + <span class="hits">1</span> + + <code class="ruby"> class &lt;&lt; self</code> + </li> + + <li class="covered" data-hits="1" data-linenumber="7"> + <span class="hits">1</span> + + <code class="ruby"> alias original_execute execute</code> + </li> + + <li class="never" data-hits="" data-linenumber="8"> + + + <code class="ruby"></code> + </li> + + <li class="covered" data-hits="1" data-linenumber="9"> + <span class="hits">1</span> + + <code class="ruby"> def execute(command)</code> + </li> + + <li class="covered" data-hits="5" data-linenumber="10"> + <span class="hits">5</span> + + <code class="ruby"> result = original_execute(command)</code> + </li> + + <li class="covered" data-hits="5" data-linenumber="11"> + <span class="hits">5</span> + + <code class="ruby"> @@commands &lt;&lt; [command, result]</code> + </li> + + <li class="covered" data-hits="5" data-linenumber="12"> + <span class="hits">5</span> + + <code class="ruby"> return result</code> + </li> + + <li class="never" data-hits="" data-linenumber="13"> + + + <code class="ruby"> end</code> + </li> + + <li class="never" data-hits="" data-linenumber="14"> + + + <code class="ruby"></code> + </li> + + <li class="covered" data-hits="1" data-linenumber="15"> + <span class="hits">1</span> + + <code class="ruby"> attr_accessor :command_recording_path</code> + </li> + + <li class="never" data-hits="" data-linenumber="16"> + + + <code class="ruby"></code> + </li> + + <li class="covered" data-hits="1" data-linenumber="17"> + <span class="hits">1</span> + + <code class="ruby"> def command_recording_path</code> + </li> + + <li class="covered" data-hits="2" data-linenumber="18"> + <span class="hits">2</span> + + <code class="ruby"> @command_recording_path ||= ENV['MATTOCK_CMDREC']</code> + </li> + + <li class="never" data-hits="" data-linenumber="19"> + + + <code class="ruby"> end</code> + </li> + + <li class="never" data-hits="" data-linenumber="20"> + + + <code class="ruby"></code> + </li> + + <li class="covered" data-hits="1" data-linenumber="21"> + <span class="hits">1</span> + + <code class="ruby"> def emit_recording</code> + </li> + + <li class="covered" data-hits="1" data-linenumber="22"> + <span class="hits">1</span> + + <code class="ruby"> io = $stderr</code> + </li> + + <li class="covered" data-hits="1" data-linenumber="23"> + <span class="hits">1</span> + + <code class="ruby"> if command_recording_path</code> + </li> + + <li class="covered" data-hits="1" data-linenumber="24"> + <span class="hits">1</span> + + <code class="ruby"> io = File.open(command_recording_path, &quot;w&quot;)</code> + </li> + + <li class="never" data-hits="" data-linenumber="25"> + + + <code class="ruby"> else</code> + </li> + + <li class="missed" data-hits="0" data-linenumber="26"> + + + <code class="ruby"> io.puts &quot;Set MATTOCK_CMDREC to write to a path&quot;</code> + </li> + + <li class="never" data-hits="" data-linenumber="27"> + + + <code class="ruby"> end</code> + </li> + + <li class="covered" data-hits="1" data-linenumber="28"> + <span class="hits">1</span> + + <code class="ruby"> @@commands.each do |pair|</code> + </li> + + <li class="covered" data-hits="5" data-linenumber="29"> + <span class="hits">5</span> + + <code class="ruby"> io.puts &quot;[/#{pair[0]}/, #{[pair[1].exit_code, pair[1].streams].inspect}]&quot;</code> + </li> + + <li class="never" data-hits="" data-linenumber="30"> + + + <code class="ruby"> end</code> + </li> + + <li class="never" data-hits="" data-linenumber="31"> + + + <code class="ruby"> end</code> + </li> + + <li class="never" data-hits="" data-linenumber="32"> + + + <code class="ruby"> end</code> + </li> + + <li class="never" data-hits="" data-linenumber="33"> + + + <code class="ruby"> end</code> + </li> + + <li class="never" data-hits="" data-linenumber="34"> + + + <code class="ruby">end</code> + </li> + + <li class="never" data-hits="" data-linenumber="35"> + + + <code class="ruby"></code> + </li> + + <li class="covered" data-hits="1" data-linenumber="36"> + <span class="hits">1</span> + + <code class="ruby">at_exit do</code> + </li> + + <li class="covered" data-hits="1" data-linenumber="37"> + <span class="hits">1</span> + + <code class="ruby"> Mattock::CommandLine.emit_recording</code> + </li> + + <li class="never" data-hits="" data-linenumber="38"> <code class="ruby">end</code> </li>