buildr 1.4.20 → 1.4.21

Sign up to get free protection for your applications and to get access to all the features.
@@ -298,7 +298,7 @@ module Buildr #:nodoc:
298
298
  !@excludes.any? { |pattern| File.fnmatch(pattern, entry.name) }
299
299
  dest = path =~ /^\/?$/ ? entry.name : Util.relative_path(path + "/" + entry.name)
300
300
  trace "Adding #{dest}"
301
- file_map[dest] = lambda { |output| output.write source.read(entry) }
301
+ file_map[dest] = ZipEntryData.new(source, entry)
302
302
  end
303
303
  end
304
304
  end
@@ -306,6 +306,20 @@ module Buildr #:nodoc:
306
306
 
307
307
  end
308
308
 
309
+ class ZipEntryData
310
+ def initialize(zipfile, entry)
311
+ @zipfile = zipfile
312
+ @entry = entry
313
+ end
314
+
315
+ def call(output)
316
+ output.write @zipfile.read(@entry)
317
+ end
318
+
319
+ def mode
320
+ @entry.unix_perms
321
+ end
322
+ end
309
323
 
310
324
  def initialize(*args) #:nodoc:
311
325
  super
@@ -92,7 +92,7 @@ module Buildr #:nodoc:
92
92
 
93
93
  file_map.each do |path, content|
94
94
  if content.respond_to?(:call)
95
- tar.add_file(path, options) { |os, opts| content.call os }
95
+ tar.add_file(path, content.respond_to?(:mode) ? options.merge(:mode => content.mode) : options) { |os, _| content.call os }
96
96
  elsif content.nil?
97
97
  elsif File.directory?(content.to_s)
98
98
  stat = File.stat(content.to_s)
@@ -67,7 +67,8 @@ module Buildr #:nodoc:
67
67
  warn "Warning: Path in zipfile #{name} contains backslash: #{path}" if path =~ /\\/
68
68
  mkpath.call File.dirname(path)
69
69
  if content.respond_to?(:call)
70
- zip.put_next_entry(path, compression_level)
70
+ entry = zip.put_next_entry(path, compression_level)
71
+ entry.unix_perms = content.mode & 07777 if content.respond_to?(:mode)
71
72
  content.call zip
72
73
  elsif content.nil? || File.directory?(content.to_s)
73
74
  mkpath.call path
@@ -14,5 +14,5 @@
14
14
  # the License.
15
15
 
16
16
  module Buildr #:nodoc:
17
- VERSION = '1.4.20'.freeze
17
+ VERSION = '1.4.21'.freeze
18
18
  end
@@ -97,7 +97,7 @@ task 'stage' => %w(clobber prepare) do |task, args|
97
97
  puts 'Ensuring all files have appropriate group and other permissions...'
98
98
  sh 'find . -type f | xargs chmod go+r'
99
99
  sh 'find . -type d | xargs chmod go+rx'
100
- puts '[X] File permissions updated/validted.'
100
+ puts '[X] File permissions updated/validated.'
101
101
  end.call
102
102
 
103
103
  # Start by figuring out what has changed.
@@ -445,6 +445,23 @@ describe TarTask do
445
445
  unzip('target' => 'foo.tgz').extract
446
446
  (File.stat('target/hello').mode & 0777).should == 0777
447
447
  end
448
+
449
+ it 'should preserve file permissions when merging zip files' do
450
+ # with JRuby it's important to use absolute paths with File.chmod()
451
+ # http://jira.codehaus.org/browse/JRUBY-3300
452
+ hello = File.expand_path('src/main/bin/hello')
453
+ write hello, 'echo hi'
454
+ File.chmod(0777, hello)
455
+ fail("Failed to set permission on #{hello}") unless (File.stat(hello).mode & 0777) == 0777
456
+
457
+ foo = zip('foo.zip')
458
+ foo.include('src/main/bin/*').invoke
459
+ bar = tar('bar.tgz')
460
+ bar.merge(foo)
461
+ bar.invoke
462
+ unzip('target' => 'bar.tgz').extract
463
+ (File.stat('target/hello').mode & 0777).should == 0777
464
+ end
448
465
  end
449
466
 
450
467
  end
@@ -567,6 +584,23 @@ describe "ZipTask" do
567
584
  unzip('target' => 'foo.zip').extract
568
585
  (File.stat('target/hello').mode & 0777).should == 0777
569
586
  end
587
+
588
+ it 'should preserve file permissions when merging zip files' do
589
+ # with JRuby it's important to use absolute paths with File.chmod()
590
+ # http://jira.codehaus.org/browse/JRUBY-3300
591
+ hello = File.expand_path('src/main/bin/hello')
592
+ write hello, 'echo hi'
593
+ File.chmod(0777, hello)
594
+ fail("Failed to set permission on #{hello}") unless (File.stat(hello).mode & 0777) == 0777
595
+
596
+ foo = zip('foo.zip')
597
+ foo.include('src/main/bin/*').invoke
598
+ bar = zip('bar.zip')
599
+ bar.merge(foo)
600
+ bar.invoke
601
+ unzip('target' => 'bar.zip').extract
602
+ (File.stat('target/hello').mode & 0777).should == 0777
603
+ end
570
604
  end
571
605
 
572
606
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: buildr
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.20
4
+ version: 1.4.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Apache Buildr
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-26 00:00:00.000000000 Z
11
+ date: 2014-11-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -114,28 +114,28 @@ dependencies:
114
114
  requirements:
115
115
  - - '='
116
116
  - !ruby/object:Gem::Version
117
- version: 1.4.9
117
+ version: 1.5.1
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - '='
123
123
  - !ruby/object:Gem::Version
124
- version: 1.4.9
124
+ version: 1.5.1
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: atoulme-Antwrap
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - ~>
129
+ - - '='
130
130
  - !ruby/object:Gem::Version
131
- version: 0.7.4
131
+ version: 0.7.5
132
132
  type: :runtime
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - ~>
136
+ - - '='
137
137
  - !ruby/object:Gem::Version
138
- version: 0.7.4
138
+ version: 0.7.5
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: diff-lcs
141
141
  requirement: !ruby/object:Gem::Requirement
@@ -238,30 +238,30 @@ dependencies:
238
238
  name: bundler
239
239
  requirement: !ruby/object:Gem::Requirement
240
240
  requirements:
241
- - - ! '>='
241
+ - - ">="
242
242
  - !ruby/object:Gem::Version
243
243
  version: '0'
244
244
  type: :runtime
245
245
  prerelease: false
246
246
  version_requirements: !ruby/object:Gem::Requirement
247
247
  requirements:
248
- - - ! '>='
248
+ - - ">="
249
249
  - !ruby/object:Gem::Version
250
250
  version: '0'
251
251
  - !ruby/object:Gem::Dependency
252
252
  name: orderedhash
253
253
  requirement: !ruby/object:Gem::Requirement
254
254
  requirements:
255
- - - ! '>='
255
+ - - '='
256
256
  - !ruby/object:Gem::Version
257
- version: '0'
257
+ version: 0.0.6
258
258
  type: :runtime
259
259
  prerelease: false
260
260
  version_requirements: !ruby/object:Gem::Requirement
261
261
  requirements:
262
- - - ! '>='
262
+ - - '='
263
263
  - !ruby/object:Gem::Version
264
- version: '0'
264
+ version: 0.0.6
265
265
  - !ruby/object:Gem::Dependency
266
266
  name: jekyll
267
267
  requirement: !ruby/object:Gem::Requirement
@@ -388,18 +388,12 @@ dependencies:
388
388
  - - '='
389
389
  - !ruby/object:Gem::Version
390
390
  version: 1.2.1
391
- description: ! 'Apache Buildr is a build system for Java-based applications, including
392
- support
393
-
391
+ description: |
392
+ Apache Buildr is a build system for Java-based applications, including support
394
393
  for Scala, Groovy and a growing number of JVM languages and tools. We wanted
395
-
396
- something that''s simple and intuitive to use, so we only need to tell it what
397
-
394
+ something that's simple and intuitive to use, so we only need to tell it what
398
395
  to do, and it takes care of the rest. But also something we can easily extend
399
-
400
- for those one-off tasks, with a language that''s a joy to use.
401
-
402
- '
396
+ for those one-off tasks, with a language that's a joy to use.
403
397
  email: users@buildr.apache.org
404
398
  executables:
405
399
  - buildr
@@ -410,6 +404,13 @@ extra_rdoc_files:
410
404
  - LICENSE
411
405
  - NOTICE
412
406
  files:
407
+ - CHANGELOG
408
+ - LICENSE
409
+ - NOTICE
410
+ - README.rdoc
411
+ - Rakefile
412
+ - _buildr
413
+ - _jbuildr
413
414
  - addon/buildr/antlr.rb
414
415
  - addon/buildr/bnd.rb
415
416
  - addon/buildr/checkstyle-report.xsl
@@ -453,6 +454,8 @@ files:
453
454
  - addon/buildr/wsgen.rb
454
455
  - addon/buildr/xmlbeans.rb
455
456
  - bin/buildr
457
+ - buildr.buildfile
458
+ - buildr.gemspec
456
459
  - doc/_config.yml
457
460
  - doc/_layouts/default.html
458
461
  - doc/_layouts/preface.html
@@ -492,8 +495,9 @@ files:
492
495
  - doc/settings_profiles.textile
493
496
  - doc/testing.textile
494
497
  - etc/KEYS
495
- - lib/buildr/clojure/shell.rb
498
+ - lib/buildr.rb
496
499
  - lib/buildr/clojure.rb
500
+ - lib/buildr/clojure/shell.rb
497
501
  - lib/buildr/core/application.rb
498
502
  - lib/buildr/core/assets.rb
499
503
  - lib/buildr/core/build.rb
@@ -517,11 +521,11 @@ files:
517
521
  - lib/buildr/core/test.rb
518
522
  - lib/buildr/core/transports.rb
519
523
  - lib/buildr/core/util.rb
524
+ - lib/buildr/groovy.rb
520
525
  - lib/buildr/groovy/bdd.rb
521
526
  - lib/buildr/groovy/compiler.rb
522
527
  - lib/buildr/groovy/doc.rb
523
528
  - lib/buildr/groovy/shell.rb
524
- - lib/buildr/groovy.rb
525
529
  - lib/buildr/ide/eclipse.rb
526
530
  - lib/buildr/ide/idea.rb
527
531
  - lib/buildr/java/ant.rb
@@ -559,6 +563,7 @@ files:
559
563
  - lib/buildr/resources/failed.png
560
564
  - lib/buildr/resources/icons-license.txt
561
565
  - lib/buildr/run.rb
566
+ - lib/buildr/scala.rb
562
567
  - lib/buildr/scala/bdd.rb
563
568
  - lib/buildr/scala/compiler.rb
564
569
  - lib/buildr/scala/doc.rb
@@ -568,10 +573,8 @@ files:
568
573
  - lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.java
569
574
  - lib/buildr/scala/shell.rb
570
575
  - lib/buildr/scala/tests.rb
571
- - lib/buildr/scala.rb
572
576
  - lib/buildr/shell.rb
573
577
  - lib/buildr/version.rb
574
- - lib/buildr.rb
575
578
  - rakelib/all-in-one.rake
576
579
  - rakelib/checks.rake
577
580
  - rakelib/doc.rake
@@ -635,42 +638,34 @@ files:
635
638
  - spec/spec_helpers.rb
636
639
  - spec/version_requirement_spec.rb
637
640
  - spec/xpath_matchers.rb
638
- - buildr.gemspec
639
- - buildr.buildfile
640
- - LICENSE
641
- - NOTICE
642
- - CHANGELOG
643
- - README.rdoc
644
- - Rakefile
645
- - _buildr
646
- - _jbuildr
647
641
  homepage: http://buildr.apache.org/
648
- licenses: []
642
+ licenses:
643
+ - Apache-2.0
649
644
  metadata: {}
650
645
  post_install_message: To get started run buildr --help
651
646
  rdoc_options:
652
- - --title
647
+ - "--title"
653
648
  - Buildr
654
- - --main
649
+ - "--main"
655
650
  - README.rdoc
656
- - --webcvs
651
+ - "--webcvs"
657
652
  - https://github.com/apache/buildr
658
653
  require_paths:
659
654
  - lib
660
655
  - addon
661
656
  required_ruby_version: !ruby/object:Gem::Requirement
662
657
  requirements:
663
- - - ! '>='
658
+ - - ">="
664
659
  - !ruby/object:Gem::Version
665
660
  version: '0'
666
661
  required_rubygems_version: !ruby/object:Gem::Requirement
667
662
  requirements:
668
- - - ! '>='
663
+ - - ">="
669
664
  - !ruby/object:Gem::Version
670
665
  version: 1.8.6
671
666
  requirements: []
672
667
  rubyforge_project: buildr
673
- rubygems_version: 2.0.3
668
+ rubygems_version: 2.2.2
674
669
  signing_key:
675
670
  specification_version: 4
676
671
  summary: Build like you code