From c66431d3e4fe16da037188546efd605ffecbfc74 Mon Sep 17 00:00:00 2001 From: Jonathan Sharpe Date: Tue, 22 Oct 2019 14:09:44 +0100 Subject: [PATCH] Switch to ENABLE_ANALYTICS={true,false} Better matches semantics of setting in config.js. --- deployment/mixpanel.sh | 16 ++++++++-------- test-package.sh | 12 ++++++------ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/deployment/mixpanel.sh b/deployment/mixpanel.sh index 84d99dc..7038b02 100755 --- a/deployment/mixpanel.sh +++ b/deployment/mixpanel.sh @@ -34,24 +34,24 @@ set -euo pipefail if [ $# -lt 1 ]; then echo 'usage: ./mixpanel.sh ...' echo 'This will report the script execution to MixPanel.' - echo 'Use ANALYTICS=0 (skip) or ANALYTICS=1 (send) to avoid the manual check.' + echo 'Use ENABLE_ANALYTICS=false (skip) or ENABLE_ANALYTICS=true (send) to avoid the manual check.' exit 1 fi -ANALYTICS=${ANALYTICS:-2} +ENABLE_ANALYTICS=${ENABLE_ANALYTICS:-unknown} MIXPANEL_TOKEN='d4de349453cc697734eced9ebedcdb22' PAYLOAD="{\"event\": \"Ran $1\", \"properties\": {\"token\": \"$MIXPANEL_TOKEN\", \"time\": $(date +%s)}}" URL="https:/api.mixpanel.com/track/?data=$(echo -n "$PAYLOAD" | base64)" -case $ANALYTICS in - 0) +case $ENABLE_ANALYTICS in + 'false') exit 0; ;; - 1) + 'true') echo "MixPanel response (1 means success): $(curl "$URL")"; exit 0; ;; - 2) + *) echo 'As the maintainers of Postfacto, we are interested in gaining more information' echo 'about installs so that we can make Postfacto better for you and other users.' echo '' @@ -66,11 +66,11 @@ case $ANALYTICS in echo '' echo 'Thanks for supporting Postfacto!' echo '' - echo 'You can use ANALYTICS=1 to avoid this check in the future.' + echo 'You can use ENABLE_ANALYTICS=true to avoid this check in the future.' echo '' echo "MixPanel response (1 means success): $(curl "$URL")" else - echo 'Skipping analytics. Use ANALYTICS=0 to avoid this check in the future.' + echo 'Skipping analytics. Use ENABLE_ANALYTICS=false to avoid this check in the future.' fi ;; esac diff --git a/test-package.sh b/test-package.sh index bd4b1aa..fe48027 100755 --- a/test-package.sh +++ b/test-package.sh @@ -91,15 +91,15 @@ then pushd "$SCRIPT_DIR/last-release/package/pcf" echo 'Deploying old version to Cloud Foundry' - ANALYTICS=0 ./deploy.sh $OLD_WEB $OLD_API 'apps.pcfone.io' + ENABLE_ANALYTICS=false ./deploy.sh $OLD_WEB $OLD_API 'apps.pcfone.io' popd pushd "$SCRIPT_DIR/package/pcf" echo 'Upgrading old version on Cloud Foundry' - ANALYTICS=0 ./upgrade.sh $OLD_WEB $OLD_API 'apps.pcfone.io' + ENABLE_ANALYTICS=false ./upgrade.sh $OLD_WEB $OLD_API 'apps.pcfone.io' echo 'Deploying new version to Cloud Foundry' - ANALYTICS=0 ./deploy.sh $NEW_WEB $NEW_API 'apps.pcfone.io' + ENABLE_ANALYTICS=false ./deploy.sh $NEW_WEB $NEW_API 'apps.pcfone.io' popd echo 'Cleaning up Cloud Foundry' @@ -128,15 +128,15 @@ then pushd "$SCRIPT_DIR/last-release/package/heroku" echo 'Deploying old version to Heroku' - ANALYTICS=0 ./deploy.sh $OLD_WEB $OLD_API + ENABLE_ANALYTICS=false ./deploy.sh $OLD_WEB $OLD_API popd pushd "$SCRIPT_DIR/package/heroku" echo 'Upgrading old version on Heroku' - ANALYTICS=0 ./upgrade.sh $OLD_WEB $OLD_API + ENABLE_ANALYTICS=false ./upgrade.sh $OLD_WEB $OLD_API echo 'Deploying new version to Heroku' - ANALYTICS=0 ./deploy.sh $NEW_WEB $NEW_API + ENABLE_ANALYTICS=false ./deploy.sh $NEW_WEB $NEW_API popd echo 'Cleaning up Heroku'