twolfson / grunt-zip

Zip and unzip files via a grunt plugin
MIT License
87 stars 19 forks source link

Unzipping file sets #39

Closed idogoren closed 8 years ago

idogoren commented 8 years ago

Hi,

I'd like to be a able to unzip a specific file set, according to certain settings in my environment, instead of unzipping all the files at one time, each time. (Please see my example below)

        unzip: {
            'orion8': {
                'target/orion8': 'target/orion8/orion8.zip'
            },
            'gitServerPackager': {
                'target/git-server-packager': 'target/git-server-packager/git-server-packager.zip'
            }
        },

This way, I will be able to define two different grunt tasks: one for orion8 and one for gitServerPackager and not unzipping them together each time, as in sone scenarios they might not be found. (since I don't need them)

Thanks

twolfson commented 8 years ago

Individual grunt tasks can be run via :subtask on the Grunt CLI. For example:

# Only run the orion8 subtask
grunt unzip:orion8

If you want to control tasks inside of node, environment variables can be introspected via process.env:

https://nodejs.org/api/process.html#process_process_env

process.env.MY_VAR

Otherwise, you can probably leverage bash:

if test "$MY_VAR" == "TRUE"; then
  grunt unzip:orion8
else
  grunt unzip:gitServerPackager
fi