there we go

master
Bel LaPointe 2019-07-16 07:21:49 -06:00
parent 03b679e152
commit 7cca58f524
2 changed files with 48 additions and 0 deletions

4
.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
*.tar
simpleserve
*.sw*
**.sw*

44
build.sh Normal file
View File

@ -0,0 +1,44 @@
#! /bin/bash
ss=simpleserve
function main() {
init
server
local name="$(gitname)"
pack "$name"
}
function init() {
set -e
cd "$(dirname "$BASH_SOURCE")"
}
function server() {
pushd "$GOPATH/src/local/$ss"
local f="$(gobuild)"
popd
mv "$f" "./$ss"
}
function gobuild() {
GOOS=linux CGO_ENABLED=0 go build -o /tmp/${PWD##*/} -a -installsuffix cgo >&2
echo "/tmp/${PWD##*/}"
}
function gitname() {
local name="$(git describe --tags)"
if [ -z "$name" ]; then
name="$(git rev-parse --abbrev-ref HEAD)"
fi
echo "$name"
}
function pack() {
tar -czf "$1.tar" "$ss" "public"
echo "$1.tar"
}
if [ "$0" == "${BASH_SOURCE[0]}" ]; then
main "$@"
fi