buildr-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Assaf Arkin" <>
Subject Re: include/exclude method functionality
Date Fri, 18 Apr 2008 17:01:29 GMT
On Fri, Apr 18, 2008 at 4:28 AM, Ingo Schmidt <> wrote:

> Hi everyone!
> I really do have trouble using the include/exclude methods. While itseems
> so simple to use them, in practice there are a lot ofdifficulties.
> It would help me a great deal if I knew how they are supposed to behaveand
> then check, if they actually do behave as supposed. So here are myscenarios:
> unzip
> unzip("target/xyz"=>artifact(XYZ)).include("some/folder/**").extract
> My expected resuIt: recursive extraction of everything below some/folder
> into target/xyz
> Actual result: target/xyz is created, but empty
> Partial Solution:
> unzip("target/xyz"=>artifact(XYZ)).include("some/folder/**/*").extract
> This extracts everything recurisvely, but includes "some/folder". Is it
> also possible to only extract everything that is below some/folder?

The mechanism we use to expand these glob patterns is the File.fnmatch
function, which, unfortunately we apply non-uniformly with some interesting

As a general rule, you can always get a recursive match to happen using
'**/*', although there are some places that don't require it.

Separately, if you want to extract files from a path, you will have to tell
unzip about the path:
  include('**/*', :path=>'some/folder')

> zip
> zip(MYZIP).include("target/xyz/some/folder/subfolder/**")
> My expected result: Everything that is below subfolder is included
> Actual result: as I expected
> Comment: Why is the "**" working differently from unzip here?

It's a side effect of adding this as a convenience:

Just pointing to a directory is easier than specifying the full glob
pattern, so commonly used methods would tend to have this convenience,
zip.include (same as package.include) is one of these methods.

> package(:war)
> package(:war).exclude("**/test")

> My expected result: This would exclude any folder called "test" from the
> package
> Actual result: The folder(s) is/are still included
> Comment: Same applies forrule "folder/**". How do I exclude any files from
> the package? Notethat those files are actually placed in src/main/webapp and
> depeningon the environment (test,stage,deploy) I want to exclude them or
> not.

This should work, my best guess is a bug.

> package(:war).exclude("test")
> My expected result: Ideally this would remove the folder test in the
> package.
> Actual result: The folder is still included

Because the exclude pattern is not as smart as the include pattern, so the
exclude pattern would still have to use test/**/*.

This is definitely one area for cleaning past 1.3, so excludes start acting
as smart as includes (also when using filters, which have the same problem).


> To sum it up:
> How do I recursively unzip the contents of a subfolder in a zip file?How
> do I recursively unzip the contents of a subfolder in a zip file without
> creating the full folder structure?Why do "**" and "**/*" sometimes achieve
> the same result, sometimes not? What is the difference between the two?How
> do I exclude specific folders from a package, even if those folders are in
> src/main/xyzHow is the whole syntax supposed to work? I think the behaviour
> did change since release 1.2.0
> Some input on this would be really appreciated. Either I am totally
> notgetting something here or we do have indeed different behaviourdepending
> on the task the include is working on.
> Maybe it is a good idea to include some clear examples in the
> documentation? I am willing to write up such examples.
> Cheers, Ingo =;->

CTO, Intalio

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message