Skip to content

Commit

Permalink
fix: change action for makefile (#113)
Browse files Browse the repository at this point in the history
  • Loading branch information
luismayta committed Mar 11, 2021
1 parent 0588b6c commit 9afd0b6
Showing 1 changed file with 43 additions and 65 deletions.
108 changes: 43 additions & 65 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,101 +2,79 @@
# See ./CONTRIBUTING.rst
#

TAG :=""
END :=""

OS := $(shell uname)
.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
PROJECT := luca
PROJECT_PORT := 8000

PYTHON_VERSION=3.6.4
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:=🍺️
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
REQUIREMENTS_DIR=$(ROOT_DIR)/requirements
PROVISION_DIR:=$(ROOT_DIR)/provision
FILE_README:=$(ROOT_DIR)/README.rst
KEYS_DIR:="${HOME}/.ssh"
PATH_DOCKER_COMPOSE:=provision/docker-compose

include *.mk
pip_install := pip install -r
docker-compose:=docker-compose -f docker-compose.yml

include extras/make/*.mk

help:
@echo '${MESSAGE} Makefile for ${PROJECT}'
@echo ''
@echo 'Usage:'
@echo ' environment create environment with pyenv'
@echo ' install install dependences python by env'
@echo ' stage create stage with pyenv'
@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 ''
@make alias.help
@make docker.help
@make docs.help
@make flask.help
@make test.help
@make package.help
@make terraform.help
@make terragrunt.help
@make zappa.help

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
ifneq (Darwin,$(OS))
@sudo rm -rf .tox *.egg *.egg-info dist build .coverage .eggs .mypy_cache
@sudo rm -rf docs/build
@sudo find . -name '__pycache__' -delete -print -o -name '*.pyc' -delete -print -o -name '*.pyo' -delete -print -o -name '*~' -delete -print -o -name '*.tmp' -delete -print
else
@rm -rf .tox *.egg *.egg-info dist build .coverage .eggs .mypy_cache
@rm -rf docs/build
@find . -name '__pycache__' -delete -print -o -name '*.pyc' -delete -print -o -name '*.pyo' -delete -print -o -name '*~' -delete -print -o -name '*.tmp' -delete -print
endif
@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"
@if [ -e "${REQUIREMENTS_DIR}/private.txt" ]; then \
$(pip_install) "${REQUIREMENTS_DIR}/private.txt"; \
fi
pre-commit install
cp -rf .env-sample .env
cp -rf .hooks/prepare-commit-msg .git/hooks/
@if [ ! -e ".env" ]; then \
cp -rf .env-sample .env;\
fi

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
pyenv virtualenv "${PYTHON_VERSION}" "${PYENV_NAME}" >> /dev/null 2>&1 || echo $(MESSAGE_HAPPY)
pyenv activate "${PYENV_NAME}" >> /dev/null 2>&1 || echo $(MESSAGE_HAPPY)

0 comments on commit 9afd0b6

Please sign in to comment.