|
|
|
.PHONY: clean_env init_env clean_virtualenv install_packages clean install run all
|
|
|
|
PYTHON=python2.7
|
|
|
|
VE_VER=12.0.7
|
|
|
|
LOCAL_PYTHON=bin/python
|
|
|
|
|
|
|
|
all: install
|
|
|
|
|
|
|
|
clean: clean_env
|
|
|
|
|
|
|
|
veryclean: clean clean_virtualenv
|
|
|
|
|
|
|
|
install: virtualenv bin/python install_packages
|
|
|
|
|
|
|
|
|
|
|
|
# phony, but depends on file
|
|
|
|
make_env: ${LOCAL_PYTHON}
|
|
|
|
|
|
|
|
# phony, but fast repeated execution
|
|
|
|
install_packages: make_env
|
|
|
|
bin/pip install -r requirements.txt
|
|
|
|
|
|
|
|
# phony
|
|
|
|
clean_env:
|
|
|
|
rm -rf bin/ include/ lib/ local/ share/
|
|
|
|
rm -f pip-selfcheck.json
|
|
|
|
|
|
|
|
# binary name representing set-up env
|
|
|
|
${LOCAL_PYTHON}: virtualenv
|
|
|
|
${PYTHON} virtualenv/virtualenv.py .
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# directory name
|
|
|
|
virtualenv:
|
|
|
|
curl -O https://pypi.python.org/packages/source/v/virtualenv/virtualenv-${VE_VER}.tar.gz
|
|
|
|
tar xvfz virtualenv-${VE_VER}.tar.gz
|
|
|
|
mv virtualenv-${VE_VER} virtualenv
|
|
|
|
rm virtualenv-${VE_VER}.tar.gz
|
|
|
|
|
|
|
|
# phony
|
|
|
|
clean_virtualenv:
|
|
|
|
rm -rf virtualenv/
|
|
|
|
|
|
|
|
|
|
|
|
TEST_USER=${USER}
|
|
|
|
TEST_SERVER=atrey.karlin.mff.cuni.cz
|
|
|
|
TEST_DIR=/akce/MaM/MaMweb/test/
|
|
|
|
|
|
|
|
# remote commands
|
|
|
|
HEAD=`git log --color=never |head -1|sed 's/.*commit //'`
|
|
|
|
push_test:
|
|
|
|
@echo "Checking out commited HEAD (${HEAD}) state at ${TEST_SSH} ..."
|
|
|
|
git push --all
|
|
|
|
ssh ${TEST_USER}@${TEST_SERVER} -n -x "\
|
|
|
|
cd ${TEST_DIR} && \
|
|
|
|
git fetch --all && \
|
|
|
|
git checkout ${HEAD} -f && \
|
|
|
|
git clean -f && \
|
|
|
|
cp mamweb/settings_test.py mamweb/settings.py && \
|
|
|
|
make install && \
|
|
|
|
./manage.py migrate --noinput && \
|
|
|
|
chown -R :mam . && \
|
|
|
|
chmod -R g+w . && \
|
|
|
|
echo Done."
|
|
|
|
@echo "Test deployed at ${TEST_SERVER}:${TEST_DIR} successfully."
|
|
|
|
|
|
|
|
|