Skip to content

Instantly share code, notes, and snippets.

@davidrenne
Last active Oct 11, 2017
Embed
What would you like to do?
gocore install
set -e
appName=$1
username=$2
pushGithub=$3
rm -rf $appName/
camelUpper="${appName^}"
mkdir -p $appName/build$camelUpper
mkdir -p $appName/modelBuild$camelUpper
cd $appName/
IN=$(pwd)
arrIN=(${IN//src\// })
pathApp=${arrIN[1]}
cd ..
echo "package main" > $appName/build$camelUpper/build$camelUpper.go
echo "package main" > $appName/modelBuild$camelUpper/modelBuild$camelUpper.go
echo "import (" >> $appName/build$camelUpper/build$camelUpper.go
echo "import (" >> $appName/modelBuild$camelUpper/modelBuild$camelUpper.go
echo "\"github.com/cloud-ignite/GoCore/buildCore\"" >> $appName/build$camelUpper/build$camelUpper.go
echo "\"github.com/DanielRenne/GoCore/modelBuild\"" >> $appName/modelBuild$camelUpper/modelBuild$camelUpper.go
echo "\"flag\"" >> $appName/build$camelUpper/build$camelUpper.go
echo "\"flag\"" >> $appName/modelBuild$camelUpper/modelBuild$camelUpper.go
echo ")" >> $appName/build$camelUpper/build$camelUpper.go
echo ")" >> $appName/modelBuild$camelUpper/modelBuild$camelUpper.go
echo "func main() {" >> $appName/build$camelUpper/build$camelUpper.go
echo "func main() {" >>$appName/modelBuild$camelUpper/modelBuild$camelUpper.go
echo "// allow -configFile=test.json to be passed to build different configs other than webConfig.json" >> $appName/build$camelUpper/build$camelUpper.go
echo "// allow -configFile=test.json to be passed to build different configs other than webConfig.json" >> $appName/modelBuild$camelUpper/modelBuild$camelUpper.go
echo "configFile := flag.String(\"configFile\", \"webConfig.json\", \"Configuration File Name. Ex... webConfig.json\")" >> $appName/build$camelUpper/build$camelUpper.go
echo "configFile := flag.String(\"configFile\", \"webConfig.json\", \"Configuration File Name. Ex... webConfig.json\")" >> $appName/modelBuild$camelUpper/modelBuild$camelUpper.go
echo "flag.Parse()" >> $appName/build$camelUpper/build$camelUpper.go
echo "flag.Parse()" >> $appName/modelBuild$camelUpper/modelBuild$camelUpper.go
echo "buildCore.Initialize(\"src/$pathApp\", *configFile)" >> $appName/build$camelUpper/build$camelUpper.go
echo "modelBuild.Initialize(\"src/$pathApp\", *configFile)" >> $appName/modelBuild$camelUpper/modelBuild$camelUpper.go
echo "}" >> $appName/build$camelUpper/build$camelUpper.go
echo "}" >> $appName/modelBuild$camelUpper/modelBuild$camelUpper.go
cd $GOPATH
set +e
say "Copying app generation files"
set -e
go run "src/$pathApp/build$camelUpper/build$camelUpper.go"
set +e
say "Done copying app generation files"
echo "Done copying app generation files"
set -e
cd "src/$pathApp/"
git init
touch README.md
set +e
say "Adding git hub files"
echo "Adding git hub files"
say "Done with git hub and installing vendor packages next"
echo "Done with git hub and installing vendor packages next"
set -e
go install "$pathApp/install$camelUpper"
install$camelUpper
set +e
say "Vendor packages done and installing npm next"
echo "Vendor packages done and installing npm next"
set -e
cd $GOPATH/src/$pathApp/web/app
npm install
cd $GOPATH/src/$pathApp/bin
chmod +x *
set +e
bash format
set -e
cd "$GOPATH/src/$pathApp/"
git add .
git commit -m "Initial GoCore App Generation"
git remote add origin https://$pathApp.git
if [[ "$pushGithub" == "y" ]]; then
curl -u $username https://api.github.com/user/repos -d "{\"name\": \"$appName\"}";
git push -u $username origin master
fi
set +e
cd $GOPATH/src/$pathApp/web/app/javascript
set +e
say "npm install is done, next compile production javascripts"
echo "npm install is done, next compile production javascripts"
set -e
bash build.sh
cd $GOPATH
go install "$pathApp/modelBuild$camelUpper"
bash $GOPATH/src/$pathApp/bin/model_build
set +e
say "compiled go core model build, next run start app bash script"
echo "compiled go core model build, next run start app bash script"
set -e
bash "$GOPATH/src/$pathApp/bin/start_app"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment