Last active
January 14, 2017 20:53
-
-
Save alphacentory/13105a4adfa06f690b1d to your computer and use it in GitHub Desktop.
go api bash script set up
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
#!/bin/bash | |
cd ${HOME} | |
if [[ $unamestr == "Darwin" ]]; then | |
echo "installing... homebrew..." | |
if ! which brew > /dev/null; then | |
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" | |
fi | |
echo "installing... git... go..." | |
brew install git go | |
fi | |
if [[ $unamestr == "Linux" ]]; then | |
echo "Please install Go. https://golang.org/doc/install\n" | |
echo "installing... git..." | |
if which apt-get > /dev/null; then | |
sudo apt-get install git | |
fi | |
if which yum > /dev/null; then | |
sudo yum install git | |
fi | |
fi | |
if ! which go > /dev/null; then | |
echo "install go... https://golang.org/doc/install" | |
exit; | |
fi | |
cd ${HOME} | |
if [ ! -d "./GoProjects" ]; then | |
mkdir GoProjects | |
fi | |
go get github.com/mattn/gom | |
export GOPATH=${PWD} | |
export PATH=${GOPATH}/bin:${PATH} | |
echo "add this to your terminal environment: " | |
echo "export GOPATH=${PWD}" | |
echo "export PATH=$GOPATH/bin:$PATH" | |
echo "installing go package gom!" | |
if ! which go > /dev/null; then | |
echo "go not installed... shit" | |
exit; | |
fi | |
if ! which gom > /dev/null; then | |
echo "please add this export to profile:" | |
echo "export $GOPATH/bin" | |
export ${GOPATH}/bin | |
fi | |
if ! which git > /dev/null; then | |
echo "Shit, no git." | |
echo "Install it." | |
fi | |
while true; do | |
echo "Create new api skeleton? (C)" | |
echo "Download exiting? (D)" | |
echo "Exit? (E)" | |
read -p ">>>>>>>>>" cde | |
case $cde in | |
[Cc]* ) | |
read -p "name project: " projectName | |
git clone [email protected]:MR0B0T/go-api-skeleton.git $projectName | |
cd $projectName | |
gom install | |
break;; | |
[Dd]* ) | |
read -p "git repo: " repo | |
read -p "name project: " proj | |
git clone $repo $proj | |
cd $proj | |
gom install | |
break;; | |
[Ee]* ) | |
break;; | |
* ) echo "Please answer correctly";; | |
esac | |
done | |
echo "done" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment