Author: toulmean
Date: Tue Aug 24 05:16:00 2010
New Revision: 988390

URL: http://svn.apache.org/viewvc?rev=988390&view=rev
Log:
BUILDR-143 Upload to a file:// path needs ability to specify permissions (Joel 
Muzzerall)

Modified:
    buildr/trunk/CHANGELOG
    buildr/trunk/lib/buildr/core/transports.rb
    buildr/trunk/spec/core/transport_spec.rb

Modified: buildr/trunk/CHANGELOG
URL: 
http://svn.apache.org/viewvc/buildr/trunk/CHANGELOG?rev=988390&r1=988389&r2=988390&view=diff
==============================================================================
--- buildr/trunk/CHANGELOG (original)
+++ buildr/trunk/CHANGELOG Tue Aug 24 05:16:00 2010
@@ -6,6 +6,7 @@
 * Change: BUILDR-484 Upgrade to Scala 2.8.0 (final) and associated dependencies
           (ScalaCheck 1.7, ScalaTest 1.2, Specs 1.6.5)
 * Change: BUILDR-487 package :sources should default to using .jar extension 
(instead of .zip)
+* Fixed:  BUILDR-143 Upload to a file:// path needs ability to specify 
permissions (Joel Muzzerall)
 * Fixed:  BUILDR-144 Filter does not preserve file permissions
 * Fixed:  BUILDR-163 cobertura-check
 * Fixed:  BUILDR-203 Compiler guessing very inefficient

Modified: buildr/trunk/lib/buildr/core/transports.rb
URL: 
http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/core/transports.rb?rev=988390&r1=988389&r2=988390&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/core/transports.rb (original)
+++ buildr/trunk/lib/buildr/core/transports.rb Tue Aug 24 05:16:00 2010
@@ -484,6 +484,13 @@ module URI
 
     COMPONENT = [ :host, :path ].freeze
 
+    def upload(source, options = nil)
+      super
+      if File === source then
+        File.chmod(source.stat.mode, real_path)
+      end
+    end
+
     def initialize(*args)
       super
       # file:something (opaque) becomes file:///something

Modified: buildr/trunk/spec/core/transport_spec.rb
URL: 
http://svn.apache.org/viewvc/buildr/trunk/spec/core/transport_spec.rb?rev=988390&r1=988389&r2=988390&view=diff
==============================================================================
--- buildr/trunk/spec/core/transport_spec.rb (original)
+++ buildr/trunk/spec/core/transport_spec.rb Tue Aug 24 05:16:00 2010
@@ -63,6 +63,13 @@ describe URI, '#upload' do
     @uri = URI(URI.escape("file://#{File.expand_path(@target)}"))
   end
 
+  it 'should preserve file permissions if uploading to a file' do
+    File.chmod(0666, @source)
+    s = File.stat(@source).mode
+    @uri.upload @source
+    File.stat(@target).mode.should eql(s)
+  end
+
   it 'should upload file if found' do
     @uri.upload @source
     file(@target).should contain(@content)


Reply via email to