代码拉取完成,页面将自动刷新
#!/bin/bash
WORKSPACE=$(cd $(dirname $0)/; pwd)
cd $WORKSPACE
module=target/smartgo
smartgo=smartgo
stgregistry=stgregistry
stgbroker=stgbroker
stgclient=stgclient
function version() {
cd $WORKSPACE/$stgregistry/start
version=`./control.sh build`
echo $version
}
function pack() {
initialize
registry
broker
topic
tps
producer
consumer
build-all
}
function initialize() {
rm -rf $module
mkdir -p $module
cd $module
mkdir -p $stgregistry $stgbroker $stgclient
cd $WORKSPACE
}
function registry() {
cd $WORKSPACE/stgregistry/start
app=registry
version=`./control.sh build`
registryPkg=$app-$version.tar.gz
./control.sh pack
cp $registryPkg $WORKSPACE/$module/$stgregistry/
echo -n "build $registryPkg successful ... "
echo -e "\n"
}
function broker() {
cd $WORKSPACE/stgbroker/start
app=broker
version=`./control.sh build`
brokerPkg=$app-$version.tar.gz
./control.sh pack
cp $brokerPkg $WORKSPACE/$module/$stgbroker/
echo -n "build $brokerPkg successful ... "
echo -e "\n"
}
function topic() {
cd $WORKSPACE/example/stgclient/producer/sync/topic/
app=topic
pkg=create-topic
rm -rf $app
go get ./...
go build
cp $app $pkg
mv $pkg $WORKSPACE/$module/$stgclient/
echo -n "build $pkg successful ... "
echo -e "\n"
}
function tps() {
cd $WORKSPACE/example/stgclient/producer/sync/tps/
app=tps
pkg=producer-sync-tps
rm -rf $app
go get ./...
go build
cp $app $pkg
mv $pkg $WORKSPACE/$module/$stgclient/
echo -n "build $pkg successful ... "
echo -e "\n"
}
function producer() {
cd $WORKSPACE/example/stgclient/producer/sync/simple/
app=simple
pkg=producer-sync
rm -rf $app
go get ./...
go build
cp $app $pkg
mv $pkg $WORKSPACE/$module/$stgclient/
echo -n "build $pkg successful ... "
echo -e "\n"
}
function consumer() {
cd $WORKSPACE/example/stgclient/consumer/push/
app=push
pkg=consumer-push
rm -rf $app
go get ./...
go build
cp $app $pkg
mv $pkg $WORKSPACE/$module/$stgclient/
echo -n "build $pkg successful ... "
echo -e "\n"
}
function build-all() {
echo -e "\n\n"
cd $WORKSPACE/bin/
app=os.sh
cp $app $WORKSPACE/$module/
cd $WORKSPACE/$stgregistry/start
version=`./control.sh build`
cd $WORKSPACE/target
packName=$smartgo-$version.tar.gz
tar -zcvf $packName $smartgo
echo -n "build $packName successful ... "
echo -e "\n"
}
function help() {
echo "$0 pack|version"
}
if [ "$1" == "" ]; then
help
elif [ "$1" == "version" ];then
version
elif [ "$1" == "pack" ];then
pack
else
help
fi
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。