dirtravel 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.rdoc CHANGED
@@ -1,5 +1,7 @@
1
1
  = Version history
2
2
 
3
+ [0.0.4] Fix for relative path conversion in Travel.filetree.
4
+
3
5
  [0.0.3] Entry#tip, Entry#relative?, Entry#rename methods added. New
4
6
  option for Travel.filetree, :inclusive. It uses one-up
5
7
  directory as root.
@@ -242,6 +242,8 @@
242
242
  <pre class="lines">
243
243
 
244
244
 
245
+ 165
246
+ 166
245
247
  167
246
248
  168
247
249
  169
@@ -249,12 +251,10 @@
249
251
  171
250
252
  172
251
253
  173
252
- 174
253
- 175
254
- 176</pre>
254
+ 174</pre>
255
255
  </td>
256
256
  <td>
257
- <pre class="code"><span class="info file"># File 'lib/dirtravel.rb', line 167</span>
257
+ <pre class="code"><span class="info file"># File 'lib/dirtravel.rb', line 165</span>
258
258
 
259
259
  <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span> <span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_root'>root</span> <span class='op'>=</span> <span class='kw'>false</span> <span class='rparen'>)</span>
260
260
  <span class='kw'>super</span><span class='lparen'>(</span> <span class='id identifier rubyid_name'>name</span> <span class='rparen'>)</span>
@@ -277,7 +277,7 @@
277
277
  </div>
278
278
 
279
279
  <div id="footer">
280
- Generated on Sat Jan 18 17:51:32 2014 by
280
+ Generated on Thu Jan 23 17:38:44 2014 by
281
281
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
282
282
  0.8.6.1 (ruby-1.9.3).
283
283
  </div>
@@ -114,7 +114,7 @@
114
114
  </div>
115
115
 
116
116
  <div id="footer">
117
- Generated on Sat Jan 18 17:51:32 2014 by
117
+ Generated on Thu Jan 23 17:38:44 2014 by
118
118
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
119
119
  0.8.6.1 (ruby-1.9.3).
120
120
  </div>
@@ -592,9 +592,7 @@
592
592
  93
593
593
  94
594
594
  95
595
- 96
596
- 97
597
- 98</pre>
595
+ 96</pre>
598
596
  </td>
599
597
  <td>
600
598
  <pre class="code"><span class="info file"># File 'lib/dirtravel.rb', line 90</span>
@@ -602,8 +600,6 @@
602
600
  <span class='kw'>def</span> <span class='id identifier rubyid_abspath'>abspath</span>
603
601
  <span class='kw'>if</span> <span class='ivar'>@abspath</span>
604
602
  <span class='ivar'>@abspath</span>
605
- <span class='kw'>elsif</span> <span class='kw'>self</span> <span class='op'>==</span> <span class='id identifier rubyid_root'>root</span>
606
- <span class='const'>Dir</span><span class='period'>.</span><span class='id identifier rubyid_pwd'>pwd</span>
607
603
  <span class='kw'>else</span>
608
604
  <span class='id identifier rubyid_root'>root</span><span class='period'>.</span><span class='id identifier rubyid_abspath'>abspath</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>/</span><span class='tstring_end'>'</span></span> <span class='op'>+</span> <span class='id identifier rubyid_subpath'>subpath</span>
609
605
  <span class='kw'>end</span>
@@ -679,12 +675,12 @@
679
675
  <pre class="lines">
680
676
 
681
677
 
682
- 111
683
- 112
684
- 113</pre>
678
+ 109
679
+ 110
680
+ 111</pre>
685
681
  </td>
686
682
  <td>
687
- <pre class="code"><span class="info file"># File 'lib/dirtravel.rb', line 111</span>
683
+ <pre class="code"><span class="info file"># File 'lib/dirtravel.rb', line 109</span>
688
684
 
689
685
  <span class='kw'>def</span> <span class='id identifier rubyid_dir'>dir</span><span class='lparen'>(</span> <span class='id identifier rubyid_basedir'>basedir</span> <span class='op'>=</span> <span class='kw'>self</span> <span class='rparen'>)</span>
690
686
  <span class='id identifier rubyid_parts'>parts</span><span class='lparen'>(</span> <span class='id identifier rubyid_basedir'>basedir</span><span class='period'>.</span><span class='id identifier rubyid_parent'>parent</span> <span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>/</span><span class='tstring_end'>'</span></span> <span class='rparen'>)</span>
@@ -720,12 +716,12 @@
720
716
  <pre class="lines">
721
717
 
722
718
 
723
- 127
724
- 128
725
- 129</pre>
719
+ 125
720
+ 126
721
+ 127</pre>
726
722
  </td>
727
723
  <td>
728
- <pre class="code"><span class="info file"># File 'lib/dirtravel.rb', line 127</span>
724
+ <pre class="code"><span class="info file"># File 'lib/dirtravel.rb', line 125</span>
729
725
 
730
726
  <span class='kw'>def</span> <span class='id identifier rubyid_files'>files</span>
731
727
  <span class='id identifier rubyid_select'>select</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_i'>i</span><span class='op'>|</span> <span class='id identifier rubyid_i'>i</span><span class='period'>.</span><span class='id identifier rubyid_kind_of?'>kind_of?</span><span class='lparen'>(</span> <span class='const'>FileEntry</span> <span class='rparen'>)</span> <span class='kw'>end</span>
@@ -910,12 +906,12 @@
910
906
  <pre class="lines">
911
907
 
912
908
 
913
- 138
914
- 139
915
- 140</pre>
909
+ 136
910
+ 137
911
+ 138</pre>
916
912
  </td>
917
913
  <td>
918
- <pre class="code"><span class="info file"># File 'lib/dirtravel.rb', line 138</span>
914
+ <pre class="code"><span class="info file"># File 'lib/dirtravel.rb', line 136</span>
919
915
 
920
916
  <span class='kw'>def</span> <span class='id identifier rubyid_relative?'>relative?</span>
921
917
  <span class='ivar'>@name</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span> <span class='op'>!=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>/</span><span class='tstring_end'>'</span></span>
@@ -971,6 +967,8 @@
971
967
  <pre class="lines">
972
968
 
973
969
 
970
+ 144
971
+ 145
974
972
  146
975
973
  147
976
974
  148
@@ -978,12 +976,10 @@
978
976
  150
979
977
  151
980
978
  152
981
- 153
982
- 154
983
- 155</pre>
979
+ 153</pre>
984
980
  </td>
985
981
  <td>
986
- <pre class="code"><span class="info file"># File 'lib/dirtravel.rb', line 146</span>
982
+ <pre class="code"><span class="info file"># File 'lib/dirtravel.rb', line 144</span>
987
983
 
988
984
  <span class='kw'>def</span> <span class='id identifier rubyid_rename'>rename</span><span class='lparen'>(</span> <span class='id identifier rubyid_name'>name</span> <span class='rparen'>)</span>
989
985
  <span class='ivar'>@name</span> <span class='op'>=</span> <span class='id identifier rubyid_name'>name</span>
@@ -1064,12 +1060,12 @@
1064
1060
  <pre class="lines">
1065
1061
 
1066
1062
 
1067
- 121
1068
- 122
1069
- 123</pre>
1063
+ 119
1064
+ 120
1065
+ 121</pre>
1070
1066
  </td>
1071
1067
  <td>
1072
- <pre class="code"><span class="info file"># File 'lib/dirtravel.rb', line 121</span>
1068
+ <pre class="code"><span class="info file"># File 'lib/dirtravel.rb', line 119</span>
1073
1069
 
1074
1070
  <span class='kw'>def</span> <span class='id identifier rubyid_select_level'>select_level</span><span class='lparen'>(</span> <span class='id identifier rubyid_level'>level</span> <span class='rparen'>)</span>
1075
1071
  <span class='id identifier rubyid_select'>select</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_i'>i</span><span class='op'>|</span> <span class='id identifier rubyid_i'>i</span><span class='period'>.</span><span class='id identifier rubyid_node_depth'>node_depth</span> <span class='op'>==</span> <span class='id identifier rubyid_level'>level</span><span class='semicolon'>;</span> <span class='kw'>end</span>
@@ -1105,12 +1101,12 @@
1105
1101
  <pre class="lines">
1106
1102
 
1107
1103
 
1108
- 133
1109
- 134
1110
- 135</pre>
1104
+ 131
1105
+ 132
1106
+ 133</pre>
1111
1107
  </td>
1112
1108
  <td>
1113
- <pre class="code"><span class="info file"># File 'lib/dirtravel.rb', line 133</span>
1109
+ <pre class="code"><span class="info file"># File 'lib/dirtravel.rb', line 131</span>
1114
1110
 
1115
1111
  <span class='kw'>def</span> <span class='id identifier rubyid_stat'>stat</span>
1116
1112
  <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_stat'>stat</span><span class='lparen'>(</span> <span class='id identifier rubyid_path'>path</span> <span class='rparen'>)</span>
@@ -1217,12 +1213,12 @@
1217
1213
  <pre class="lines">
1218
1214
 
1219
1215
 
1220
- 102
1221
- 103
1222
- 104</pre>
1216
+ 100
1217
+ 101
1218
+ 102</pre>
1223
1219
  </td>
1224
1220
  <td>
1225
- <pre class="code"><span class="info file"># File 'lib/dirtravel.rb', line 102</span>
1221
+ <pre class="code"><span class="info file"># File 'lib/dirtravel.rb', line 100</span>
1226
1222
 
1227
1223
  <span class='kw'>def</span> <span class='id identifier rubyid_tip'>tip</span>
1228
1224
  <span class='ivar'>@name</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</span><span class='lparen'>(</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/</span><span class='tstring_end'>&quot;</span></span> <span class='rparen'>)</span><span class='lbracket'>[</span><span class='op'>-</span><span class='int'>1</span><span class='rbracket'>]</span>
@@ -1237,7 +1233,7 @@
1237
1233
  </div>
1238
1234
 
1239
1235
  <div id="footer">
1240
- Generated on Sat Jan 18 17:51:32 2014 by
1236
+ Generated on Thu Jan 23 17:38:44 2014 by
1241
1237
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1242
1238
  0.8.6.1 (ruby-1.9.3).
1243
1239
  </div>
@@ -267,14 +267,14 @@
267
267
  <pre class="lines">
268
268
 
269
269
 
270
+ 183
271
+ 184
270
272
  185
271
273
  186
272
- 187
273
- 188
274
- 189</pre>
274
+ 187</pre>
275
275
  </td>
276
276
  <td>
277
- <pre class="code"><span class="info file"># File 'lib/dirtravel.rb', line 185</span>
277
+ <pre class="code"><span class="info file"># File 'lib/dirtravel.rb', line 183</span>
278
278
 
279
279
  <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span> <span class='id identifier rubyid_name'>name</span> <span class='rparen'>)</span>
280
280
  <span class='kw'>super</span><span class='lparen'>(</span> <span class='id identifier rubyid_name'>name</span> <span class='rparen'>)</span>
@@ -319,12 +319,12 @@
319
319
  <pre class="lines">
320
320
 
321
321
 
322
- 183
323
- 184
324
- 185</pre>
322
+ 181
323
+ 182
324
+ 183</pre>
325
325
  </td>
326
326
  <td>
327
- <pre class="code"><span class="info file"># File 'lib/dirtravel.rb', line 183</span>
327
+ <pre class="code"><span class="info file"># File 'lib/dirtravel.rb', line 181</span>
328
328
 
329
329
  <span class='kw'>def</span> <span class='id identifier rubyid_basename'>basename</span>
330
330
  <span class='ivar'>@basename</span>
@@ -362,12 +362,12 @@
362
362
  <pre class="lines">
363
363
 
364
364
 
365
- 183
366
- 184
367
- 185</pre>
365
+ 181
366
+ 182
367
+ 183</pre>
368
368
  </td>
369
369
  <td>
370
- <pre class="code"><span class="info file"># File 'lib/dirtravel.rb', line 183</span>
370
+ <pre class="code"><span class="info file"># File 'lib/dirtravel.rb', line 181</span>
371
371
 
372
372
  <span class='kw'>def</span> <span class='id identifier rubyid_suffix'>suffix</span>
373
373
  <span class='ivar'>@suffix</span>
@@ -383,7 +383,7 @@
383
383
  </div>
384
384
 
385
385
  <div id="footer">
386
- Generated on Sat Jan 18 17:51:32 2014 by
386
+ Generated on Thu Jan 23 17:38:44 2014 by
387
387
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
388
388
  0.8.6.1 (ruby-1.9.3).
389
389
  </div>
@@ -346,6 +346,8 @@ with suffix and modify tree building with options Hash (see below).</p>
346
346
  <pre class="lines">
347
347
 
348
348
 
349
+ 244
350
+ 245
349
351
  246
350
352
  247
351
353
  248
@@ -358,12 +360,10 @@ with suffix and modify tree building with options Hash (see below).</p>
358
360
  255
359
361
  256
360
362
  257
361
- 258
362
- 259
363
- 260</pre>
363
+ 258</pre>
364
364
  </td>
365
365
  <td>
366
- <pre class="code"><span class="info file"># File 'lib/dirtravel.rb', line 246</span>
366
+ <pre class="code"><span class="info file"># File 'lib/dirtravel.rb', line 244</span>
367
367
 
368
368
  <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span> <span class='id identifier rubyid_basedir'>basedir</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>.</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span> <span class='rparen'>)</span>
369
369
  <span class='ivar'>@basedir</span> <span class='op'>=</span> <span class='id identifier rubyid_basedir'>basedir</span>
@@ -418,12 +418,12 @@ with suffix and modify tree building with options Hash (see below).</p>
418
418
  <pre class="lines">
419
419
 
420
420
 
421
- 220
422
- 221
423
- 222</pre>
421
+ 218
422
+ 219
423
+ 220</pre>
424
424
  </td>
425
425
  <td>
426
- <pre class="code"><span class="info file"># File 'lib/dirtravel.rb', line 220</span>
426
+ <pre class="code"><span class="info file"># File 'lib/dirtravel.rb', line 218</span>
427
427
 
428
428
  <span class='kw'>def</span> <span class='id identifier rubyid_basedir'>basedir</span>
429
429
  <span class='ivar'>@basedir</span>
@@ -461,12 +461,12 @@ with suffix and modify tree building with options Hash (see below).</p>
461
461
  <pre class="lines">
462
462
 
463
463
 
464
- 217
465
- 218
466
- 219</pre>
464
+ 215
465
+ 216
466
+ 217</pre>
467
467
  </td>
468
468
  <td>
469
- <pre class="code"><span class="info file"># File 'lib/dirtravel.rb', line 217</span>
469
+ <pre class="code"><span class="info file"># File 'lib/dirtravel.rb', line 215</span>
470
470
 
471
471
  <span class='kw'>def</span> <span class='id identifier rubyid_defaults'>defaults</span>
472
472
  <span class='ivar'>@defaults</span>
@@ -504,12 +504,12 @@ with suffix and modify tree building with options Hash (see below).</p>
504
504
  <pre class="lines">
505
505
 
506
506
 
507
- 214
508
- 215
509
- 216</pre>
507
+ 212
508
+ 213
509
+ 214</pre>
510
510
  </td>
511
511
  <td>
512
- <pre class="code"><span class="info file"># File 'lib/dirtravel.rb', line 214</span>
512
+ <pre class="code"><span class="info file"># File 'lib/dirtravel.rb', line 212</span>
513
513
 
514
514
  <span class='kw'>def</span> <span class='id identifier rubyid_root'>root</span>
515
515
  <span class='ivar'>@root</span>
@@ -610,6 +610,8 @@ with suffix and modify tree building with options Hash (see below).</p>
610
610
  <pre class="lines">
611
611
 
612
612
 
613
+ 224
614
+ 225
613
615
  226
614
616
  227
615
617
  228
@@ -625,12 +627,10 @@ with suffix and modify tree building with options Hash (see below).</p>
625
627
  238
626
628
  239
627
629
  240
628
- 241
629
- 242
630
- 243</pre>
630
+ 241</pre>
631
631
  </td>
632
632
  <td>
633
- <pre class="code"><span class="info file"># File 'lib/dirtravel.rb', line 226</span>
633
+ <pre class="code"><span class="info file"># File 'lib/dirtravel.rb', line 224</span>
634
634
 
635
635
  <span class='kw'>def</span> <span class='const'>Travel</span><span class='period'>.</span><span class='id identifier rubyid_filetree'>filetree</span><span class='lparen'>(</span> <span class='id identifier rubyid_basedir'>basedir</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>.</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span> <span class='rparen'>)</span>
636
636
 
@@ -687,12 +687,12 @@ with suffix and modify tree building with options Hash (see below).</p>
687
687
  <pre class="lines">
688
688
 
689
689
 
690
- 265
691
- 266
692
- 267</pre>
690
+ 263
691
+ 264
692
+ 265</pre>
693
693
  </td>
694
694
  <td>
695
- <pre class="code"><span class="info file"># File 'lib/dirtravel.rb', line 265</span>
695
+ <pre class="code"><span class="info file"># File 'lib/dirtravel.rb', line 263</span>
696
696
 
697
697
  <span class='kw'>def</span> <span class='id identifier rubyid_travel'>travel</span><span class='lparen'>(</span> <span class='id identifier rubyid_suffix'>suffix</span> <span class='op'>=</span> <span class='ivar'>@defaults</span><span class='lbracket'>[</span> <span class='symbol'>:suffix</span> <span class='rbracket'>]</span> <span class='rparen'>)</span>
698
698
  <span class='id identifier rubyid_entriesIn'>entriesIn</span><span class='lparen'>(</span> <span class='ivar'>@basedir</span><span class='comma'>,</span> <span class='ivar'>@root</span><span class='comma'>,</span> <span class='id identifier rubyid_suffix'>suffix</span> <span class='rparen'>)</span>
@@ -707,7 +707,7 @@ with suffix and modify tree building with options Hash (see below).</p>
707
707
  </div>
708
708
 
709
709
  <div id="footer">
710
- Generated on Sat Jan 18 17:51:33 2014 by
710
+ Generated on Thu Jan 23 17:38:45 2014 by
711
711
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
712
712
  0.8.6.1 (ruby-1.9.3).
713
713
  </div>
data/doc/DirTravel.html CHANGED
@@ -149,7 +149,7 @@ directory hierachy.</p>
149
149
  </div>
150
150
 
151
151
  <div id="footer">
152
- Generated on Sat Jan 18 17:51:32 2014 by
152
+ Generated on Thu Jan 23 17:38:44 2014 by
153
153
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
154
154
  0.8.6.1 (ruby-1.9.3).
155
155
  </div>
data/doc/_index.html CHANGED
@@ -163,7 +163,7 @@
163
163
  </div>
164
164
 
165
165
  <div id="footer">
166
- Generated on Sat Jan 18 17:51:32 2014 by
166
+ Generated on Thu Jan 23 17:38:44 2014 by
167
167
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
168
168
  0.8.6.1 (ruby-1.9.3).
169
169
  </div>
@@ -63,7 +63,10 @@
63
63
 
64
64
  <div id="content"><div id='filecontents'>
65
65
  <h1>Version history</h1>
66
- <dl class="rdoc-list"><dt>0.0.3</dt>
66
+ <dl class="rdoc-list"><dt>0.0.4</dt>
67
+ <dd>
68
+ <p>Fix for relative path conversion in Travel.filetree.</p>
69
+ </dd><dt>0.0.3</dt>
67
70
  <dd>
68
71
  <p>Entry#tip, Entry#relative?, Entry#rename methods added. New option for
69
72
  Travel.filetree, :inclusive. It uses one-up directory as root.</p>
@@ -77,7 +80,7 @@ Travel.filetree, :inclusive. It uses one-up directory as root.</p>
77
80
  </div></div>
78
81
 
79
82
  <div id="footer">
80
- Generated on Sat Jan 18 17:51:32 2014 by
83
+ Generated on Thu Jan 23 17:38:44 2014 by
81
84
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
82
85
  0.8.6.1 (ruby-1.9.3).
83
86
  </div>
data/doc/file.README.html CHANGED
@@ -75,7 +75,7 @@ structure. This structure can be conveniently accessed in various ways.</p>
75
75
  </div></div>
76
76
 
77
77
  <div id="footer">
78
- Generated on Sat Jan 18 17:51:32 2014 by
78
+ Generated on Thu Jan 23 17:38:44 2014 by
79
79
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
80
80
  0.8.6.1 (ruby-1.9.3).
81
81
  </div>
data/doc/index.html CHANGED
@@ -75,7 +75,7 @@ structure. This structure can be conveniently accessed in various ways.</p>
75
75
  </div></div>
76
76
 
77
77
  <div id="footer">
78
- Generated on Sat Jan 18 17:51:32 2014 by
78
+ Generated on Thu Jan 23 17:38:44 2014 by
79
79
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
80
80
  0.8.6.1 (ruby-1.9.3).
81
81
  </div>
@@ -103,7 +103,7 @@
103
103
  </div>
104
104
 
105
105
  <div id="footer">
106
- Generated on Sat Jan 18 17:51:32 2014 by
106
+ Generated on Thu Jan 23 17:38:44 2014 by
107
107
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
108
108
  0.8.6.1 (ruby-1.9.3).
109
109
  </div>
data/lib/dirtravel.rb CHANGED
@@ -90,8 +90,6 @@ module DirTravel
90
90
  def abspath
91
91
  if @abspath
92
92
  @abspath
93
- elsif self == root
94
- Dir.pwd
95
93
  else
96
94
  root.abspath + '/' + subpath
97
95
  end
@@ -271,12 +269,11 @@ module DirTravel
271
269
 
272
270
  # Clean relative path head (remove dot etc).
273
271
  def clean( dir )
274
- if dir[0..1] == './'
275
- dir = dir[ 2..-1 ]
276
- elsif dir[0] == '.'
277
- dir = ""
272
+ if dir[0] == '/'
273
+ dir
274
+ else
275
+ File.basename( File.absolute_path( dir ) )
278
276
  end
279
- dir
280
277
  end
281
278
 
282
279
 
@@ -85,6 +85,35 @@ class DirTravelTest < Test::Unit::TestCase
85
85
  target = pwd + '/test_0'
86
86
  data = DirTravel::Travel.filetree( target, { :inclusive => true } )
87
87
  assert_equal( pwd, data.name )
88
+ assert_equal( Dir.pwd + '/' + pwd, data.abspath )
89
+ assert_equal( 'test', data.tip )
90
+ assert_equal( 1, data.children.length )
91
+ root = data.children[0]
92
+ assert_equal( 'test_0', root.name )
93
+ assert_equal( 'test_0', root.tip )
94
+ assert_equal( 'test/test_0', root.path )
95
+ end
96
+
97
+ def test_inclusive_rel2
98
+ pwd = 'test'
99
+ target = '../test/' + pwd + '/test_0'
100
+ data = DirTravel::Travel.filetree( target, { :inclusive => true } )
101
+ assert_equal( pwd, data.name )
102
+ assert_equal( Dir.pwd + '/' + pwd, data.abspath )
103
+ assert_equal( 'test', data.tip )
104
+ assert_equal( 1, data.children.length )
105
+ root = data.children[0]
106
+ assert_equal( 'test_0', root.name )
107
+ assert_equal( 'test_0', root.tip )
108
+ assert_equal( 'test/test_0', root.path )
109
+ end
110
+
111
+ def test_inclusive_rel3
112
+ pwd = 'test'
113
+ target = './' + pwd + '/test_0'
114
+ data = DirTravel::Travel.filetree( target, { :inclusive => true } )
115
+ assert_equal( pwd, data.name )
116
+ assert_equal( Dir.pwd + '/' + pwd, data.abspath )
88
117
  assert_equal( 'test', data.tip )
89
118
  assert_equal( 1, data.children.length )
90
119
  root = data.children[0]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dirtravel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-01-18 00:00:00.000000000 Z
12
+ date: 2014-01-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rubytree