Skip to content
This repository has been archived by the owner on Mar 1, 2023. It is now read-only.

Commit

Permalink
Switch to ENABLE_ANALYTICS={true,false}
Browse files Browse the repository at this point in the history
Better matches semantics of setting in config.js.
  • Loading branch information
textbook committed Oct 22, 2019
1 parent 4589574 commit c66431d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
16 changes: 8 additions & 8 deletions deployment/mixpanel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,24 +34,24 @@ set -euo pipefail
if [ $# -lt 1 ]; then
echo 'usage: ./mixpanel.sh <script-name> ...'
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 ''
Expand All @@ -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
12 changes: 6 additions & 6 deletions test-package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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'
Expand Down

0 comments on commit c66431d

Please sign in to comment.