From 456a091c0569415358957dafddc5d046112c9245 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Mon, 19 Feb 2018 23:33:43 -0500 Subject: [PATCH] fixes to cask-update script --- .gitignore | 1 + scripts/cask-update.sh | 20 +++++++++----------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/.gitignore b/.gitignore index d6288f856f..d3181854ca 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ build/ yarn-error.log .DS_Store *.nupkg +*.provisionprofile diff --git a/scripts/cask-update.sh b/scripts/cask-update.sh index fea8d5a9b4..fbdc8d9322 100644 --- a/scripts/cask-update.sh +++ b/scripts/cask-update.sh @@ -10,23 +10,21 @@ DIST_DIR="$ROOT_DIR/dist" CASK_DIR="$ROOT_DIR/stores/homebrew-cask" DIST_CASK_DIR="$DIST_DIR/homebrew-cask" -cp -r $CASK_DIR $DIST_CASK_DIR - -if [ ! -d "$DIST_CASK_DIR" ] +if [ -d "$DIST_CASK_DIR" ] then rm -rf $DIST_CASK_DIR fi -cp -r $CASK_DIR $DIST_CASK_DIR +cp -r $CASK_DIR $DIST_DIR SRC_PACKAGE="$ROOT_DIR/src/package.json"; -SRC_PACAKGE_VERSION=(jq 'version' SRC_PACKAGE) +SRC_PACAKGE_VERSION=$(jq -r '.version' $SRC_PACKAGE) -ZIP="$DIST_DIR\Bitwarden-$SRC_PACAKGE_VERSION-mac.zip" -CHECKSUM=(shasum -a 256 $ZIP) -CHECKPOINT=(brew cask _appcast_checkpoint --calculate "https://github.com/bitwarden/desktop/releases.atom") +ZIP="$DIST_DIR/Bitwarden-$SRC_PACAKGE_VERSION-mac.zip" +CHECKSUM=($(shasum -a 256 $ZIP)) +CHECKPOINT=$(brew cask _appcast_checkpoint --calculate "https://github.com/bitwarden/desktop/releases.atom") RB="$DIST_CASK_DIR/bitwarden.rb" +RB_NEW="$DIST_CASK_DIR/bitwarden.rb.new" -sed -i -e 's/__version__/'"$SRC_PACAKGE_VERSION"'/g' $RB -sed -i -e 's/__checksum__/'"$CHECKSUM"'/g' $RB -sed -i -e 's/__checkpoint__/'"$CHECKPOINT"'/g' $RB +sed -e 's/__version__/'"$SRC_PACAKGE_VERSION"'/g; s/__checksum__/'"$CHECKSUM"'/g; s/__checkpoint__/'"$CHECKPOINT"'/g' $RB > $RB_NEW +mv -f $RB_NEW $RB