Skip to content

Commit

Permalink
Merge 5fa063c into aaf4b4d
Browse files Browse the repository at this point in the history
  • Loading branch information
helllllllder committed Mar 24, 2022
2 parents aaf4b4d + 5fa063c commit c5f5fd7
Show file tree
Hide file tree
Showing 15 changed files with 3,163 additions and 1,912 deletions.
6 changes: 4 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ before_script:
- psql -U bothub postgres -c "CREATE DATABASE bothub;"

install:
- pip install pipenv
- pipenv install --system --dev
- pip install --upgrade pip
- pip install poetry==1.1.12
- poetry config virtualenvs.create false --local
- poetry install
- pip install coveralls
env:
global:
Expand Down
9 changes: 5 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,18 @@ RUN apt-get update \
RUN apt-get install make

RUN pip install -U pip==21.2.2 setuptools==57.4.0
RUN pip install pipenv==2021.5.29
RUN pip install poetry==1.1.12
RUN pip install gunicorn==19.9.0
RUN pip install gevent==1.4.0
RUN pip install psycopg2-binary
RUN apt-get install -y libjpeg-dev libgpgme-dev linux-libc-dev musl-dev libffi-dev libssl-dev
ENV LIBRARY_PATH=/lib:/usr/lib

COPY Pipfile Pipfile
COPY Pipfile.lock Pipfile.lock
COPY pyproject.toml pyproject.toml
COPY poetry.lock poetry.lock

RUN pipenv install --system
RUN poetry config virtualenvs.create false \
&& poetry install --no-interaction --no-ansi

COPY . .

Expand Down
28 changes: 14 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ install_requirements:

lint:
@make development_mode_guard
@PIPENV_DONT_LOAD_ENV=1 pipenv run black bothub
@PIPENV_DONT_LOAD_ENV=1 pipenv run flake8
@poetry run black bothub
@poetry run flake8
@echo "${SUCCESS}${NC} The code is following the PEP8"

ifeq (test,$(firstword $(MAKECMDGOALS)))
Expand All @@ -31,46 +31,46 @@ endif
test: development_mode_guard check_environment
@make migrate CHECK_ENVIRONMENT=false
@make collectstatic CHECK_ENVIRONMENT=false
@PIPENV_DONT_LOAD_ENV=1 SECRET_KEY=SK SUPPORTED_LANGUAGES="en|pt" pipenv run coverage run manage.py test $(RUN_ARGS)
@if [ ! $(RUN_ARGS) ]; then PIPENV_DONT_LOAD_ENV=1 pipenv run coverage report -m; fi;
@SECRET_KEY=SK SUPPORTED_LANGUAGES="en|pt" poetry run coverage run manage.py test $(RUN_ARGS)
@if [ ! $(RUN_ARGS) ]; then poetry run coverage report -m; fi;

migrate:
@make check_environment
@if [ ${IS_PRODUCTION} = true ]; \
then python manage.py migrate; \
else pipenv run python manage.py migrate; fi
else poetry run python manage.py migrate; fi

start:
@make development_mode_guard
@make check_environment
@make migrate CHECK_ENVIRONMENT=false
@make collectstatic CHECK_ENVIRONMENT=false
@pipenv run python ./manage.py runserver
@poetry run python ./manage.py runserver

start_celery:
@make development_mode_guard
@make check_environment
@make migrate CHECK_ENVIRONMENT=false
@make collectstatic CHECK_ENVIRONMENT=false
@pipenv run celery -A bothub worker -l info -B
@poetry run celery -A bothub worker -l info -B

migrations:
@make development_mode_guard
@make check_environment
@pipenv run python ./manage.py makemigrations
@poetry run python ./manage.py makemigrations
@make migrate CHECK_ENVIRONMENT=false

collectstatic:
@make check_environment
@if [ ${IS_PRODUCTION} = true ]; \
then python manage.py collectstatic --no-input; \
else pipenv run python manage.py collectstatic --no-input; fi
else poetry run python manage.py collectstatic --no-input; fi

search_index:
@make check_environment
@if [ ${IS_PRODUCTION} = true ]; \
then python manage.py search_index --rebuild -f; \
else pipenv run python manage.py search_index --rebuild -f; fi
else poetry run python manage.py search_index --rebuild -f; fi

# Utils

Expand All @@ -89,12 +89,12 @@ create_environment_vars_file:

install_development_requirements:
@echo "${INFO}Installing development requirements...${NC}"
@pipenv install --dev
@poetry install
@echo "${SUCCESS}${NC} Development requirements installed"

install_production_requirements:
@echo "${INFO}Installing production requirements...${NC}"
@pipenv install --system
@POETRY_VIRTUALENVS_CREATE=false poetry install --no-dev
@echo "${SUCCESS}${NC} Requirements installed"

development_mode_guard:
Expand All @@ -105,8 +105,8 @@ development_mode_guard:
# Checkers

_check_environment:
@type pipenv || (echo "${DANGER}${NC} Install pipenv to continue..." && exit 1)
@echo "${SUCCESS}${NC} pipenv installed"
@type poetry || (echo "${DANGER}${NC} Install poetry to continue..." && exit 1)
@echo "${SUCCESS}${NC} poetry installed"
@if [ ! -f "${ENVIRONMENT_VARS_FILE}" ] && [ ${IS_PRODUCTION} = false ]; \
then make create_environment_vars_file; \
fi
Expand Down
54 changes: 0 additions & 54 deletions Pipfile

This file was deleted.

Loading

0 comments on commit c5f5fd7

Please sign in to comment.