forked from luismayta/luca
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
102 lines (91 loc) · 3.27 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#
# See ./CONTRIBUTING.rst
#
TAG :=""
END :=""
.PHONY: help build up requirements clean lint test help
.DEFAULT_GOAL := help
PROJECT := python-facebook-chatbot
PROJECT_DEV := $(PROJECT)_dev
PROJECT_STAGE := $(PROJECT)_stage
PROJECT_TEST := $(PROJECT)_test
PYTHON_VERSION=3.6.1
PYENV_NAME="${PROJECT}"
TERRAFORM_VERSION := 0.10.0
# Git
GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
# Configuration.
SHELL := /bin/bash
ROOT_DIR=$(shell pwd)
MESSAGE:=༼ つ ◕_◕ ༽つ
MESSAGE_HAPPY:="${MESSAGE} Happy Coding"
EXTRAS_DIR:= $(ROOT_DIR)/extras
SCRIPT_DIR=$(EXTRAS_DIR)/scripts
SOURCE_DIR=$(ROOT_DIR)/
REQUIREMENTS_DIR=$(ROOT_DIR)/requirements/
PROVISION_DIR=$(ROOT_DIR)/provision/
DOCKER_COMPOSE_DIR=$(PROVISION_DIR)/docker-compose/
FILE_README=$(ROOT_DIR)/README.rst
include *.mk
help:
@echo '${MESSAGE} Makefile for ${PROJECT}'
@echo ''
@echo 'Usage:'
@echo ' environment create environment with pyenv'
@echo ' install install dependences python by env'
@echo ' clean remove files of build'
@echo ' setup install requirements'
@echo ' hooks copy hooks for git'
@echo ''
@echo ' Docker:'
@echo ''
@echo ' docker.build build all services with docker-compose'
@echo ' docker.cleanup Clean images docker unnecesary'
@echo ' docker.down down services docker-compose'
@echo ' docker.list list services of docker'
@echo ' docker.ssh connect by ssh to container'
@echo ' docker.stop stop services by env'
@echo ' docker.status status container by env'
@echo ' docker.verify_network verify network'
@echo ' docker.up up services of docker-compose'
@echo ' docker.run run {service} {env}'
@echo ' docker.list list services of docker'
@echo ''
@echo ' Docs:'
@echo ''
@echo ' docs.show Show restview README'
@echo ' docs.make.html Make documentation html'
@echo ' docs.make.pdf Make documentation pdf'
@echo ''
@echo ' Tests:'
@echo ''
@echo ' test Run All tests with coverage'
@echo ' test.lint Run all pre-commit'
@echo ' test.syntax Run all syntax in code'
@echo ''
clean:
@echo "$(TAG)"Cleaning up"$(END)"
@rm -rf .tox *.egg dist build .coverage
@find . -name '__pycache__' -delete -print -o -name '*.pyc' -delete -print -o -name '*.tmp' -delete -print
@echo
hook:
cp -rf $(EXTRAS_DIR)/git/hooks/prepare-commit.msg .git/hooks/
chmod a+x .git/hooks/prepare-commit.msg
setup: clean
$(pip_install) "${REQUIREMENTS_DIR}/setup.txt"
pre-commit install
cp -rf .env-sample .env
environment: clean
@if [ -e "$(HOME)/.pyenv" ]; then \
eval "$(pyenv init -)"; \
eval "$(pyenv virtualenv-init -)"; \
fi
pyenv virtualenv "${PYTHON_VERSION}" "${PYENV_NAME}" >> /dev/null 2>&1 || echo 'Oh Yeah!!'
pyenv activate "${PYENV_NAME}" >> /dev/null 2>&1 || echo 'Oh Yeah!!'
install: clean
@echo $(MESSAGE) "Deployment environment: ${env}"
@if [ "${env}" == "" ]; then \
$(pip_install) requirements.txt; \
else \
$(pip_install) "${REQUIREMENTS_DIR}/${env}.txt"; \
fi