fixes to cask-update script

This commit is contained in:
Kyle Spearrin 2018-02-19 23:33:43 -05:00
parent 64245fceed
commit 456a091c05
2 changed files with 10 additions and 11 deletions

1
.gitignore vendored
View File

@ -9,3 +9,4 @@ build/
yarn-error.log yarn-error.log
.DS_Store .DS_Store
*.nupkg *.nupkg
*.provisionprofile

View File

@ -10,23 +10,21 @@ DIST_DIR="$ROOT_DIR/dist"
CASK_DIR="$ROOT_DIR/stores/homebrew-cask" CASK_DIR="$ROOT_DIR/stores/homebrew-cask"
DIST_CASK_DIR="$DIST_DIR/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 then
rm -rf $DIST_CASK_DIR rm -rf $DIST_CASK_DIR
fi fi
cp -r $CASK_DIR $DIST_CASK_DIR cp -r $CASK_DIR $DIST_DIR
SRC_PACKAGE="$ROOT_DIR/src/package.json"; 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" ZIP="$DIST_DIR/Bitwarden-$SRC_PACAKGE_VERSION-mac.zip"
CHECKSUM=(shasum -a 256 $ZIP) CHECKSUM=($(shasum -a 256 $ZIP))
CHECKPOINT=(brew cask _appcast_checkpoint --calculate "https://github.com/bitwarden/desktop/releases.atom") CHECKPOINT=$(brew cask _appcast_checkpoint --calculate "https://github.com/bitwarden/desktop/releases.atom")
RB="$DIST_CASK_DIR/bitwarden.rb" 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 -e 's/__version__/'"$SRC_PACAKGE_VERSION"'/g; s/__checksum__/'"$CHECKSUM"'/g; s/__checkpoint__/'"$CHECKPOINT"'/g' $RB > $RB_NEW
sed -i -e 's/__checksum__/'"$CHECKSUM"'/g' $RB mv -f $RB_NEW $RB
sed -i -e 's/__checkpoint__/'"$CHECKPOINT"'/g' $RB