<commit_before>#
# Makefile
# lespolypodes, 2014-06-25 12:44
#

RELEASES := releases
NOW := $(shell date +%Y-%m-%d--%H-%M-%S)
CURRENT := $(RELEASES)/$(NOW)

all: help

release: prepare pull

prepare:
	@test -d $(CURRENT) || mkdir -p $(CURRENT)

update: pull clear

pull:
	@echo "Updating sources using Git..."
	@cd $(CURRENT)
	@git pull origin prod
	@echo "Done."

clear:
	@echo "Clearing caches using drush..."
	@drush cc all
	@echo "Done."

help:
	@echo
	@echo "Available tasks:"
	@echo
	@echo "\tTo update:\tmake update"
	@echo "\tTo clear cache:\tmake clear"
	@echo

# vim:ft=make
#
<commit_msg>Update Makefile<commit_after>#
# Makefile
# <NAME>, 2014-06-25 12:44


############################################################################
# Vars

PWD := $(shell pwd)
RELEASES := $(PWD)/releases
CURRENT := $(PWD)/current
NOW := $(shell date +%Y-%m-%d--%H-%M-%S)
NEW := $(RELEASES)/NEW
REPO := "https://github.com/polypodes/Deploy.git"
BRANCH := 'master'
# Linux user & group
WWWUSER := ronan
WWWGROUP := wheel
# Colors
YELLOW := $(shell tput bold ; tput setaf 3)
GREEN := $(shell tput bold ; tput setaf 2)
RESETC := $(shell tput sgr0)

all: check help

############################################################################
# Specific tasks:

check:
	@test -d $(RELEASES) || mkdir -p $(RELEASES) && chmod -R 775 $(RELEASES)

permissions:
	@chmod -R 775 $(CURRENT)
	@chown -R $(WWWUSER):$(WWWGROUP) $(CURRENT)

switch:
	@echo "Switching actual 'current' & 'old' symlinks using the new release..."
	@if [ -a current ]; then mv current old; fi;
	@mv $(NEW) $(RELEASES)/$(NOW)
	@ln -s $(RELEASES)/$(NOW) $(CURRENT)

rollback:
	@mv current rollbacked
	@mv old current

clear:
	@echo "Clearing caches using drush..."
#	@drush cc all

done:
	@echo
	@ls -la
	@echo "${GREEN}Done.${RESETC}"
	@echo

help:
	@echo
	@echo "${GREEN}Usual tasks:${RESETC}"
	@echo
	@echo "\t* (clone) create a new release:\t\t\t${YELLOW}make release${RESETC}"
	@echo "\t* (pull) update the current release:\t\t${YELLOW}make update${RESETC}"
	@echo
	@echo "${GREEN}Other specific tasks:${RESETC}"
	@echo
	@echo "\t* (mkdir) check dirs structure:\t\t\t${YELLOW}make check${RESETC}"
	@echo "\t* (rm) clear cache:\t\t\t\t${YELLOW}make clear${RESETC}"
	@echo "\t* (chown+chmod) set up files/dirs permissions:\t${YELLOW}make permissions${RESETC}"
	@echo "\t* (mv) rollback to the previous/old release:\t${YELLOW}make switch${RESETC}"
	@echo

############################################################################
# Usual tasks:

release: check
	@echo "git-cloning sources using ${GREEN}$(BRANCH)${RESETC} branch..."
	@git clone -b $(BRANCH) $(REPO) $(NEW)
	@$(MAKE) switch
	@$(MAKE) clear
	@$(MAKE) done

update: check
	@echo "git-pulling sources using $(BRANCH) branch..."
	@cd $(CURRENT) && git pull origin $(BRANCH) && cd $(PWD)
	@$(MAKE) clear
	@$(MAKE) done



# vim:ft=make
#

{'fraction_non_alphanumeric': 0.2590782122905028, 'fraction_numerical': 0.011522346368715084, 'mean_word_length': 4.66205533596838, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3574314', 'n_tokens_mistral': 1118, 'n_tokens_neox': 1071, 'n_words': 296}