mattock 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/doc/Specifications CHANGED
@@ -33,5 +33,5 @@ Mattock::Configurable
33
33
  should complain about unset nested required fields
34
34
  should not complain when required fields are set
35
35
 
36
- Finished in 0.06128 seconds
36
+ Finished in 0.03167 seconds
37
37
  19 examples, 0 failures
@@ -23,27 +23,27 @@
23
23
  <img src="./assets/0.5.3/loading.gif" alt="loading"/>
24
24
  </div>
25
25
  <div id="wrapper" style="display:none;">
26
- <div class="timestamp">Generated <abbr class="timeago" title="2012-02-01T11:53:33-08:00">2012-02-01T11:53:33-08:00</abbr></div>
26
+ <div class="timestamp">Generated <abbr class="timeago" title="2012-02-04T10:44:02-08:00">2012-02-04T10:44:02-08:00</abbr></div>
27
27
  <ul class="group_tabs"></ul>
28
28
 
29
29
  <div id="content">
30
30
  <div class="file_list_container" id="AllFiles">
31
31
  <h2>
32
32
  <span class="group_name">All Files</span>
33
- (<span class="covered_percent"><span class="green">92.84%</span></span>
33
+ (<span class="covered_percent"><span class="green">92.15%</span></span>
34
34
  covered at
35
35
  <span class="covered_strength">
36
36
  <span class="green">
37
- 2.63
37
+ 2.62
38
38
  </span>
39
39
  </span> hits/line)
40
40
  </h2>
41
41
  <a name="AllFiles"></a>
42
42
  <div>
43
43
  <b>12</b> files in total.
44
- <b>419</b> relevant lines.
45
- <span class="green"><b>389</b> lines covered</span> and
46
- <span class="red"><b>30</b> lines missed </span>
44
+ <b>433</b> relevant lines.
45
+ <span class="green"><b>399</b> lines covered</span> and
46
+ <span class="red"><b>34</b> lines missed </span>
47
47
  </div>
48
48
  <table class="file_list">
49
49
  <thead>
@@ -101,12 +101,12 @@
101
101
 
102
102
  <tr>
103
103
  <td class="strong"><a href="#151b5abc8f09f0fc2932ac98c07e3b516a518e3e" class="src_link" title="lib/mattock/configurable.rb">lib/mattock/configurable.rb</a></td>
104
- <td class="green strong">96.67 %</td>
105
- <td>157</td>
106
- <td>90</td>
107
- <td>87</td>
108
- <td>3</td>
109
- <td>8.1</td>
104
+ <td class="green strong">95.7 %</td>
105
+ <td>162</td>
106
+ <td>93</td>
107
+ <td>89</td>
108
+ <td>4</td>
109
+ <td>8.0</td>
110
110
  </tr>
111
111
 
112
112
  <tr>
@@ -121,11 +121,11 @@
121
121
 
122
122
  <tr>
123
123
  <td class="strong"><a href="#7cc8f09739f0b95d0fd16321baf73b5d3c6eb35b" class="src_link" title="lib/mattock/task.rb">lib/mattock/task.rb</a></td>
124
- <td class="green strong">94.74 %</td>
125
- <td>35</td>
126
- <td>19</td>
127
- <td>18</td>
128
- <td>1</td>
124
+ <td class="yellow strong">86.67 %</td>
125
+ <td>53</td>
126
+ <td>30</td>
127
+ <td>26</td>
128
+ <td>4</td>
129
129
  <td>0.9</td>
130
130
  </tr>
131
131
 
@@ -1656,11 +1656,11 @@
1656
1656
  <div class="source_table" id="151b5abc8f09f0fc2932ac98c07e3b516a518e3e">
1657
1657
  <div class="header">
1658
1658
  <h3>lib/mattock/configurable.rb</h3>
1659
- <h4><span class="green">96.67 %</span> covered</h4>
1659
+ <h4><span class="green">95.7 %</span> covered</h4>
1660
1660
  <div>
1661
- <b>90</b> relevant lines.
1662
- <span class="green"><b>87</b> lines covered</span> and
1663
- <span class="red"><b>3</b> lines missed.</span>
1661
+ <b>93</b> relevant lines.
1662
+ <span class="green"><b>89</b> lines covered</span> and
1663
+ <span class="red"><b>4</b> lines missed.</span>
1664
1664
  </div>
1665
1665
  </div>
1666
1666
 
@@ -1769,8 +1769,8 @@
1769
1769
  <code class="ruby"> def default_values</code>
1770
1770
  </li>
1771
1771
 
1772
- <li class="covered" data-hits="97" data-linenumber="18">
1773
- <span class="hits">97</span>
1772
+ <li class="covered" data-hits="99" data-linenumber="18">
1773
+ <span class="hits">99</span>
1774
1774
 
1775
1775
  <code class="ruby"> @default_values ||= {}</code>
1776
1776
  </li>
@@ -1817,14 +1817,14 @@
1817
1817
  <code class="ruby"> default_values.each_pair do |name,value|</code>
1818
1818
  </li>
1819
1819
 
1820
- <li class="covered" data-hits="43" data-linenumber="26">
1821
- <span class="hits">43</span>
1820
+ <li class="covered" data-hits="44" data-linenumber="26">
1821
+ <span class="hits">44</span>
1822
1822
 
1823
1823
  <code class="ruby"> instance.__send__(&quot;#{name}=&quot;, value)</code>
1824
1824
  </li>
1825
1825
 
1826
- <li class="covered" data-hits="43" data-linenumber="27">
1827
- <span class="hits">43</span>
1826
+ <li class="covered" data-hits="44" data-linenumber="27">
1827
+ <span class="hits">44</span>
1828
1828
 
1829
1829
  <code class="ruby"> if Configurable === value</code>
1830
1830
  </li>
@@ -1895,14 +1895,14 @@
1895
1895
  <code class="ruby"> default_values.each_pair do |name,value|</code>
1896
1896
  </li>
1897
1897
 
1898
- <li class="covered" data-hits="36" data-linenumber="39">
1899
- <span class="hits">36</span>
1898
+ <li class="covered" data-hits="37" data-linenumber="39">
1899
+ <span class="hits">37</span>
1900
1900
 
1901
1901
  <code class="ruby"> set_value = instance.__send__(name)</code>
1902
1902
  </li>
1903
1903
 
1904
- <li class="covered" data-hits="36" data-linenumber="40">
1905
- <span class="hits">36</span>
1904
+ <li class="covered" data-hits="37" data-linenumber="40">
1905
+ <span class="hits">37</span>
1906
1906
 
1907
1907
  <code class="ruby"> if value == RequiredField and set_value == RequiredField</code>
1908
1908
  </li>
@@ -1925,8 +1925,8 @@
1925
1925
  <code class="ruby"> end</code>
1926
1926
  </li>
1927
1927
 
1928
- <li class="covered" data-hits="33" data-linenumber="44">
1929
- <span class="hits">33</span>
1928
+ <li class="covered" data-hits="34" data-linenumber="44">
1929
+ <span class="hits">34</span>
1930
1930
 
1931
1931
  <code class="ruby"> if Configurable === set_value</code>
1932
1932
  </li>
@@ -2009,14 +2009,14 @@
2009
2009
  <code class="ruby"> default_values.keys.each do |field|</code>
2010
2010
  </li>
2011
2011
 
2012
- <li class="covered" data-hits="8" data-linenumber="58">
2013
- <span class="hits">8</span>
2012
+ <li class="covered" data-hits="9" data-linenumber="58">
2013
+ <span class="hits">9</span>
2014
2014
 
2015
2015
  <code class="ruby"> begin</code>
2016
2016
  </li>
2017
2017
 
2018
- <li class="covered" data-hits="8" data-linenumber="59">
2019
- <span class="hits">8</span>
2018
+ <li class="covered" data-hits="9" data-linenumber="59">
2019
+ <span class="hits">9</span>
2020
2020
 
2021
2021
  <code class="ruby"> to.__send__(&quot;#{field}=&quot;, from.__send__(field))</code>
2022
2022
  </li>
@@ -2207,20 +2207,20 @@
2207
2207
  <code class="ruby"> def setting(name, default_value = RequiredField)</code>
2208
2208
  </li>
2209
2209
 
2210
- <li class="covered" data-hits="18" data-linenumber="91">
2211
- <span class="hits">18</span>
2210
+ <li class="covered" data-hits="19" data-linenumber="91">
2211
+ <span class="hits">19</span>
2212
2212
 
2213
2213
  <code class="ruby"> name = name.to_sym</code>
2214
2214
  </li>
2215
2215
 
2216
- <li class="covered" data-hits="18" data-linenumber="92">
2217
- <span class="hits">18</span>
2216
+ <li class="covered" data-hits="19" data-linenumber="92">
2217
+ <span class="hits">19</span>
2218
2218
 
2219
2219
  <code class="ruby"> attr_accessor(name)</code>
2220
2220
  </li>
2221
2221
 
2222
- <li class="covered" data-hits="18" data-linenumber="93">
2223
- <span class="hits">18</span>
2222
+ <li class="covered" data-hits="19" data-linenumber="93">
2223
+ <span class="hits">19</span>
2224
2224
 
2225
2225
  <code class="ruby"> if default_values.has_key?(name) and default_values[name] != default_value</code>
2226
2226
  </li>
@@ -2237,8 +2237,8 @@
2237
2237
  <code class="ruby"> end</code>
2238
2238
  </li>
2239
2239
 
2240
- <li class="covered" data-hits="18" data-linenumber="96">
2241
- <span class="hits">18</span>
2240
+ <li class="covered" data-hits="19" data-linenumber="96">
2241
+ <span class="hits">19</span>
2242
2242
 
2243
2243
  <code class="ruby"> default_values[name] = default_value</code>
2244
2244
  </li>
@@ -2345,265 +2345,295 @@
2345
2345
  <code class="ruby"> self.class.copy_settings(self, other)</code>
2346
2346
  </li>
2347
2347
 
2348
- <li class="never" data-hits="" data-linenumber="114">
2348
+ <li class="covered" data-hits="1" data-linenumber="114">
2349
+ <span class="hits">1</span>
2350
+
2351
+ <code class="ruby"> self</code>
2352
+ </li>
2353
+
2354
+ <li class="never" data-hits="" data-linenumber="115">
2349
2355
 
2350
2356
 
2351
2357
  <code class="ruby"> end</code>
2352
2358
  </li>
2353
2359
 
2354
- <li class="never" data-hits="" data-linenumber="115">
2360
+ <li class="never" data-hits="" data-linenumber="116">
2355
2361
 
2356
2362
 
2357
2363
  <code class="ruby"></code>
2358
2364
  </li>
2359
2365
 
2360
- <li class="covered" data-hits="1" data-linenumber="116">
2366
+ <li class="covered" data-hits="1" data-linenumber="117">
2361
2367
  <span class="hits">1</span>
2362
2368
 
2363
2369
  <code class="ruby"> def setup_defaults</code>
2364
2370
  </li>
2365
2371
 
2366
- <li class="covered" data-hits="10" data-linenumber="117">
2372
+ <li class="covered" data-hits="10" data-linenumber="118">
2367
2373
  <span class="hits">10</span>
2368
2374
 
2369
2375
  <code class="ruby"> self.class.set_defaults_on(self)</code>
2370
2376
  </li>
2371
2377
 
2372
- <li class="covered" data-hits="10" data-linenumber="118">
2378
+ <li class="covered" data-hits="10" data-linenumber="119">
2373
2379
  <span class="hits">10</span>
2374
2380
 
2375
2381
  <code class="ruby"> self</code>
2376
2382
  </li>
2377
2383
 
2378
- <li class="never" data-hits="" data-linenumber="119">
2384
+ <li class="never" data-hits="" data-linenumber="120">
2379
2385
 
2380
2386
 
2381
2387
  <code class="ruby"> end</code>
2382
2388
  </li>
2383
2389
 
2384
- <li class="never" data-hits="" data-linenumber="120">
2390
+ <li class="never" data-hits="" data-linenumber="121">
2385
2391
 
2386
2392
 
2387
2393
  <code class="ruby"></code>
2388
2394
  </li>
2389
2395
 
2390
- <li class="covered" data-hits="1" data-linenumber="121">
2396
+ <li class="covered" data-hits="1" data-linenumber="122">
2391
2397
  <span class="hits">1</span>
2392
2398
 
2393
2399
  <code class="ruby"> def check_required</code>
2394
2400
  </li>
2395
2401
 
2396
- <li class="covered" data-hits="9" data-linenumber="122">
2402
+ <li class="covered" data-hits="9" data-linenumber="123">
2397
2403
  <span class="hits">9</span>
2398
2404
 
2399
2405
  <code class="ruby"> missing = self.class.missing_required_fields_on(self)</code>
2400
2406
  </li>
2401
2407
 
2402
- <li class="covered" data-hits="9" data-linenumber="123">
2408
+ <li class="covered" data-hits="9" data-linenumber="124">
2403
2409
  <span class="hits">9</span>
2404
2410
 
2405
2411
  <code class="ruby"> unless missing.empty?</code>
2406
2412
  </li>
2407
2413
 
2408
- <li class="covered" data-hits="5" data-linenumber="124">
2414
+ <li class="covered" data-hits="5" data-linenumber="125">
2409
2415
  <span class="hits">5</span>
2410
2416
 
2411
2417
  <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>
2412
2418
  </li>
2413
2419
 
2414
- <li class="never" data-hits="" data-linenumber="125">
2420
+ <li class="never" data-hits="" data-linenumber="126">
2415
2421
 
2416
2422
 
2417
2423
  <code class="ruby"> end</code>
2418
2424
  </li>
2419
2425
 
2420
- <li class="covered" data-hits="7" data-linenumber="126">
2426
+ <li class="covered" data-hits="7" data-linenumber="127">
2421
2427
  <span class="hits">7</span>
2422
2428
 
2423
2429
  <code class="ruby"> self</code>
2424
2430
  </li>
2425
2431
 
2426
- <li class="never" data-hits="" data-linenumber="127">
2432
+ <li class="never" data-hits="" data-linenumber="128">
2427
2433
 
2428
2434
 
2429
2435
  <code class="ruby"> end</code>
2430
2436
  </li>
2431
2437
 
2432
- <li class="never" data-hits="" data-linenumber="128">
2438
+ <li class="never" data-hits="" data-linenumber="129">
2439
+
2440
+
2441
+ <code class="ruby"></code>
2442
+ </li>
2443
+
2444
+ <li class="covered" data-hits="1" data-linenumber="130">
2445
+ <span class="hits">1</span>
2446
+
2447
+ <code class="ruby"> def unset?(value)</code>
2448
+ </li>
2449
+
2450
+ <li class="missed" data-hits="0" data-linenumber="131">
2451
+
2452
+
2453
+ <code class="ruby"> value == RequiredField</code>
2454
+ </li>
2455
+
2456
+ <li class="never" data-hits="" data-linenumber="132">
2457
+
2458
+
2459
+ <code class="ruby"> end</code>
2460
+ </li>
2461
+
2462
+ <li class="never" data-hits="" data-linenumber="133">
2433
2463
 
2434
2464
 
2435
2465
  <code class="ruby"></code>
2436
2466
  </li>
2437
2467
 
2438
- <li class="covered" data-hits="1" data-linenumber="129">
2468
+ <li class="covered" data-hits="1" data-linenumber="134">
2439
2469
  <span class="hits">1</span>
2440
2470
 
2441
2471
  <code class="ruby"> def setting(name, default_value = nil)</code>
2442
2472
  </li>
2443
2473
 
2444
- <li class="covered" data-hits="3" data-linenumber="130">
2474
+ <li class="covered" data-hits="3" data-linenumber="135">
2445
2475
  <span class="hits">3</span>
2446
2476
 
2447
2477
  <code class="ruby"> self.class.setting(name, default_value)</code>
2448
2478
  </li>
2449
2479
 
2450
- <li class="covered" data-hits="3" data-linenumber="131">
2480
+ <li class="covered" data-hits="3" data-linenumber="136">
2451
2481
  <span class="hits">3</span>
2452
2482
 
2453
2483
  <code class="ruby"> instance_variable_set(&quot;@#{name}&quot;, default_value)</code>
2454
2484
  </li>
2455
2485
 
2456
- <li class="never" data-hits="" data-linenumber="132">
2486
+ <li class="never" data-hits="" data-linenumber="137">
2457
2487
 
2458
2488
 
2459
2489
  <code class="ruby"> end</code>
2460
2490
  </li>
2461
2491
 
2462
- <li class="never" data-hits="" data-linenumber="133">
2492
+ <li class="never" data-hits="" data-linenumber="138">
2463
2493
 
2464
2494
 
2465
2495
  <code class="ruby"></code>
2466
2496
  </li>
2467
2497
 
2468
- <li class="covered" data-hits="1" data-linenumber="134">
2498
+ <li class="covered" data-hits="1" data-linenumber="139">
2469
2499
  <span class="hits">1</span>
2470
2500
 
2471
2501
  <code class="ruby"> def settings(hash)</code>
2472
2502
  </li>
2473
2503
 
2474
- <li class="covered" data-hits="2" data-linenumber="135">
2504
+ <li class="covered" data-hits="2" data-linenumber="140">
2475
2505
  <span class="hits">2</span>
2476
2506
 
2477
2507
  <code class="ruby"> hash.each_pair do |name, value|</code>
2478
2508
  </li>
2479
2509
 
2480
- <li class="covered" data-hits="3" data-linenumber="136">
2510
+ <li class="covered" data-hits="3" data-linenumber="141">
2481
2511
  <span class="hits">3</span>
2482
2512
 
2483
2513
  <code class="ruby"> setting(name, value)</code>
2484
2514
  </li>
2485
2515
 
2486
- <li class="never" data-hits="" data-linenumber="137">
2516
+ <li class="never" data-hits="" data-linenumber="142">
2487
2517
 
2488
2518
 
2489
2519
  <code class="ruby"> end</code>
2490
2520
  </li>
2491
2521
 
2492
- <li class="covered" data-hits="2" data-linenumber="138">
2522
+ <li class="covered" data-hits="2" data-linenumber="143">
2493
2523
  <span class="hits">2</span>
2494
2524
 
2495
2525
  <code class="ruby"> return self</code>
2496
2526
  </li>
2497
2527
 
2498
- <li class="never" data-hits="" data-linenumber="139">
2528
+ <li class="never" data-hits="" data-linenumber="144">
2499
2529
 
2500
2530
 
2501
2531
  <code class="ruby"> end</code>
2502
2532
  </li>
2503
2533
 
2504
- <li class="never" data-hits="" data-linenumber="140">
2534
+ <li class="never" data-hits="" data-linenumber="145">
2505
2535
 
2506
2536
 
2507
2537
  <code class="ruby"></code>
2508
2538
  </li>
2509
2539
 
2510
- <li class="covered" data-hits="1" data-linenumber="141">
2540
+ <li class="covered" data-hits="1" data-linenumber="146">
2511
2541
  <span class="hits">1</span>
2512
2542
 
2513
2543
  <code class="ruby"> def required_fields(*names)</code>
2514
2544
  </li>
2515
2545
 
2516
- <li class="covered" data-hits="1" data-linenumber="142">
2546
+ <li class="covered" data-hits="1" data-linenumber="147">
2517
2547
  <span class="hits">1</span>
2518
2548
 
2519
2549
  <code class="ruby"> self.class.required_fields(*names)</code>
2520
2550
  </li>
2521
2551
 
2522
- <li class="covered" data-hits="1" data-linenumber="143">
2552
+ <li class="covered" data-hits="1" data-linenumber="148">
2523
2553
  <span class="hits">1</span>
2524
2554
 
2525
2555
  <code class="ruby"> self</code>
2526
2556
  </li>
2527
2557
 
2528
- <li class="never" data-hits="" data-linenumber="144">
2558
+ <li class="never" data-hits="" data-linenumber="149">
2529
2559
 
2530
2560
 
2531
2561
  <code class="ruby"> end</code>
2532
2562
  </li>
2533
2563
 
2534
- <li class="covered" data-hits="1" data-linenumber="145">
2564
+ <li class="covered" data-hits="1" data-linenumber="150">
2535
2565
  <span class="hits">1</span>
2536
2566
 
2537
2567
  <code class="ruby"> alias required_field required_fields</code>
2538
2568
  </li>
2539
2569
 
2540
- <li class="never" data-hits="" data-linenumber="146">
2570
+ <li class="never" data-hits="" data-linenumber="151">
2541
2571
 
2542
2572
 
2543
2573
  <code class="ruby"></code>
2544
2574
  </li>
2545
2575
 
2546
- <li class="covered" data-hits="1" data-linenumber="147">
2576
+ <li class="covered" data-hits="1" data-linenumber="152">
2547
2577
  <span class="hits">1</span>
2548
2578
 
2549
2579
  <code class="ruby"> def nil_fields(*names)</code>
2550
2580
  </li>
2551
2581
 
2552
- <li class="missed" data-hits="0" data-linenumber="148">
2582
+ <li class="missed" data-hits="0" data-linenumber="153">
2553
2583
 
2554
2584
 
2555
2585
  <code class="ruby"> self.class.nil_fields(*names)</code>
2556
2586
  </li>
2557
2587
 
2558
- <li class="missed" data-hits="0" data-linenumber="149">
2588
+ <li class="missed" data-hits="0" data-linenumber="154">
2559
2589
 
2560
2590
 
2561
2591
  <code class="ruby"> self</code>
2562
2592
  </li>
2563
2593
 
2564
- <li class="never" data-hits="" data-linenumber="150">
2594
+ <li class="never" data-hits="" data-linenumber="155">
2565
2595
 
2566
2596
 
2567
2597
  <code class="ruby"> end</code>
2568
2598
  </li>
2569
2599
 
2570
- <li class="covered" data-hits="1" data-linenumber="151">
2600
+ <li class="covered" data-hits="1" data-linenumber="156">
2571
2601
  <span class="hits">1</span>
2572
2602
 
2573
2603
  <code class="ruby"> alias nil_field nil_fields</code>
2574
2604
  </li>
2575
2605
 
2576
- <li class="never" data-hits="" data-linenumber="152">
2606
+ <li class="never" data-hits="" data-linenumber="157">
2577
2607
 
2578
2608
 
2579
2609
  <code class="ruby"></code>
2580
2610
  </li>
2581
2611
 
2582
- <li class="covered" data-hits="1" data-linenumber="153">
2612
+ <li class="covered" data-hits="1" data-linenumber="158">
2583
2613
  <span class="hits">1</span>
2584
2614
 
2585
2615
  <code class="ruby"> class Struct</code>
2586
2616
  </li>
2587
2617
 
2588
- <li class="covered" data-hits="1" data-linenumber="154">
2618
+ <li class="covered" data-hits="1" data-linenumber="159">
2589
2619
  <span class="hits">1</span>
2590
2620
 
2591
2621
  <code class="ruby"> include Configurable</code>
2592
2622
  </li>
2593
2623
 
2594
- <li class="never" data-hits="" data-linenumber="155">
2624
+ <li class="never" data-hits="" data-linenumber="160">
2595
2625
 
2596
2626
 
2597
2627
  <code class="ruby"> end</code>
2598
2628
  </li>
2599
2629
 
2600
- <li class="never" data-hits="" data-linenumber="156">
2630
+ <li class="never" data-hits="" data-linenumber="161">
2601
2631
 
2602
2632
 
2603
2633
  <code class="ruby"> end</code>
2604
2634
  </li>
2605
2635
 
2606
- <li class="never" data-hits="" data-linenumber="157">
2636
+ <li class="never" data-hits="" data-linenumber="162">
2607
2637
 
2608
2638
 
2609
2639
  <code class="ruby">end</code>
@@ -2814,11 +2844,11 @@
2814
2844
  <div class="source_table" id="7cc8f09739f0b95d0fd16321baf73b5d3c6eb35b">
2815
2845
  <div class="header">
2816
2846
  <h3>lib/mattock/task.rb</h3>
2817
- <h4><span class="green">94.74 %</span> covered</h4>
2847
+ <h4><span class="yellow">86.67 %</span> covered</h4>
2818
2848
  <div>
2819
- <b>19</b> relevant lines.
2820
- <span class="green"><b>18</b> lines covered</span> and
2821
- <span class="red"><b>1</b> lines missed.</span>
2849
+ <b>30</b> relevant lines.
2850
+ <span class="green"><b>26</b> lines covered</span> and
2851
+ <span class="red"><b>4</b> lines missed.</span>
2822
2852
  </div>
2823
2853
  </div>
2824
2854
 
@@ -2873,163 +2903,271 @@
2873
2903
  <code class="ruby"> setting :task_name</code>
2874
2904
  </li>
2875
2905
 
2876
- <li class="never" data-hits="" data-linenumber="9">
2906
+ <li class="covered" data-hits="1" data-linenumber="9">
2907
+ <span class="hits">1</span>
2908
+
2909
+ <code class="ruby"> setting :task_args</code>
2910
+ </li>
2911
+
2912
+ <li class="never" data-hits="" data-linenumber="10">
2877
2913
 
2878
2914
 
2879
2915
  <code class="ruby"></code>
2880
2916
  </li>
2881
2917
 
2882
- <li class="covered" data-hits="1" data-linenumber="10">
2918
+ <li class="covered" data-hits="1" data-linenumber="11">
2883
2919
  <span class="hits">1</span>
2884
2920
 
2885
- <code class="ruby"> def action</code>
2921
+ <code class="ruby"> def self.default_taskname(name)</code>
2886
2922
  </li>
2887
2923
 
2888
- <li class="never" data-hits="" data-linenumber="11">
2924
+ <li class="missed" data-hits="0" data-linenumber="12">
2925
+
2926
+
2927
+ <code class="ruby"> setting(:task_name, name)</code>
2928
+ </li>
2929
+
2930
+ <li class="never" data-hits="" data-linenumber="13">
2889
2931
 
2890
2932
 
2891
2933
  <code class="ruby"> end</code>
2892
2934
  </li>
2893
2935
 
2894
- <li class="never" data-hits="" data-linenumber="12">
2936
+ <li class="never" data-hits="" data-linenumber="14">
2895
2937
 
2896
2938
 
2897
2939
  <code class="ruby"></code>
2898
2940
  </li>
2899
2941
 
2900
- <li class="covered" data-hits="1" data-linenumber="13">
2942
+ <li class="covered" data-hits="1" data-linenumber="15">
2901
2943
  <span class="hits">1</span>
2902
2944
 
2903
- <code class="ruby"> def task_args</code>
2945
+ <code class="ruby"> def initialize(*args)</code>
2904
2946
  </li>
2905
2947
 
2906
- <li class="covered" data-hits="1" data-linenumber="14">
2948
+ <li class="covered" data-hits="1" data-linenumber="16">
2907
2949
  <span class="hits">1</span>
2908
2950
 
2909
- <code class="ruby"> [task_name]</code>
2951
+ <code class="ruby"> configs = args.take_while{|arg| Configurable === arg}</code>
2910
2952
  </li>
2911
2953
 
2912
- <li class="never" data-hits="" data-linenumber="15">
2954
+ <li class="covered" data-hits="1" data-linenumber="17">
2955
+ <span class="hits">1</span>
2956
+
2957
+ <code class="ruby"> @extracted_task_args = args[configs.length..-1]</code>
2958
+ </li>
2959
+
2960
+ <li class="covered" data-hits="1" data-linenumber="18">
2961
+ <span class="hits">1</span>
2962
+
2963
+ <code class="ruby"> if @extracted_task_args.any?{|arg| Configurable === arg}</code>
2964
+ </li>
2965
+
2966
+ <li class="missed" data-hits="0" data-linenumber="19">
2967
+
2968
+
2969
+ <code class="ruby"> raise &quot;Mattock::Task classes should be created with parent configs, then Rake task args&quot;</code>
2970
+ </li>
2971
+
2972
+ <li class="never" data-hits="" data-linenumber="20">
2973
+
2974
+
2975
+ <code class="ruby"> end</code>
2976
+ </li>
2977
+
2978
+ <li class="covered" data-hits="1" data-linenumber="21">
2979
+ <span class="hits">1</span>
2980
+
2981
+ <code class="ruby"> super(*configs)</code>
2982
+ </li>
2983
+
2984
+ <li class="never" data-hits="" data-linenumber="22">
2913
2985
 
2914
2986
 
2915
2987
  <code class="ruby"> end</code>
2916
2988
  </li>
2917
2989
 
2918
- <li class="never" data-hits="" data-linenumber="16">
2990
+ <li class="never" data-hits="" data-linenumber="23">
2919
2991
 
2920
2992
 
2921
2993
  <code class="ruby"></code>
2922
2994
  </li>
2923
2995
 
2924
- <li class="covered" data-hits="1" data-linenumber="17">
2996
+ <li class="covered" data-hits="1" data-linenumber="24">
2997
+ <span class="hits">1</span>
2998
+
2999
+ <code class="ruby"> def resolve_configuration</code>
3000
+ </li>
3001
+
3002
+ <li class="covered" data-hits="1" data-linenumber="25">
3003
+ <span class="hits">1</span>
3004
+
3005
+ <code class="ruby"> if @extracted_task_args.empty?</code>
3006
+ </li>
3007
+
3008
+ <li class="covered" data-hits="1" data-linenumber="26">
3009
+ <span class="hits">1</span>
3010
+
3011
+ <code class="ruby"> self.task_args = [task_name]</code>
3012
+ </li>
3013
+
3014
+ <li class="never" data-hits="" data-linenumber="27">
3015
+
3016
+
3017
+ <code class="ruby"> else</code>
3018
+ </li>
3019
+
3020
+ <li class="missed" data-hits="0" data-linenumber="28">
3021
+
3022
+
3023
+ <code class="ruby"> self.task_args = @extracted_task_args</code>
3024
+ </li>
3025
+
3026
+ <li class="never" data-hits="" data-linenumber="29">
3027
+
3028
+
3029
+ <code class="ruby"> end</code>
3030
+ </li>
3031
+
3032
+ <li class="never" data-hits="" data-linenumber="30">
3033
+
3034
+
3035
+ <code class="ruby"> end</code>
3036
+ </li>
3037
+
3038
+ <li class="never" data-hits="" data-linenumber="31">
3039
+
3040
+
3041
+ <code class="ruby"></code>
3042
+ </li>
3043
+
3044
+ <li class="covered" data-hits="1" data-linenumber="32">
3045
+ <span class="hits">1</span>
3046
+
3047
+ <code class="ruby"> def action</code>
3048
+ </li>
3049
+
3050
+ <li class="never" data-hits="" data-linenumber="33">
3051
+
3052
+
3053
+ <code class="ruby"> end</code>
3054
+ </li>
3055
+
3056
+ <li class="never" data-hits="" data-linenumber="34">
3057
+
3058
+
3059
+ <code class="ruby"></code>
3060
+ </li>
3061
+
3062
+ <li class="covered" data-hits="1" data-linenumber="35">
2925
3063
  <span class="hits">1</span>
2926
3064
 
2927
3065
  <code class="ruby"> def task_class</code>
2928
3066
  </li>
2929
3067
 
2930
- <li class="covered" data-hits="1" data-linenumber="18">
3068
+ <li class="covered" data-hits="1" data-linenumber="36">
2931
3069
  <span class="hits">1</span>
2932
3070
 
2933
3071
  <code class="ruby"> return @task_class if @task_class</code>
2934
3072
  </li>
2935
3073
 
2936
- <li class="covered" data-hits="1" data-linenumber="19">
3074
+ <li class="covered" data-hits="1" data-linenumber="37">
2937
3075
  <span class="hits">1</span>
2938
3076
 
2939
3077
  <code class="ruby"> @task_class = Class.new(self.class) do</code>
2940
3078
  </li>
2941
3079
 
2942
- <li class="covered" data-hits="1" data-linenumber="20">
3080
+ <li class="covered" data-hits="1" data-linenumber="38">
2943
3081
  <span class="hits">1</span>
2944
3082
 
2945
3083
  <code class="ruby"> define_method :initialize, Rake::Task.instance_method(:initialize)</code>
2946
3084
  </li>
2947
3085
 
2948
- <li class="never" data-hits="" data-linenumber="21">
3086
+ <li class="never" data-hits="" data-linenumber="39">
2949
3087
 
2950
3088
 
2951
3089
  <code class="ruby"> end</code>
2952
3090
  </li>
2953
3091
 
2954
- <li class="never" data-hits="" data-linenumber="22">
3092
+ <li class="never" data-hits="" data-linenumber="40">
2955
3093
 
2956
3094
 
2957
3095
  <code class="ruby"> end</code>
2958
3096
  </li>
2959
3097
 
2960
- <li class="never" data-hits="" data-linenumber="23">
3098
+ <li class="never" data-hits="" data-linenumber="41">
2961
3099
 
2962
3100
 
2963
3101
  <code class="ruby"></code>
2964
3102
  </li>
2965
3103
 
2966
- <li class="covered" data-hits="1" data-linenumber="24">
3104
+ <li class="covered" data-hits="1" data-linenumber="42">
2967
3105
  <span class="hits">1</span>
2968
3106
 
2969
3107
  <code class="ruby"> def inspect</code>
2970
3108
  </li>
2971
3109
 
2972
- <li class="missed" data-hits="0" data-linenumber="25">
3110
+ <li class="missed" data-hits="0" data-linenumber="43">
2973
3111
 
2974
3112
 
2975
- <code class="ruby"> &quot;Mattock::Task&quot;</code>
3113
+ <code class="ruby"> &quot;#{self.class.name}: #{self.task_args.inspect}&quot;</code>
2976
3114
  </li>
2977
3115
 
2978
- <li class="never" data-hits="" data-linenumber="26">
3116
+ <li class="never" data-hits="" data-linenumber="44">
2979
3117
 
2980
3118
 
2981
3119
  <code class="ruby"> end</code>
2982
3120
  </li>
2983
3121
 
2984
- <li class="never" data-hits="" data-linenumber="27">
3122
+ <li class="never" data-hits="" data-linenumber="45">
2985
3123
 
2986
3124
 
2987
3125
  <code class="ruby"></code>
2988
3126
  </li>
2989
3127
 
2990
- <li class="covered" data-hits="1" data-linenumber="28">
3128
+ <li class="covered" data-hits="1" data-linenumber="46">
2991
3129
  <span class="hits">1</span>
2992
3130
 
2993
3131
  <code class="ruby"> def define</code>
2994
3132
  </li>
2995
3133
 
2996
- <li class="covered" data-hits="1" data-linenumber="29">
3134
+ <li class="covered" data-hits="1" data-linenumber="47">
2997
3135
  <span class="hits">1</span>
2998
3136
 
2999
3137
  <code class="ruby"> task = task_class.define_task(*task_args) do</code>
3000
3138
  </li>
3001
3139
 
3002
- <li class="covered" data-hits="1" data-linenumber="30">
3140
+ <li class="covered" data-hits="1" data-linenumber="48">
3003
3141
  <span class="hits">1</span>
3004
3142
 
3005
3143
  <code class="ruby"> action</code>
3006
3144
  </li>
3007
3145
 
3008
- <li class="never" data-hits="" data-linenumber="31">
3146
+ <li class="never" data-hits="" data-linenumber="49">
3009
3147
 
3010
3148
 
3011
3149
  <code class="ruby"> end</code>
3012
3150
  </li>
3013
3151
 
3014
- <li class="covered" data-hits="1" data-linenumber="32">
3152
+ <li class="covered" data-hits="1" data-linenumber="50">
3015
3153
  <span class="hits">1</span>
3016
3154
 
3017
3155
  <code class="ruby"> copy_settings_to(task)</code>
3018
3156
  </li>
3019
3157
 
3020
- <li class="never" data-hits="" data-linenumber="33">
3158
+ <li class="never" data-hits="" data-linenumber="51">
3021
3159
 
3022
3160
 
3023
3161
  <code class="ruby"> end</code>
3024
3162
  </li>
3025
3163
 
3026
- <li class="never" data-hits="" data-linenumber="34">
3164
+ <li class="never" data-hits="" data-linenumber="52">
3027
3165
 
3028
3166
 
3029
3167
  <code class="ruby"> end</code>
3030
3168
  </li>
3031
3169
 
3032
- <li class="never" data-hits="" data-linenumber="35">
3170
+ <li class="never" data-hits="" data-linenumber="53">
3033
3171
 
3034
3172
 
3035
3173
  <code class="ruby">end</code>
@@ -111,6 +111,7 @@ module Mattock
111
111
 
112
112
  def copy_settings_to(other)
113
113
  self.class.copy_settings(self, other)
114
+ self
114
115
  end
115
116
 
116
117
  def setup_defaults
@@ -126,6 +127,10 @@ module Mattock
126
127
  self
127
128
  end
128
129
 
130
+ def unset?(value)
131
+ value == RequiredField
132
+ end
133
+
129
134
  def setting(name, default_value = nil)
130
135
  self.class.setting(name, default_value)
131
136
  instance_variable_set("@#{name}", default_value)
data/lib/mattock/task.rb CHANGED
@@ -6,12 +6,30 @@ module Mattock
6
6
  include CascadingDefinition
7
7
 
8
8
  setting :task_name
9
+ setting :task_args
9
10
 
10
- def action
11
+ def self.default_taskname(name)
12
+ setting(:task_name, name)
13
+ end
14
+
15
+ def initialize(*args)
16
+ configs = args.take_while{|arg| Configurable === arg}
17
+ @extracted_task_args = args[configs.length..-1]
18
+ if @extracted_task_args.any?{|arg| Configurable === arg}
19
+ raise "Mattock::Task classes should be created with parent configs, then Rake task args"
20
+ end
21
+ super(*configs)
11
22
  end
12
23
 
13
- def task_args
14
- [task_name]
24
+ def resolve_configuration
25
+ if @extracted_task_args.empty?
26
+ self.task_args = [task_name]
27
+ else
28
+ self.task_args = @extracted_task_args
29
+ end
30
+ end
31
+
32
+ def action
15
33
  end
16
34
 
17
35
  def task_class
@@ -22,7 +40,7 @@ module Mattock
22
40
  end
23
41
 
24
42
  def inspect
25
- "Mattock::Task"
43
+ "#{self.class.name}: #{self.task_args.inspect}"
26
44
  end
27
45
 
28
46
  def define
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: mattock
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.1
5
+ version: 0.1.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Judson Lester
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2012-02-01 00:00:00 Z
13
+ date: 2012-02-04 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: corundum
@@ -189,7 +189,7 @@ rdoc_options:
189
189
  - --main
190
190
  - doc/README
191
191
  - --title
192
- - mattock-0.1.1 RDoc
192
+ - mattock-0.1.2 RDoc
193
193
  require_paths:
194
194
  - lib/
195
195
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -197,7 +197,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
197
197
  requirements:
198
198
  - - ">="
199
199
  - !ruby/object:Gem::Version
200
- hash: 512343233
200
+ hash: 684090449
201
201
  segments:
202
202
  - 0
203
203
  version: "0"