buildr 1.3.5 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +153 -8
- data/README.rdoc +1 -1
- data/addon/buildr/antlr.rb +5 -5
- data/addon/buildr/drb.rb +18 -18
- data/addon/buildr/hibernate.rb +18 -14
- data/addon/buildr/javacc.rb +4 -4
- data/addon/buildr/jetty.rb +5 -5
- data/addon/buildr/nailgun.rb +23 -23
- data/addon/buildr/openjpa.rb +1 -1
- data/addon/buildr/org/apache/buildr/BuildrNail$Main.class +0 -0
- data/addon/buildr/org/apache/buildr/BuildrNail.class +0 -0
- data/addon/buildr/org/apache/buildr/JettyWrapper$1.class +0 -0
- data/addon/buildr/org/apache/buildr/JettyWrapper$BuildrHandler.class +0 -0
- data/addon/buildr/org/apache/buildr/JettyWrapper.class +0 -0
- data/addon/buildr/protobuf.rb +75 -0
- data/addon/buildr/xmlbeans.rb +5 -5
- data/buildr.buildfile +2 -2
- data/buildr.gemspec +8 -7
- data/doc/_layouts/default.html +2 -2
- data/doc/artifacts.textile +4 -4
- data/doc/building.textile +35 -3
- data/doc/contributing.textile +5 -0
- data/doc/download.textile +16 -5
- data/doc/extending.textile +38 -12
- data/doc/installing.textile +6 -5
- data/doc/languages.textile +182 -42
- data/doc/more_stuff.textile +2 -2
- data/doc/packaging.textile +14 -15
- data/doc/projects.textile +7 -2
- data/doc/quick_start.textile +4 -4
- data/doc/scripts/buildr-git.rb +63 -63
- data/doc/scripts/gitflow.rb +21 -21
- data/doc/settings_profiles.textile +9 -2
- data/doc/testing.textile +16 -5
- data/etc/KEYS +38 -0
- data/lib/buildr/core/application.rb +33 -27
- data/lib/buildr/core/build.rb +41 -28
- data/lib/buildr/core/cc.rb +172 -0
- data/lib/buildr/core/checks.rb +1 -1
- data/lib/buildr/core/common.rb +7 -6
- data/lib/buildr/core/compile.rb +7 -8
- data/lib/buildr/core/doc.rb +263 -0
- data/lib/buildr/core/environment.rb +6 -6
- data/lib/buildr/core/filter.rb +77 -35
- data/lib/buildr/core/generate.rb +7 -7
- data/lib/buildr/core/help.rb +1 -1
- data/lib/buildr/core/osx.rb +6 -6
- data/lib/buildr/core/progressbar.rb +4 -4
- data/lib/buildr/core/project.rb +144 -36
- data/lib/buildr/core/shell.rb +34 -34
- data/lib/buildr/core/test.rb +89 -20
- data/lib/buildr/core/transports.rb +8 -7
- data/lib/buildr/core/util.rb +77 -23
- data/lib/buildr/core.rb +1 -0
- data/lib/buildr/groovy/bdd.rb +5 -5
- data/lib/buildr/groovy/compiler.rb +19 -15
- data/lib/buildr/groovy/shell.rb +6 -6
- data/lib/buildr/ide/eclipse/java.rb +3 -3
- data/lib/buildr/ide/eclipse/plugin.rb +8 -5
- data/lib/buildr/ide/eclipse/scala.rb +4 -2
- data/lib/buildr/ide/eclipse.rb +148 -75
- data/lib/buildr/ide/idea.rb +2 -2
- data/lib/buildr/ide/idea7x.rb +23 -4
- data/lib/buildr/java/ant.rb +4 -4
- data/lib/buildr/java/bdd.rb +51 -54
- data/lib/buildr/java/cobertura.rb +57 -35
- data/lib/buildr/java/commands.rb +14 -5
- data/lib/buildr/java/compiler.rb +3 -217
- data/lib/buildr/java/deprecated.rb +4 -4
- data/lib/buildr/java/doc.rb +70 -0
- data/lib/buildr/java/emma.rb +22 -22
- data/lib/buildr/java/jruby.rb +4 -4
- data/lib/buildr/java/jtestr_runner.rb.erb +27 -25
- data/lib/buildr/java/org/apache/buildr/JavaTestFilter.class +0 -0
- data/lib/buildr/java/org/apache/buildr/JavaTestFilter.java +8 -3
- data/lib/buildr/java/packaging.rb +30 -29
- data/lib/buildr/java/pom.rb +4 -4
- data/lib/buildr/java/rjb.rb +6 -6
- data/lib/buildr/java/test_result.rb +61 -85
- data/lib/buildr/java/tests.rb +44 -27
- data/lib/buildr/java/version_requirement.rb +8 -8
- data/lib/buildr/java.rb +1 -0
- data/lib/buildr/packaging/archive.rb +55 -22
- data/lib/buildr/packaging/artifact.rb +75 -36
- data/lib/buildr/packaging/artifact_namespace.rb +90 -78
- data/lib/buildr/packaging/artifact_search.rb +5 -5
- data/lib/buildr/packaging/gems.rb +11 -7
- data/lib/buildr/packaging/package.rb +10 -7
- data/lib/buildr/packaging/tar.rb +14 -14
- data/lib/buildr/packaging/version_requirement.rb +30 -10
- data/lib/buildr/packaging/ziptask.rb +51 -13
- data/lib/buildr/scala/bdd.rb +25 -20
- data/lib/buildr/scala/compiler.rb +87 -40
- data/lib/buildr/scala/doc.rb +106 -0
- data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.class +0 -0
- data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.java +57 -0
- data/lib/buildr/scala/shell.rb +14 -9
- data/lib/buildr/scala/tests.rb +33 -26
- data/lib/buildr/scala.rb +1 -0
- data/lib/buildr/shell.rb +33 -33
- data/lib/buildr.rb +1 -1
- data/rakelib/all-in-one.rake +113 -0
- data/rakelib/checks.rake +1 -1
- data/rakelib/doc.rake +7 -0
- data/rakelib/package.rake +1 -1
- data/rakelib/release.rake +9 -6
- data/rakelib/rspec.rake +26 -7
- data/rakelib/setup.rake +15 -3
- data/rakelib/stage.rake +18 -11
- data/spec/addon/drb_spec.rb +25 -25
- data/spec/core/application_spec.rb +111 -21
- data/spec/core/build_spec.rb +16 -15
- data/spec/core/cc_spec.rb +174 -0
- data/spec/core/checks_spec.rb +34 -34
- data/spec/core/common_spec.rb +51 -5
- data/spec/core/compile_spec.rb +89 -14
- data/spec/core/extension_spec.rb +127 -19
- data/spec/core/generate_spec.rb +2 -2
- data/spec/core/project_spec.rb +10 -10
- data/spec/core/test_spec.rb +144 -35
- data/spec/core/transport_spec.rb +8 -8
- data/spec/core/util_spec.rb +63 -5
- data/spec/groovy/bdd_spec.rb +5 -5
- data/spec/groovy/compiler_spec.rb +29 -18
- data/spec/ide/eclipse_spec.rb +185 -9
- data/spec/ide/idea7x_spec.rb +22 -10
- data/spec/java/ant_spec.rb +9 -5
- data/spec/java/bdd_spec.rb +29 -37
- data/spec/java/cobertura_spec.rb +12 -12
- data/spec/java/commands_spec.rb +34 -0
- data/spec/java/compiler_spec.rb +53 -53
- data/spec/java/emma_spec.rb +11 -11
- data/spec/java/java_spec.rb +10 -10
- data/spec/java/packaging_spec.rb +67 -20
- data/spec/java/test_coverage_helper.rb +18 -18
- data/spec/java/tests_spec.rb +13 -9
- data/spec/packaging/archive_spec.rb +187 -20
- data/spec/packaging/artifact_namespace_spec.rb +172 -83
- data/spec/packaging/artifact_spec.rb +83 -18
- data/spec/packaging/packaging_spec.rb +41 -14
- data/spec/sandbox.rb +23 -12
- data/spec/scala/bdd_spec.rb +13 -8
- data/spec/scala/compiler_spec.rb +18 -13
- data/spec/scala/scala.rb +3 -3
- data/spec/scala/tests_spec.rb +46 -24
- data/spec/spec_helpers.rb +28 -10
- data/spec/version_requirement_spec.rb +25 -11
- metadata +149 -133
- data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner$.class +0 -0
- data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.scala +0 -35
- 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
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
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
|
-
|
388
|
-
|
389
|
-
|
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)
|