Skip to content

Commit

Permalink
Added confirmation to 'ahoy build' and 'ahoy down'.
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Skrypnyk committed Apr 23, 2020
1 parent 79a608e commit bc5d509
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
12 changes: 8 additions & 4 deletions .ahoy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ commands:

build:
usage: Build or rebuild the project.
cmd: ./scripts/drevops/build.sh
cmd: |
ahoy confirm "Running this command will remove your current database and files. Are you sure?" &&
./scripts/drevops/build.sh
info:
usage: Show information about this project.
Expand All @@ -48,9 +50,11 @@ commands:
down:
usage: Stop Docker containers and remove container, images, volumes and networks.
#: Always remove dangling volumes after removing containers to prevent
#: data leaking between builds (resulting in inconsistent builds).
cmd: "if [ -f \"docker-compose.yml\" ]; then docker-compose down --volumes; fi"
cmd: |
ahoy confirm "Running this command will remove your current database. Are you sure?" &&
#: Always remove dangling volumes after removing containers to prevent
#: data leaking between builds (resulting in inconsistent builds).
if [ -f "docker-compose.yml" ]; then docker-compose down --volumes; fi
start:
usage: Start all or specified existing Docker containers.
Expand Down
3 changes: 3 additions & 0 deletions scripts/drevops/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ set -e

echo "==> Building project."

# Suppress any confirmation dialogs in descendant calls.
export CONFIRM_RESPONSE=y

# Read variables from .env file, respecting existing environment variable values.
# shellcheck disable=SC1090,SC1091
t=$(mktemp) && export -p > "$t" && set -a && . ./.env && set +a && . "$t" && rm "$t" && unset t
Expand Down

0 comments on commit bc5d509

Please sign in to comment.