#command = env LANG=\"pt_BR.UTF-8\" /usr/bin/bundle exec /usr/local/bin/jekyll build --incremental --trace --destination=/var/www/html/alice_cast --source=/var/www/src/Alice_JK 2>&1
#command = script/script.sh && /usr/bin/bundle exec /usr/local/bin/jekyll build --trace --destination=/var/www/html/alice_cast --source=/var/www/src/Alice_JK 2>&1

JEKYLL_CMD = bundle exec jekyll

SRC_PATH = /var/www/src/Alice_JK
DEST_PATH = /var/www/html/aliceclass
LOG_PATH = /tmp/alicecast-jekyll.log

DEST_DIR_FLAGS = --destination=${DEST_PATH}
SRC_DIR_FLAGS = --source=${SRC_PATH}

BUILD_FLAGS = --trace --incremental
SERVE_FLAGS = -H 0.0.0.0 -P 33002

all: build

deploy: build
	sg www-data -c "cp -R _site ${DEST_PATH}"
	# sg www-data -c "chmod -R 775 ${DEST_PATH}"

build:
	${JEKYLL_CMD} build --trace

# Executa o build toda vez que muda um arquivo
# Rodando como serviço do systemd em /etc/systemd/system/alicecast-build-watch.service
# examplo: sg www-data -c 'make watch'

deploy_watch:
	sg www-data -c "${JEKYLL_CMD} build --trace ${DEST_DIR_FLAGS} -w"

watch:
	${JEKYLL_CMD} build ${BUILD_FLAGS} ${DEST_DIR_FLAGS} -w

serve:
	${JEKYLL_CMD} serve ${SRC_DIR_FLAGS} ${SERVE_FLAGS}

public_html:
	${JEKYLL_CMD} build {BUILD_FLAGS} --destination=~/public_html/aliceclass -w

clean:
	rm -rf _site
	# rm -rf ${DEST_PATH}/*
