Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
102 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
class Jplot < Formula | ||
desc "iTerm2 expvar/JSON monitoring tool" | ||
homepage "https://github.com/rs/jplot" | ||
url "https://github.com/rs/jplot/archive/1.0.0.tar.gz" | ||
sha256 "f6816198294c67e5d858effbfb744097a9c1520a494a1da6699b2a99422151d1" | ||
head "https://github.com/rs/jplot.git" | ||
|
||
if Hardware::CPU.is_64_bit? | ||
url "https://github.com/rs/jplot/releases/download/1.0.0/jplot_1.0.0_darwin_amd64.zip" | ||
sha256 "13529d71da748903de3e7e034722d30c4ef9cf1329f2dab366547d8afed4ea7e" | ||
else | ||
url "https://github.com/rs/jplot/releases/download/1.0.0/jplot_1.0.0_darwin_386.zip" | ||
sha256 "3581dc8488e45467ff4ec089a1c74216cea7e26e97091247f31f04ee79dd6c22" | ||
end | ||
|
||
depends_on "go" => :build | ||
|
||
def install | ||
bin.install "jplot" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
VERSION=$1 | ||
USER=rs | ||
NAME=jplot | ||
DESC="iTerm2 expvar/JSON monitoring tool" | ||
|
||
if [ -z $VERSION ]; then | ||
echo "usage: $0 VERSION" | ||
exit 1 | ||
fi | ||
|
||
github-release release -u $USER -r $NAME -t $VERSION | ||
|
||
rm -rf dist | ||
mkdir dist | ||
cleanup() { | ||
rm -rf dist | ||
} | ||
trap cleanup EXIT | ||
|
||
for env in darwin/amd64 darwin/386; do | ||
eval $(echo $env | tr '/' ' ' | xargs printf 'export GOOS=%s; export GOARCH=%s\n') | ||
|
||
GOOS=${env%/*} | ||
GOARCH=${env#*/} | ||
|
||
bin=$NAME | ||
if [ $GOOS == "windows" ]; then | ||
bin="$NAME.exe" | ||
fi | ||
|
||
mkdir -p dist | ||
|
||
echo "Building for GOOS=$GOOS GOARCH=$GOARCH" | ||
|
||
CGO_ENABLED=0 go build -o dist/$bin | ||
file=${NAME}_${VERSION}_${GOOS}_${GOARCH}.zip | ||
zip dist/$file -j dist/$bin | ||
rm -f dist/$bin | ||
|
||
github-release upload -u $USER -r $NAME -t $VERSION -n $file -f dist/$file | ||
done | ||
|
||
url=https://github.com/${USER}/${NAME}/archive/${VERSION}.tar.gz | ||
darwin_amd64=${NAME}_${VERSION}_darwin_amd64.zip | ||
darwin_386=${NAME}_${VERSION}_darwin_386.zip | ||
|
||
cat << EOF > jplot.rb | ||
class Jplot < Formula | ||
desc "$DESC" | ||
homepage "https://github.com/${USER}/${NAME}" | ||
url "$url" | ||
sha256 "$(curl $url | shasum -a 256 | awk '{print $1}')" | ||
head "https://github.com/${USER}/${NAME}.git" | ||
if Hardware::CPU.is_64_bit? | ||
url "https://github.com/${USER}/${NAME}/releases/download/${VERSION}/${darwin_amd64}" | ||
sha256 "$(shasum -a 256 dist/${darwin_amd64} | awk '{print $1}')" | ||
else | ||
url "https://github.com/${USER}/${NAME}/releases/download/${VERSION}/${darwin_386}" | ||
sha256 "$(shasum -a 256 dist/${darwin_386} | awk '{print $1}')" | ||
end | ||
depends_on "go" => :build | ||
def install | ||
bin.install "$NAME" | ||
end | ||
end | ||
EOF |