include ./config/path.makefile
GULP = ./node_modules/gulp/bin/gulp.js

default: deploy
	@

# install local gulp and packages, empty db and static site files
install: DB_install Tasker_deploy
	$(GULP) install
	@

# install local gulp and packages, update db routines and static site files
deploy: DB_deploy Tasker_deploy
	$(GULP)

# copy server files
copy_files: Tasker_deploy
	$(GULP) --release --force
	rsync -ru --info=PROGRESS2  --exclude="application/config" --exclude="news.md" --exclude="updates.md"  \
\~dev_rating/ $(DST_PATH)

# server deploy without fix
release_no_fix: DB_deploy copy_files
	sed -i 's/~dev_rating//g' $(DST_PATH)/.htaccess
	sed -i 's/\/~dev_rating//g' $(DST_PATH)/application/bootstrap.php
	sed -i 's/\/~dev_rating//g' $(DST_PATH)/static/js/config.js
	chmod u=rwx,g=rx,o=r $(DST_PATH)/index.php


# server deploy with fix
release: DB_fix release_no_fix





# server deploy with dump load
load_deploy: DB_deployTest copy_files


# -----------------------
# Tasker section

Tasker_deploy:
	npm install

# -----------------------
# database forwarding

DB_%:
	@$(MAKE) $* -C ./db