[Rake-devel] Re-rooting a directory tree for use with package task

John Clayton john at fivesquaresoftware.com
Wed Sep 27 18:18:33 EDT 2006


Hi,

Let's say I have two source trees in a project, source1 and source2.   
Let's also say I want to create two packages when packing up the app  
for distribution, one from each tree.  So, I'd like to create one  
package with just the files under source1 and another with just the  
files in source2.

What I'd like:

source1
  | - file1
    - file2
    - file3
source2
  | - file1
    - file2
    - file3
pkg
  | - SuperApp-component1
     | - file1
       - file2
       - file3
  | - SuperApp-component2
     | - file1
       - file2
       - file3


What I get:

pkg
  | - SuperApp-component1
     | - source1
        | - file1
         - file2
         - file3
  | - SuperApp-component2
     | - source2
        | - file1
         - file2
         - file3



What I've tried so far (simplified):

Rake::PackageTask.new("SuperApp-component1") do |p|
   p.package_files = FileList["rails/**/*"]
end

- and -

Rake::PackageTask.new("SuperApp-component1") do |p|
   p.package_files = FileList["rails/**/*"].pathmap("%-1d")
end

The first gets the files, the second does not, of course, but I  
though i'd try ...

Is there anyway to re-root the copied files in a package task,  
subtracting the parent directory? I could of course copy the files to  
a temporary directory first, but I wondered if there is a way to do  
it with the package task.

Best,
John








More information about the Rake-devel mailing list