Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow working dir in ZipHelper ZipOfIncludes #1014

Closed
Steinblock opened this issue Nov 24, 2015 · 1 comment
Closed

Allow working dir in ZipHelper ZipOfIncludes #1014

Steinblock opened this issue Nov 24, 2015 · 1 comment

Comments

@Steinblock
Copy link

http://fsharp.github.io/FAKE/apidocs/fake-ziphelper.html

After I build my project I have the following directory structure

ci\build\project1 (contains all files for project 1)
ci\build\project2 (contains all files for project 2)
ci\build\project3\sub\dir (contains all files for project 3)

Now I want to create a zip file named project-version.zip with directories projec1 and project2

Target "Zip" (fun _ ->
    [   "project1", !! "ci/build/project1/**/*"
        "project2", !! "ci/build/project2/**/*"
        "project3", !! "ci/build/project3/sub/dir/**/*"
    ]
    |> ZipOfIncludes (sprintf @"ci/deploy/project.%s.zip" buildVersion)
)

However, this would place all files from project 1 in the zip folder ci\build\project1 instead of project1

The CreateZip function contains a parameter working dir /// - workingDir - The relative dir of the zip files. Use this parameter to influence directory structure within zip file. which I would need to change this behaviour but ZipOfIncludes doesn't . It would be great to allow to define this per include (since project 3 in this example is even in a deeper structure.

So I want to write this:

Target "Zip" (fun _ ->
    [   "project1", "ci/build/project1",  !! "ci/build/project1/**/*"
        "project2",  !! "ci/build/project2/**/*" // allow ommiting working directory to maintain backward compability
        "project3", "ci/build/project3/sub/dir", !! "ci/build/project3/sub/dir/**/*"
    ]
    |> ZipOfIncludes (sprintf @"ci/deploy/project.%s.zip" buildVersion)
)
matthid added a commit that referenced this issue Feb 11, 2018
- Fix #1014 by adding some helpers
- Hide globbing behind an interface to make stuff more testable.
@matthid
Copy link
Member

matthid commented Feb 11, 2018

Fake 5 will have some helpers to be able to write:

Target "Zip" (fun _ ->
    [   !! "ci/build/project1/**/*"
            |> Zip.FilesAsSpecs "ci/build/project1"
            |> Zip.MoveToFolder "project1"
        !! "ci/build/project2/**/*"
            |> Zip.FilesAsSpecs "ci/build/project2"
            |> Zip.MoveToFolder "project2"
        !! "ci/build/project3/sub/dir/**/*"
            |> Zip.FilesAsSpecs "ci/build/project3"
            |> Zip.MoveToFolder "project3"
    ]
    |> Seq.concat
    |> Zip.ZipSpec (sprintf @"ci/deploy/project.%s.zip" buildVersion)
)

#1781

@matthid matthid closed this as completed Feb 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants