Skip to content

Commit

Permalink
refactor Makefile help to be more compact
Browse files Browse the repository at this point in the history
  • Loading branch information
crccheck committed Dec 27, 2015
1 parent 8fbd035 commit 0feaaec
Showing 1 changed file with 12 additions and 20 deletions.
32 changes: 12 additions & 20 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,23 +1,16 @@
VERSION = $(shell cat VERSION)
PROJECT=./example_project
MANAGE=$(PROJECT)/manage.py

help:
@echo "make commands:"
@echo " make help - this help"
@echo " make quickstart - setup a dev environment the first time"
@echo " make clean - remove generated files"
@echo " make test - run test suite"
@echo " make coverage - get coverage report"
@echo " make resetdb - delete and recreate the sqlite database"
@echo " make release - publish a release to PyPI"

# just a demo of how to get up and running quickly
PROJECT = ./example_project
MANAGE = $(PROJECT)/manage.py

help: ## Shows this help
@echo "$$(grep -h '#\{2\}' $(MAKEFILE_LIST) | sed 's/: #\{2\} / /' | column -t -s ' ')"

quickstart: ## Set up a dev environment for the first time
quickstart: resetdb
python $(MANAGE) createsuperuser
python $(MANAGE) runserver

clean:
clean: ## Remove generated files
rm -rf .coverage
rm -rf .tox
rm -rf MANIFEST
Expand All @@ -28,22 +21,20 @@ clean:
find . -name "*.pyc" -delete
find . -name ".DS_Store" -delete

test:
test: ## Run test suite
python -W ignore::RuntimeWarning $(MANAGE) test django_object_actions

coverage:
coverage: ## Run and then display coverage report
coverage erase
coverage run $(MANAGE) test django_object_actions
coverage report --show-missing

# destroy and then recreate your database
resetdb:
resetdb: ## Delete and then recreate the dev sqlite database
python $(MANAGE) reset_db --router=default --noinput
python $(MANAGE) syncdb --noinput
python $(MANAGE) migrate --noinput
python $(MANAGE) loaddata sample_data

# Set the version. Done this way to avoid fancy, brittle Python import magic
version:
@sed -i -r /version/s/[0-9.]+/$(VERSION)/ setup.py
@sed -i -r /version/s/[0-9.]+/$(VERSION)/ django_object_actions/__init__.py
Expand All @@ -53,6 +44,7 @@ version:
# 2. run `make release`
# 3. `git push --tags origin master`
# 4. update release notes
release: Publish a release to PyPI
release: clean version
@git commit -am "bump version to v$(VERSION)"
@git tag v$(VERSION)
Expand Down

0 comments on commit 0feaaec

Please sign in to comment.