buildr 1.3.5 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (151) hide show
  1. data/CHANGELOG +153 -8
  2. data/README.rdoc +1 -1
  3. data/addon/buildr/antlr.rb +5 -5
  4. data/addon/buildr/drb.rb +18 -18
  5. data/addon/buildr/hibernate.rb +18 -14
  6. data/addon/buildr/javacc.rb +4 -4
  7. data/addon/buildr/jetty.rb +5 -5
  8. data/addon/buildr/nailgun.rb +23 -23
  9. data/addon/buildr/openjpa.rb +1 -1
  10. data/addon/buildr/org/apache/buildr/BuildrNail$Main.class +0 -0
  11. data/addon/buildr/org/apache/buildr/BuildrNail.class +0 -0
  12. data/addon/buildr/org/apache/buildr/JettyWrapper$1.class +0 -0
  13. data/addon/buildr/org/apache/buildr/JettyWrapper$BuildrHandler.class +0 -0
  14. data/addon/buildr/org/apache/buildr/JettyWrapper.class +0 -0
  15. data/addon/buildr/protobuf.rb +75 -0
  16. data/addon/buildr/xmlbeans.rb +5 -5
  17. data/buildr.buildfile +2 -2
  18. data/buildr.gemspec +8 -7
  19. data/doc/_layouts/default.html +2 -2
  20. data/doc/artifacts.textile +4 -4
  21. data/doc/building.textile +35 -3
  22. data/doc/contributing.textile +5 -0
  23. data/doc/download.textile +16 -5
  24. data/doc/extending.textile +38 -12
  25. data/doc/installing.textile +6 -5
  26. data/doc/languages.textile +182 -42
  27. data/doc/more_stuff.textile +2 -2
  28. data/doc/packaging.textile +14 -15
  29. data/doc/projects.textile +7 -2
  30. data/doc/quick_start.textile +4 -4
  31. data/doc/scripts/buildr-git.rb +63 -63
  32. data/doc/scripts/gitflow.rb +21 -21
  33. data/doc/settings_profiles.textile +9 -2
  34. data/doc/testing.textile +16 -5
  35. data/etc/KEYS +38 -0
  36. data/lib/buildr/core/application.rb +33 -27
  37. data/lib/buildr/core/build.rb +41 -28
  38. data/lib/buildr/core/cc.rb +172 -0
  39. data/lib/buildr/core/checks.rb +1 -1
  40. data/lib/buildr/core/common.rb +7 -6
  41. data/lib/buildr/core/compile.rb +7 -8
  42. data/lib/buildr/core/doc.rb +263 -0
  43. data/lib/buildr/core/environment.rb +6 -6
  44. data/lib/buildr/core/filter.rb +77 -35
  45. data/lib/buildr/core/generate.rb +7 -7
  46. data/lib/buildr/core/help.rb +1 -1
  47. data/lib/buildr/core/osx.rb +6 -6
  48. data/lib/buildr/core/progressbar.rb +4 -4
  49. data/lib/buildr/core/project.rb +144 -36
  50. data/lib/buildr/core/shell.rb +34 -34
  51. data/lib/buildr/core/test.rb +89 -20
  52. data/lib/buildr/core/transports.rb +8 -7
  53. data/lib/buildr/core/util.rb +77 -23
  54. data/lib/buildr/core.rb +1 -0
  55. data/lib/buildr/groovy/bdd.rb +5 -5
  56. data/lib/buildr/groovy/compiler.rb +19 -15
  57. data/lib/buildr/groovy/shell.rb +6 -6
  58. data/lib/buildr/ide/eclipse/java.rb +3 -3
  59. data/lib/buildr/ide/eclipse/plugin.rb +8 -5
  60. data/lib/buildr/ide/eclipse/scala.rb +4 -2
  61. data/lib/buildr/ide/eclipse.rb +148 -75
  62. data/lib/buildr/ide/idea.rb +2 -2
  63. data/lib/buildr/ide/idea7x.rb +23 -4
  64. data/lib/buildr/java/ant.rb +4 -4
  65. data/lib/buildr/java/bdd.rb +51 -54
  66. data/lib/buildr/java/cobertura.rb +57 -35
  67. data/lib/buildr/java/commands.rb +14 -5
  68. data/lib/buildr/java/compiler.rb +3 -217
  69. data/lib/buildr/java/deprecated.rb +4 -4
  70. data/lib/buildr/java/doc.rb +70 -0
  71. data/lib/buildr/java/emma.rb +22 -22
  72. data/lib/buildr/java/jruby.rb +4 -4
  73. data/lib/buildr/java/jtestr_runner.rb.erb +27 -25
  74. data/lib/buildr/java/org/apache/buildr/JavaTestFilter.class +0 -0
  75. data/lib/buildr/java/org/apache/buildr/JavaTestFilter.java +8 -3
  76. data/lib/buildr/java/packaging.rb +30 -29
  77. data/lib/buildr/java/pom.rb +4 -4
  78. data/lib/buildr/java/rjb.rb +6 -6
  79. data/lib/buildr/java/test_result.rb +61 -85
  80. data/lib/buildr/java/tests.rb +44 -27
  81. data/lib/buildr/java/version_requirement.rb +8 -8
  82. data/lib/buildr/java.rb +1 -0
  83. data/lib/buildr/packaging/archive.rb +55 -22
  84. data/lib/buildr/packaging/artifact.rb +75 -36
  85. data/lib/buildr/packaging/artifact_namespace.rb +90 -78
  86. data/lib/buildr/packaging/artifact_search.rb +5 -5
  87. data/lib/buildr/packaging/gems.rb +11 -7
  88. data/lib/buildr/packaging/package.rb +10 -7
  89. data/lib/buildr/packaging/tar.rb +14 -14
  90. data/lib/buildr/packaging/version_requirement.rb +30 -10
  91. data/lib/buildr/packaging/ziptask.rb +51 -13
  92. data/lib/buildr/scala/bdd.rb +25 -20
  93. data/lib/buildr/scala/compiler.rb +87 -40
  94. data/lib/buildr/scala/doc.rb +106 -0
  95. data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.class +0 -0
  96. data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.java +57 -0
  97. data/lib/buildr/scala/shell.rb +14 -9
  98. data/lib/buildr/scala/tests.rb +33 -26
  99. data/lib/buildr/scala.rb +1 -0
  100. data/lib/buildr/shell.rb +33 -33
  101. data/lib/buildr.rb +1 -1
  102. data/rakelib/all-in-one.rake +113 -0
  103. data/rakelib/checks.rake +1 -1
  104. data/rakelib/doc.rake +7 -0
  105. data/rakelib/package.rake +1 -1
  106. data/rakelib/release.rake +9 -6
  107. data/rakelib/rspec.rake +26 -7
  108. data/rakelib/setup.rake +15 -3
  109. data/rakelib/stage.rake +18 -11
  110. data/spec/addon/drb_spec.rb +25 -25
  111. data/spec/core/application_spec.rb +111 -21
  112. data/spec/core/build_spec.rb +16 -15
  113. data/spec/core/cc_spec.rb +174 -0
  114. data/spec/core/checks_spec.rb +34 -34
  115. data/spec/core/common_spec.rb +51 -5
  116. data/spec/core/compile_spec.rb +89 -14
  117. data/spec/core/extension_spec.rb +127 -19
  118. data/spec/core/generate_spec.rb +2 -2
  119. data/spec/core/project_spec.rb +10 -10
  120. data/spec/core/test_spec.rb +144 -35
  121. data/spec/core/transport_spec.rb +8 -8
  122. data/spec/core/util_spec.rb +63 -5
  123. data/spec/groovy/bdd_spec.rb +5 -5
  124. data/spec/groovy/compiler_spec.rb +29 -18
  125. data/spec/ide/eclipse_spec.rb +185 -9
  126. data/spec/ide/idea7x_spec.rb +22 -10
  127. data/spec/java/ant_spec.rb +9 -5
  128. data/spec/java/bdd_spec.rb +29 -37
  129. data/spec/java/cobertura_spec.rb +12 -12
  130. data/spec/java/commands_spec.rb +34 -0
  131. data/spec/java/compiler_spec.rb +53 -53
  132. data/spec/java/emma_spec.rb +11 -11
  133. data/spec/java/java_spec.rb +10 -10
  134. data/spec/java/packaging_spec.rb +67 -20
  135. data/spec/java/test_coverage_helper.rb +18 -18
  136. data/spec/java/tests_spec.rb +13 -9
  137. data/spec/packaging/archive_spec.rb +187 -20
  138. data/spec/packaging/artifact_namespace_spec.rb +172 -83
  139. data/spec/packaging/artifact_spec.rb +83 -18
  140. data/spec/packaging/packaging_spec.rb +41 -14
  141. data/spec/sandbox.rb +23 -12
  142. data/spec/scala/bdd_spec.rb +13 -8
  143. data/spec/scala/compiler_spec.rb +18 -13
  144. data/spec/scala/scala.rb +3 -3
  145. data/spec/scala/tests_spec.rb +46 -24
  146. data/spec/spec_helpers.rb +28 -10
  147. data/spec/version_requirement_spec.rb +25 -11
  148. metadata +149 -133
  149. data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner$.class +0 -0
  150. data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.scala +0 -35
  151. data/rakelib/stage.rake~ +0 -213
@@ -22,6 +22,8 @@ describe 'ArchiveTask', :shared=>true do
22
22
  @dir = File.expand_path('test')
23
23
  @files = %w{Test1.txt Text2.html}.map { |file| File.expand_path(file, @dir) }.
24
24
  each { |file| write file, content_for(file) }
25
+ @empty_dirs = %w{EmptyDir1 EmptyDir2}.map { |file| File.expand_path(file, @dir) }.
26
+ each { |file| mkdir file }
25
27
  end
26
28
 
27
29
  # Not too smart, we just create some content based on file name to make sure you read what you write.
@@ -59,6 +61,11 @@ describe 'ArchiveTask', :shared=>true do
59
61
  inspect_archive { |archive| archive.should be_empty }
60
62
  end
61
63
 
64
+ it 'should raise error when include() is called with nil values' do
65
+ lambda { archive(@archive).include(nil) }.should raise_error
66
+ lambda { archive(@archive).include([nil]) }.should raise_error
67
+ end
68
+
62
69
  it 'should create empty archive if called #clean method' do
63
70
  archive(@archive).include(@files).clean.invoke
64
71
  inspect_archive { |archive| archive.should be_empty }
@@ -83,6 +90,22 @@ describe 'ArchiveTask', :shared=>true do
83
90
  inspect_archive.keys.should include('included')
84
91
  end
85
92
 
93
+ it 'should archive artifacts' do
94
+ write 'library-1.0.txt', 'library-1.0'
95
+ artifact("org.example:library:txt:1.0").from 'library-1.0.txt'
96
+ archive(@archive).include("org.example:library:txt:1.0").invoke
97
+ inspect_archive.keys.should include('library-1.0.txt')
98
+ end
99
+
100
+ it 'should archive project artifacts' do
101
+ define 'p1' do
102
+ project.version = '1.0'
103
+ package(:zip)
104
+ end
105
+ archive(@archive).include(project('p1')).invoke
106
+ inspect_archive.keys.should include('p1-1.0.zip')
107
+ end
108
+
86
109
  it 'should include entry for directory' do
87
110
  archive(@archive).include(@dir).invoke
88
111
  inspect_archive { |archive| @files.each { |f| archive['test/' + File.basename(f)].should eql(content_for(f)) } }
@@ -112,12 +135,18 @@ describe 'ArchiveTask', :shared=>true do
112
135
  end
113
136
  end
114
137
 
138
+ it 'should raise error when using :from with nil value' do
139
+ lambda {
140
+ archive(@archive).include(:from=>nil)
141
+ }.should raise_error
142
+ end
143
+
115
144
  it 'should exclude entire directory and all its children' do
116
145
  mkpath "#{@dir}/sub"
117
146
  write "#{@dir}/sub/test"
118
147
  archive(@archive).include(@dir).exclude("#{@dir}/sub").invoke
119
148
  inspect_archive do |archive|
120
- archive.keys.select { |file| file =~ /sub/ }.should be_empty
149
+ archive.keys.select { |file| file =~ /sub/ }.should be_empty
121
150
  end
122
151
  end
123
152
 
@@ -171,6 +200,11 @@ describe 'ArchiveTask', :shared=>true do
171
200
  archive(@archive).include(@files.first, :as=>'test/sample').invoke
172
201
  inspect_archive { |archive| @files.each { |f| archive['test/sample'].should eql(content_for(@files.first)) } }
173
202
  end
203
+
204
+ it 'should archive directory into specified alias, without using "."' do
205
+ archive(@archive).include(@dir, :as=>'.').invoke
206
+ inspect_archive { |archive| archive.keys.should_not include(".") }
207
+ end
174
208
 
175
209
  it 'should archive file into specified name/path' do
176
210
  archive(@archive).include(@files.first, :as=>'test/sample', :path=>'path').invoke
@@ -219,19 +253,19 @@ describe 'ArchiveTask', :shared=>true do
219
253
  create_for_merge do |src|
220
254
  archive(@archive).merge(src).include(File.basename(@files.first))
221
255
  archive(@archive).invoke
222
- inspect_archive do |archive|
256
+ inspect_archive do |archive|
223
257
  archive[File.basename(@files.first)].should eql(content_for(@files.first))
224
258
  archive[File.basename(@files.last)].should be_nil
225
259
  end
226
260
  end
227
261
  end
228
-
262
+
229
263
  it 'should expand another archive file with exclude pattern' do
230
264
  create_for_merge do |src|
231
265
  archive(@archive).merge(src).exclude(File.basename(@files.first))
232
266
  archive(@archive).invoke
233
- inspect_archive do |archive|
234
- @files[1..-1].each { |f| archive[File.basename(f)].should eql(content_for(f)) }
267
+ inspect_archive do |archive|
268
+ @files[1..-1].each { |f| archive[File.basename(f)].should eql(content_for(f)) }
235
269
  archive[File.basename(@files.first)].should be_nil
236
270
  end
237
271
  end
@@ -285,7 +319,7 @@ describe 'ArchiveTask', :shared=>true do
285
319
  # all included files newer.
286
320
  File.utime Time.now - 100, Time.now - 100, @archive
287
321
  archive(@archive).include(@files).invoke
288
- File.stat(@archive).mtime.should be_close(Time.now, 10)
322
+ File.stat(@archive).mtime.should be_close(Time.now, 10)
289
323
  end
290
324
 
291
325
  it 'should do nothing if all files are uptodate' do
@@ -293,7 +327,7 @@ describe 'ArchiveTask', :shared=>true do
293
327
  # By touching all files in the past, there's nothing new to update.
294
328
  (@files + [@archive]).each { |f| File.utime Time.now - 100, Time.now - 100, f }
295
329
  archive(@archive).include(@files).invoke
296
- File.stat(@archive).mtime.should be_close(Time.now - 100, 10)
330
+ File.stat(@archive).mtime.should be_close(Time.now - 100, 10)
297
331
  end
298
332
 
299
333
  it 'should update if one of the files is recent' do
@@ -342,7 +376,7 @@ describe TarTask, ' gzipped' do
342
376
 
343
377
  def inspect_archive
344
378
  entries = {}
345
- Zlib::GzipReader.open @archive do |gzip|
379
+ Zlib::GzipReader.open @archive do |gzip|
346
380
  Archive::Tar::Minitar.open gzip, 'r' do |reader|
347
381
  reader.each { |entry| entries[entry.directory ? "#{entry.name}/" : entry.name] = entry.read }
348
382
  end
@@ -370,23 +404,50 @@ describe ZipTask do
370
404
  entries
371
405
  end
372
406
 
407
+ it 'should include empty dirs' do
408
+ archive(@archive).include(@dir)
409
+ archive(@archive).invoke
410
+ inspect_archive do |archive|
411
+ archive.keys.should include('test/EmptyDir1/')
412
+ end
413
+ end
414
+
415
+ it 'should include empty dirs from Dir' do
416
+ archive(@archive).include(Dir["#{@dir}/*"])
417
+ archive(@archive).invoke
418
+ inspect_archive do |archive|
419
+ archive.keys.should include('EmptyDir1/')
420
+ end
421
+ end
422
+
373
423
  it 'should work with path object' do
374
424
  archive(@archive).path('code').include(@files)
375
425
  archive(@archive).invoke
376
426
  inspect_archive { |archive| archive.keys.should include('code/') }
377
427
  end
428
+
429
+ it 'should have path object that includes empty dirs' do
430
+ archive(@archive).path('code').include(Dir["#{@dir}/*"])
431
+ archive(@archive).invoke
432
+ inspect_archive do |archive|
433
+ archive.keys.should include('code/EmptyDir1/')
434
+ end
435
+ end
378
436
 
379
- it 'should preserve file permissions' do
380
- # with JRuby it's important to use absolute paths with File.chmod()
381
- # http://jira.codehaus.org/browse/JRUBY-3300
382
- hello = File.expand_path('src/main/bin/hello')
383
- write hello, 'echo hi'
384
- File.chmod(0777, hello) ||
385
- fail("Failed to set permission on #{hello}") unless (File.stat(hello).mode & 0777) == 0777
437
+ # chmod is not reliable on Windows
438
+ unless Buildr::Util.win_os?
439
+ it 'should preserve file permissions' do
440
+ # with JRuby it's important to use absolute paths with File.chmod()
441
+ # http://jira.codehaus.org/browse/JRUBY-3300
442
+ hello = File.expand_path('src/main/bin/hello')
443
+ write hello, 'echo hi'
444
+ File.chmod(0777, hello)
445
+ fail("Failed to set permission on #{hello}") unless (File.stat(hello).mode & 0777) == 0777
386
446
 
387
- zip('foo.zip').include('src/main/bin/*').invoke
388
- unzip('target' => 'foo.zip').extract
389
- (File.stat('target/hello').mode & 0777).should == 0777
447
+ zip('foo.zip').include('src/main/bin/*').invoke
448
+ unzip('target' => 'foo.zip').extract
449
+ (File.stat('target/hello').mode & 0777).should == 0777
450
+ end
390
451
  end
391
452
 
392
453
  end
@@ -399,6 +460,8 @@ describe Unzip do
399
460
  @files = %w{Test1.txt Text2.html}.map { |file| File.join(@dir, file) }.
400
461
  each { |file| write file, content_for(file) }
401
462
  @target = File.expand_path('target')
463
+ @targz = File.expand_path('test.tar.gz')
464
+ @targz2 = File.expand_path('test.tgz')
402
465
  end
403
466
 
404
467
  # Not too smart, we just create some content based on file name to
@@ -407,11 +470,21 @@ describe Unzip do
407
470
  "Content for #{File.basename(file)}"
408
471
  end
409
472
 
473
+ def with_tar(*args)
474
+ tar(@targz).include(*args.empty? ? @files : args).invoke
475
+ yield
476
+ end
477
+
478
+ def with_tar_too(*args)
479
+ tar(@targz2).include(*args.empty? ? @files : args).invoke
480
+ yield
481
+ end
482
+
410
483
  def with_zip(*args)
411
484
  zip(@zip).include(*args.empty? ? @files : args).invoke
412
485
  yield
413
486
  end
414
-
487
+
415
488
  it 'should touch target directory' do
416
489
  with_zip do
417
490
  mkdir @target
@@ -428,6 +501,20 @@ describe Unzip do
428
501
  end
429
502
  end
430
503
 
504
+ it 'should expand files from a tar.gz file' do
505
+ with_tar do
506
+ unzip(@target=>@targz).target.invoke
507
+ @files.each { |f| File.read(File.join(@target, File.basename(f))).should eql(content_for(f)) }
508
+ end
509
+ end
510
+
511
+ it 'should expand files from a .tgz file' do
512
+ with_tar_too do
513
+ unzip(@target=>@targz2).target.invoke
514
+ @files.each { |f| File.read(File.join(@target, File.basename(f))).should eql(content_for(f)) }
515
+ end
516
+ end
517
+
431
518
  it 'should expand all files' do
432
519
  with_zip do
433
520
  unzip(@target=>@zip).target.invoke
@@ -435,6 +522,13 @@ describe Unzip do
435
522
  end
436
523
  end
437
524
 
525
+ it 'should expand all files from a .tar.gz file' do
526
+ with_tar do
527
+ unzip(@target=>@targz).target.invoke
528
+ FileList[File.join(@target, '*')].size.should be(@files.size)
529
+ end
530
+ end
531
+
438
532
  it 'should expand only included files' do
439
533
  with_zip do
440
534
  only = File.basename(@files.first)
@@ -444,6 +538,15 @@ describe Unzip do
444
538
  end
445
539
  end
446
540
 
541
+ it 'should expand only included files from a .tar.gz file' do
542
+ with_tar do
543
+ only = File.basename(@files.first)
544
+ unzip(@target=>@targz).include(only).target.invoke
545
+ FileList[File.join(@target, '*')].should include(File.expand_path(only, @target))
546
+ FileList[File.join(@target, '*')].size.should be(1)
547
+ end
548
+ end
549
+
447
550
  it 'should expand all but excluded files' do
448
551
  with_zip do
449
552
  except = File.basename(@files.first)
@@ -453,6 +556,15 @@ describe Unzip do
453
556
  end
454
557
  end
455
558
 
559
+ it 'should expand all but excluded files with a .tar.gz file' do
560
+ with_tar do
561
+ except = File.basename(@files.first)
562
+ unzip(@target=>@targz).exclude(except).target.invoke
563
+ FileList[File.join(@target, '*')].should_not include(File.expand_path(except, @target))
564
+ FileList[File.join(@target, '*')].size.should be(@files.size - 1)
565
+ end
566
+ end
567
+
456
568
  it 'should include with nested path patterns' do
457
569
  with_zip @files, :path=>'test/path' do
458
570
  only = File.basename(@files.first)
@@ -469,6 +581,22 @@ describe Unzip do
469
581
  end
470
582
  end
471
583
 
584
+ it 'should include with nested path patterns with a .tar.gz file' do
585
+ with_tar @files, :path=>'test/path' do
586
+ only = File.basename(@files.first)
587
+ unzip(@target=>@targz).include(only).target.invoke
588
+ FileList[File.join(@target, '*')].should be_empty
589
+
590
+ Rake::Task.clear ; rm_rf @target
591
+ unzip(@target=>@targz).include('test/path/' + only).target.invoke
592
+ FileList[File.join(@target, 'test/path/*')].size.should be(1)
593
+
594
+ Rake::Task.clear ; rm_rf @target
595
+ unzip(@target=>@targz).include('test/**/*').target.invoke
596
+ FileList[File.join(@target, 'test/path/*')].size.should be(2)
597
+ end
598
+ end
599
+
472
600
  it 'should include with relative path' do
473
601
  with_zip @files, :path=>'test/path' do
474
602
  only = File.basename(@files.first)
@@ -488,7 +616,27 @@ describe Unzip do
488
616
  FileList[File.join(@target, 'path/*')].size.should be(2)
489
617
  end
490
618
  end
491
-
619
+
620
+ it 'should include with relative path with a .tar.gz file' do
621
+ with_tar @files, :path=>'test/path' do
622
+ only = File.basename(@files.first)
623
+ unzip(@target=>@targz).tap { |unzip| unzip.from_path('test').include(only) }.target.invoke
624
+ FileList[File.join(@target, '*')].should be_empty
625
+
626
+ Rake::Task.clear ; rm_rf @target
627
+ unzip(@target=>@targz).tap { |unzip| unzip.from_path('test').include('test/*') }.target.invoke
628
+ FileList[File.join(@target, 'path/*')].should be_empty
629
+
630
+ Rake::Task.clear ; rm_rf @target
631
+ unzip(@target=>@targz).tap { |unzip| unzip.from_path('test').include('path/*' + only) }.target.invoke
632
+ FileList[File.join(@target, 'path/*')].size.should be(1)
633
+
634
+ Rake::Task.clear ; rm_rf @target
635
+ unzip(@target=>@targz).tap { |unzip| unzip.from_path('test').include('path/*') }.target.invoke
636
+ FileList[File.join(@target, 'path/*')].size.should be(2)
637
+ end
638
+ end
639
+
492
640
  it 'should exclude with relative path' do
493
641
  with_zip @files, :path=>'test' do
494
642
  except = File.basename(@files.first)
@@ -498,6 +646,15 @@ describe Unzip do
498
646
  end
499
647
  end
500
648
 
649
+ it 'should exclude with relative path on a tar.gz file' do
650
+ with_tar @files, :path=>'test' do
651
+ except = File.basename(@files.first)
652
+ unzip(@target=>@targz).tap { |unzip| unzip.from_path('test').exclude(except) }.target.invoke
653
+ FileList[File.join(@target, '*')].should include(File.join(@target, File.basename(@files[1])))
654
+ FileList[File.join(@target, '*')].size.should be(@files.size - 1)
655
+ end
656
+ end
657
+
501
658
  it "should handle relative paths without any includes or excludes" do
502
659
  lib_files = %w{Test3.so Test4.rb}.
503
660
  map { |file| File.join(@dir, file) }.
@@ -508,6 +665,16 @@ describe Unzip do
508
665
  FileList[File.join(@target, '**/*')].should have(2).files
509
666
  end
510
667
 
668
+ it "should handle relative paths without any includes or excludes with a tar.gz file" do
669
+ lib_files = %w{Test3.so Test4.rb}.
670
+ map { |file| File.join(@dir, file) }.
671
+ each { |file| write file, content_for(file) }
672
+ tar(@targz).include(@files, :path => 'src').include(lib_files, :path => 'lib').invoke
673
+
674
+ unzip(@target=>@targz).tap { |unzip| unzip.from_path('lib') }.target.invoke
675
+ FileList[File.join(@target, '**/*')].should have(2).files
676
+ end
677
+
511
678
  it 'should return itself from root method' do
512
679
  task = unzip(@target=>@zip)
513
680
  task.root.should be(task)