there we go
parent
03b679e152
commit
7cca58f524
|
|
@ -0,0 +1,4 @@
|
|||
*.tar
|
||||
simpleserve
|
||||
*.sw*
|
||||
**.sw*
|
||||
|
|
@ -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
|
||||
Loading…
Reference in New Issue