Skip to content

Commit

Permalink
New makefile commands to help development
Browse files Browse the repository at this point in the history
fecth-ui for retrieving pre-built ui assets from the official repo.
(Note: there's no automation adding these assets to releases
quipucords-ui yet)

The changes for clean command are admitelly opionated and tailored for
my personal taste as I never  saw myself destroying BOTH ui assets and
db. What is actually common on my workflow
is cleaning up cache files.

lock-requirements will help mantainig all requirements (see: 8fe6021).
  • Loading branch information
bruno-fs committed Mar 18, 2022
1 parent ee3a02e commit db3d470
Showing 1 changed file with 28 additions and 5 deletions.
33 changes: 28 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,47 @@ QPC_COMPARISON_REVISION = a362b28db064c7a4ee38fe66685ba891f33ee5ba
BINDIR = bin

QUIPUCORDS_UI_PATH = ../quipucords-ui
QUIPUCORDS_UI_RELEASE = 0.9.3

help:
@echo "Please use \`make <target>' where <target> is one of:"
@echo " help to show this message"
@echo " all to execute all following targets (except test)"
@echo " lint to run all linters"
@echo " clean to remove postgres docker container"
@echo " clean to remove pyc/cache files"
@echo " clean-db to remove postgres docker container / sqlite db"
@echo " clean-ui to remove UI assets"
@echo " lint-flake8 to run the flake8 linter"
@echo " lint-pylint to run the pylint linter"
@echo " lock-requirements to lock all python dependencies"
@echo " test to run unit tests"
@echo " test-coverage to run unit tests and measure test coverage"
@echo " swagger-valid to run swagger-cli validation"
@echo " setup-postgres to create a default postgres container"
@echo " server-init to run server initializion steps"
@echo " serve to run the server with default db"
@echo " manpage to build the manpage"
@echo " build-ui to build ui and place result in django server"
@echo " build-ui to build ui and place result in django server"
@echo " fetch-ui to fetch prebuilt ui and place it in django server"

all: lint test-coverage

clean:
rm -rf .pytest_cache quipucords.egg-info dist build $(shell find . | grep -P '(.*\.pyc)|(\.coverage(\..+)*)(.*__pycache__)$$')

clean-ui:
rm -rf quipucords/client
rm -rf quipucords/quipucords/templates
rm -rf quipucords/staticfiles

clean-db:
rm -rf quipucords/db.sqlite3
docker rm -f qpc-db
rm -rf quipucords/client
rm -rf quipucords/quipucords/templates

lock-requirements:
pip-compile --generate-hashes --output-file=requirements.txt requirements.in
pip-compile --allow-unsafe --generate-hashes --output-file=requirements-build.txt requirements-build.in
pip-compile --generate-hashes --output-file=dev-requirements.txt dev-requirements.in requirements.in

test:
PYTHONHASHSEED=0 QUIPUCORDS_MANAGER_HEARTBEAT=1 QPC_DISABLE_AUTHENTICATION=True PYTHONPATH=`pwd`/quipucords \
Expand Down Expand Up @@ -78,7 +94,14 @@ server-static:
serve:
$(PYTHON) quipucords/manage.py runserver --nostatic

build-ui:
build-ui: clean-ui
cd $(QUIPUCORDS_UI_PATH);yarn;yarn build
cp -rf $(QUIPUCORDS_UI_PATH)/dist/client quipucords/client
cp -rf $(QUIPUCORDS_UI_PATH)/dist/templates quipucords/quipucords/templates

fetch-ui: clean-ui
curl -k -SL https://github.com/quipucords/quipucords-ui/releases/download/$(QUIPUCORDS_UI_RELEASE)/quipucords-ui-dist.tar.gz -o ui-dist.tar.gz &&\
tar -xzvf ui-dist.tar.gz &&\
mv dist/templates quipucords/quipucords/templates &&\
mv dist/client quipucords/client &&\
rm -rf ui-dist* dist

0 comments on commit db3d470

Please sign in to comment.