Running Commands Conditionally

If you would like to run a command conditionally, you can make either use of shell scripting, or use one of our built-in helpers, not_if or only_if:

build:
    dependencies:
        before:
            -
                command: 'wget http://some/thing.tar.gz -O thing.tar.gz && tar -xzf thing.tar.gz'
                not_if: 'test -e thing'

    cache:
        directories:
            - 'thing'

In the above example, the file will be downloaded and extracted to a local directory only if that directory does not exist, yet. This for example makes sense if you want to cache certain tasks between your builds.