Last active
August 29, 2015 14:14
-
-
Save b4oshany/473ef1ba7cfca2d4625e to your computer and use it in GitHub Desktop.
GAE-INIT installer
This file contains hidden or 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
APPENGINE_PATH = /usr/local/google_appengine | |
APPENGINE_APPCFG = /usr/local/google_appengine/appcfg.py | |
APP_PATH = $(shell pwd) | |
MAIN_PATH = ${APP_PATH}/main | |
USER = $(shell whoami) | |
USER_HOME = /home/${USER} | |
flush: | |
python run.py -f | |
clean: | |
python run.py -c | |
clean_all: | |
python run.py -C | |
deploy: | |
python run.py -m | |
python APPENGINE_APPCFG update --oauth2 main/ | |
start: | |
. ../venv/bin/activate | |
./run.py -s | |
install_requirements: | |
# Install the required software if not installed | |
if [ -z $(shell which curl) ]; then \ | |
sudo apt-get install curl; \ | |
fi | |
if [ -z $(shell which gcloud) ]; then \ | |
cd ${USER_HOME} && curl https://sdk.cloud.google.com | bash; \ | |
echo "Navigate to the startuprobot folder and return the make install."; \ | |
exec bash; \ | |
fi | |
if [ -z $(shell which pip) ]; then \ | |
sudo apt-get install python-pip; \ | |
sudo pip install pep8; \ | |
sudo pip install flakes8; \ | |
fi | |
if [ -z $(shell which virtualenv) ]; then \ | |
sudo apt-get install python-virtualenv; \ | |
fi | |
if [ -z $(shell which nodejs) ]; then \ | |
curl -sL https://deb.nodesource.com/setup | sudo bash -; \ | |
sudo apt-get install -y nodejs; \ | |
fi | |
if [ -z $(shell which npm) ]; then \ | |
sudo apt-get install npm; \ | |
fi | |
install_setup: install_requirements | |
# Install google appengine and add it to the /usr/local/ as a soft link. | |
gcloud components update gae-python | |
if [ ! -f "${APPENGINE_PATH}" ]; then \ | |
sudo ln -s ${USER_HOME}/google-cloud-sdk/platform/google_appengine ${APPENGINE_PATH}; \ | |
fi | |
if [ ! -d "../venv/" ]; then \ | |
cd ${APP_PATH}/.. && virtualenv venv; \ | |
fi | |
curl -o .git/hooks/commit-msg http://199.223.236.52/commit-msg | |
chmod 755 .git/hooks/commit-msg | |
$(eval url := $(shell grep -o ssh://.* .git/config | head -n1)) | |
sed -i '/\tpush\s=/ c\' .git/config | |
sed -i '/\tpushurl\s=/ c\' .git/config | |
sed -i '/\tfetch\s=/a \\t\push = HEAD:refs/for/master' .git/config | |
sed -i '/\tpush\s=/i \\t\pushurl = ${url}' .git/config | |
install: install_setup | |
cd ${APP_PATH} | |
( \ | |
. ../venv/bin/activate; \ | |
pip install -r requirements.txt; \ | |
pip install -r testing-requirements.txt; \ | |
) | |
#-- ########################################################### --# | |
# | |
# If you want to run the application, do the following: | |
# . ../venv/bin/activate | |
# ./run.py -s | |
# | |
#-- ########################################################### --# |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment