From 2ae9dfd89138957c1566c49604b86d857032153f Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Tue, 20 Feb 2018 10:15:44 -0500 Subject: [PATCH] cask update git commands --- scripts/cask-update.sh | 24 ++++++++++++++++++++++-- stores/homebrew-cask/bitwarden.rb | 24 ++++++++++++------------ 2 files changed, 34 insertions(+), 14 deletions(-) diff --git a/scripts/cask-update.sh b/scripts/cask-update.sh index a2ed83a0..6e75a5f3 100644 --- a/scripts/cask-update.sh +++ b/scripts/cask-update.sh @@ -1,14 +1,19 @@ #!/usr/bin/env bash set -e -# dependencies: -# brew install jq +# Dependencies: +# 1. brew install jq +# 2. fork of homebrew-cask repo setup. +# see https://github.com/caskroom/homebrew-cask/blob/master/CONTRIBUTING.md#getting-set-up-to-contribute +FORK_GITHUB_USER="kspearrin" DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +PWD_DIR="$(pwd)" ROOT_DIR="$DIR/.." DIST_DIR="$ROOT_DIR/dist" CASK_DIR="$ROOT_DIR/stores/homebrew-cask" DIST_CASK_DIR="$DIST_DIR/homebrew-cask" +GIT_CASKS_DIR=""$(brew --repository)"/Library/Taps/caskroom/homebrew-cask/Casks" if [ -d "$DIST_CASK_DIR" ] then @@ -28,3 +33,18 @@ RB_NEW="$DIST_CASK_DIR/bitwarden.rb.new" sed -e 's/__version__/'"$SRC_PACAKGE_VERSION"'/g; s/__checksum__/'"$CHECKSUM"'/g; s/__checkpoint__/'"$CHECKPOINT"'/g' $RB > $RB_NEW mv -f $RB_NEW $RB + +cd $GIT_CASKS_DIR +git checkout master +git pull +git reset --hard origin/master +git push $FORK_GITHUB_USER master +git push -d $FORK_GITHUB_USER bitwarden || true +git branch -D bitwarden || true +git checkout -b bitwarden +GIT_CASKS_RB="$GIT_CASKS_DIR/bitwarden.rb" +cp $RB $GIT_CASKS_RB +git add $GIT_CASKS_RB +git commit -m "Update Bitwarden.app to v$SRC_PACAKGE_VERSION" +git push $FORK_GITHUB_USER bitwarden +cd $PWD_DIR diff --git a/stores/homebrew-cask/bitwarden.rb b/stores/homebrew-cask/bitwarden.rb index b692a566..b28a4af6 100644 --- a/stores/homebrew-cask/bitwarden.rb +++ b/stores/homebrew-cask/bitwarden.rb @@ -1,13 +1,13 @@ cask 'bitwarden' do - version '__version__' - sha256 '__checksum__' - - # github.com/bitwarden/desktop was verified as official when first introduced to the cask - url "https://github.com/bitwarden/desktop/releases/download/v#{version}/bitwarden-#{version}-mac.zip" - appcast 'https://github.com/bitwarden/desktop/releases.atom', - checkpoint: '__checkpoint__' - name 'Bitwarden' - homepage 'https://bitwarden.com/' - - app 'Bitwarden.app' - end + version '__version__' + sha256 '__checksum__' + + # github.com/bitwarden/desktop was verified as official when first introduced to the cask + url "https://github.com/bitwarden/desktop/releases/download/v#{version}/bitwarden-#{version}-mac.zip" + appcast 'https://github.com/bitwarden/desktop/releases.atom', + checkpoint: '__checkpoint__' + name 'Bitwarden' + homepage 'https://bitwarden.com/' + + app 'Bitwarden.app' +end