Author: toulmean
Date: Thu Jul  8 02:49:43 2010
New Revision: 961564

URL: http://svn.apache.org/viewvc?rev=961564&view=rev
Log:
fix for BUILDR-144 Filter does not preserve file permissions

Modified:
    buildr/trunk/CHANGELOG
    buildr/trunk/lib/buildr/core/filter.rb
    buildr/trunk/spec/core/common_spec.rb

Modified: buildr/trunk/CHANGELOG
URL: 
http://svn.apache.org/viewvc/buildr/trunk/CHANGELOG?rev=961564&r1=961563&r2=961564&view=diff
==============================================================================
--- buildr/trunk/CHANGELOG (original)
+++ buildr/trunk/CHANGELOG Thu Jul  8 02:49:43 2010
@@ -1,9 +1,10 @@
 1.4.2 (pending)
+* Fixed: BUILDR-144 Filter does not preserve file permissions
+* Fixed: BUILDR-203 Compiler guessing very inefficient
 * Fixed: BUILDR-225 ArchiveTask#merge, not according to doc
 * Fixed: BUILDR-256 Automatically installing gems aborts rspec test runner 
(Rhett Sutphin)
 * Fixed: BUILDR-342 The jruby gem installer invokes the removed 
Gem.manage_gems function (Rhett Sutphin)
 * Fixed: BUILDR-464 Improve the versioning of Buildr (Rhett Sutphin)
-* Fixed: BUILDR-203 Compiler guessing very inefficient
 
 1.4.1 (2010-07-07)
 * Added:  BUILDR-420 Support external compiler

Modified: buildr/trunk/lib/buildr/core/filter.rb
URL: 
http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/core/filter.rb?rev=961564&r1=961563&r2=961564&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/core/filter.rb (original)
+++ buildr/trunk/lib/buildr/core/filter.rb Thu Jul  8 02:49:43 2010
@@ -188,9 +188,9 @@ module Buildr
             File.open(dest, 'wb') { |file| file.write mapped }
           else # no mapping
             cp source, dest
-            File.chmod(0664, dest)
           end
         end
+        File.chmod(File.stat(source).mode | 0200, dest)
       end
       touch target.to_s
       true

Modified: buildr/trunk/spec/core/common_spec.rb
URL: 
http://svn.apache.org/viewvc/buildr/trunk/spec/core/common_spec.rb?rev=961564&r1=961563&r2=961564&view=diff
==============================================================================
--- buildr/trunk/spec/core/common_spec.rb (original)
+++ buildr/trunk/spec/core/common_spec.rb Thu Jul  8 02:49:43 2010
@@ -539,6 +539,14 @@ describe Buildr::Filter do
       (File.stat(file).mode & 0o200).should == 0o200
     end
   end
+
+  it 'should preserve mode bits except readable' do
+    Dir['src/*'].each { |file| File.chmod(0o755, file) }
+    @filter.from('src').into('target').run
+    Dir['target/*'].sort.each do |file|
+      (File.stat(file).mode & 0o755).should == 0o755
+    end
+  end
 end
 
 describe Filter::Mapper do


Reply via email to