
install: install/system install/python
install/python: install/system @skip:key=./Pipfile.lock
    pipenv install

install/system:
    lazy-brew jq docker-compose

docker/bash: docker/build install/system
    docker-compose run --entrypoint=bash bake
docker/release: docker/build install/system
    docker-compose push
docker/build: install/system
    docker-compose build

lazy-brew() {
    set -e
    # Install jq if it's not available.

    if ! which jq > /dev/null; then
        set -ex && brew install jq > /dev/null
    fi

    # Install requested packages, if they aren't installed.
    for PACKAGE in "$@"; do
        if ! brew info --installed --json | jq 'map(.name) | index( "$PACKAGE" )' > /dev/null; then
            set -ex && brew install "$PACKAGE" > /dev/null
        fi
    done
}
