On Sun, Oct 19, 2008 at 3:32 AM, Ittay Dror <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I want to build a zip by picking out specific files.
>
> Say my tree is
> a/
>  b/
>   c/
>     D.class
>     E.class
>   f/
>     G.class
>     H.class
>
> I want to package D.class and G.class only.
>
> What is the cleanest way of doing that?
>
> The cleanest way seems to me if I could pass the task a base directory and a
> list of relative paths so it will include the paths in the zip (as-is) taken
> from expanding them with the base directory (e.g., zip('a/b/c/D.class',
> 'a/b/f/G.class', :base => compile.target, :as-is => true))
>
> AFAIK, I can do:
> zip.include("#{compile.target}/a/b/c/D.class", :as => 'a/b/c/D.class')
> zip.include("#{compile.target}/a/b/f/G.class", :as => 'a/b/f/G.class')
>
> or:
> zip.path('a/b/c').include("#{compile.target}/a/b/c/D.class")
> zip.path('a/b/f').include("#{compile.target}/a/b/f/G.class")
>
> or:
> ['a/b/c/D.class', 'a/b/f/G.class'].each do |path|
>  zip.include("#{compile.target}/#{path}", :as => path
> end

:base would be easiest because you can specify multiple files/patterns
in a single include.

Assaf

>
> All of which look "unclean" to me.
>
> Thanks,
> Ittay
>
> --
> --
> Ittay Dror <[EMAIL PROTECTED]>
>
>
>

Reply via email to