Skip to content

Commit

Permalink
update formula with adding automation script
Browse files Browse the repository at this point in the history
  • Loading branch information
rhysd committed Feb 9, 2019
1 parent 84178a8 commit e9b6655
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/target
*.bk
/env.sh
/HomebrewFormula/*.zip
6 changes: 3 additions & 3 deletions HomebrewFormula/git-brws.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
class GitBrws < Formula
version '0.9.1'
version '0.9.2'
desc 'Command line tool to open repository, file, commit, diff, pull request or issue in browser'
homepage 'https://github.com/rhysd/git-brws'

if OS.mac?
url "https://github.com/rhysd/git-brws/releases/download/#{version}/git-brws-#{version}-x86_64-apple-darwin.zip"
sha256 'c7d899a1879baa234c0c957179c613b2d1ed6fbf3c40543afbd2be83f0a6580f'
sha256 '31e552c7fdd254c6c04487c87c958c6530354de4eb78e45dc078baea5630b7bc' # mac
elsif OS.linux?
url "https://github.com/rhysd/git-brws/releases/download/#{version}/git-brws-#{version}-x86_64-unknown-linux-gnu.zip"
sha256 'fe72552912d1f753c6a54803f28e1209848900a7b4d5ea49d2b6bd31b8e529f3'
sha256 '1c368373d56b3bb74b92a1b01572e0662aec5e6f97f68c7e2fc971f5db3188cb' # linux
end

def install
Expand Down
47 changes: 47 additions & 0 deletions HomebrewFormula/update.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/bin/bash

set -e

if [ ! -d '.git' ]; then
echo 'This script must be run at root of the repository' 2>&1
exit 1
fi

if [[ "$1" == "" ]]; then
echo 'Usage: update.sh {version}' 2>&1
exit 1
fi

cd ./HomebrewFormula

VERSION="$1"

echo "Update formula to version ${VERSION}"

MAC_ZIP="git-brws-${VERSION}-x86_64-apple-darwin.zip"
MAC_URL="https://github.com/rhysd/git-brws/releases/download/${VERSION}/${MAC_ZIP}"

echo "Downloading ${MAC_ZIP}..."
curl -LO "$MAC_URL"
MAC_SHA="$(shasum -a 256 "$MAC_ZIP" | cut -f 1 -d ' ')"
echo "Mac sha256: ${MAC_SHA}"
sed -i '' -E "s/ sha256 '[0-9a-f]*' # mac/ sha256 '${MAC_SHA}' # mac/" git-brws.rb


LINUX_ZIP="git-brws-${VERSION}-x86_64-unknown-linux-gnu.zip"
LINUX_URL="https://github.com/rhysd/git-brws/releases/download/${VERSION}/${LINUX_ZIP}"

echo "Downloading ${LINUX_ZIP}..."
curl -LO "$LINUX_URL"
LINUX_SHA="$(shasum -a 256 "$LINUX_ZIP" | cut -f 1 -d ' ')"
echo "Linux sha256: ${LINUX_SHA}"
sed -i '' -E "s/ sha256 '[0-9a-f]*' # linux/ sha256 '${LINUX_SHA}' # linux/" git-brws.rb

echo "Version: ${VERSION}"
sed -i '' -E "s/ version '[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*'/ version '${VERSION}'/" git-brws.rb

echo "Clean up zip files"
rm -rf ./*.zip

echo 'Done.'

0 comments on commit e9b6655

Please sign in to comment.