Created
June 13, 2012 05:56
-
-
Save mattrobenolt/2922132 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Location of main build file for require.js | |
JS_BUILD_FILE = kovu.build.js | |
# List of all drund apps for determining migrations | |
MIGRATE_APPS = \ | |
account \ | |
app.connections \ | |
app.filebrowser \ | |
app.reader \ | |
app.tv \ | |
external \ | |
partner \ | |
press \ | |
registration \ | |
www | |
# List of apps to run tests over | |
TEST_APPS = \ | |
account \ | |
www \ | |
thirdparty \ | |
profile \ | |
worker | |
# Get the right version of md5sum depending on the platform | |
MD5SUM = md5sum | |
ifeq ($(shell which $(MD5SUM)),) | |
MD5SUM = md5 -r | |
endif | |
.PHONY: all clean clean-pyc js templates static STATIC_HASH test testserver gunicorn help | |
all: js templates css static | |
clean: clean-pyc | |
find ./media -name *.template.js -delete | |
rm -rf ./media/main/js-build | |
rm -rf ./media/main/css/kovu.css | |
rm -rf ./static | |
rm -f ./env/* | |
clean-pyc: | |
find . -name "*.pyc" -delete | |
clean-vm: | |
vagrant destroy --force | |
css: | |
@../tools/less.js/bin/lessc --yui-compress -O2 ./media/main/css/kovu.less > ./media/main/css/kovu.css | |
@echo "Build successful." | |
js: templates | |
@node ../tools/r.js/dist/r.js -o $(JS_BUILD_FILE) | |
@python ../tools/find_dupes.py ./media/main/js-build/build.txt | |
@echo "Build successful <$(JS_BUILD_FILE)>" | |
templates: | |
@../tools/hogan.js/bin/hulk --wrapper amd --outputdir {{current_dir}} $(shell find ./media -name *.mustache) | |
@echo "Templates smushed successfully." | |
static: templates | |
@rm -rf ./static | |
./manage.py collectstatic --noinput --ignore=*.mustache --ignore=*.less -v0 | |
STATIC_HASH: | |
@echo "Calculating md5 hash of static files..." | |
@find ./media -type f | sort | xargs $(MD5SUM) | $(MD5SUM) | cut -c1-12 > ./env/STATIC_HASH | |
test: | |
./manage.py test --failfast --noinput $(TEST_APPS) | |
migrations: | |
@for app in $(MIGRATE_APPS); do \ | |
echo "Checking $$app..."; \ | |
./manage.py schemamigration $$app --auto; \ | |
done | |
vm: | |
@if [ -n $(SUDO_USER) ]; then \ | |
sudo -u $(SUDO_USER) -s 'vagrant up'; \ | |
else \ | |
vagrant up; \ | |
fi | |
@./manage.py syncdb --migrate --noinput > /dev/null | |
testserver: vm | |
@if [ -z $(SUDO_USER) ]; then \ | |
echo "'make testserver' must be run with sudo."; \ | |
exit 1; \ | |
else \ | |
node ../testserver/main.js; \ | |
fi | |
gunicorn: | |
@./manage.py run_gunicorn -k gevent -w 9 | |
help: | |
@echo "Please use \`make <target>' where <target> is one of" | |
@echo " all to compile javascript, css, and templates" | |
@echo " clean to delete all compiled files" | |
@echo " clean-pyc to delete just Python pyc files" | |
@echo " clean-vm to tear down and destroy the dev utilities server" | |
@echo " css to compile css files" | |
@echo " js to compile js files" | |
@echo " templates to compile mustache templates with Hogan" | |
@echo " static to run Django's collectstatic" | |
@echo " STATIC_HASH to calculate the md5 hash of all static files" | |
@echo " test to run the test suite" | |
@echo " migrations to auto generate migrations for all apps" | |
@echo " vm to run development utilities server with Vagrant" | |
@echo " testserver to run a local instance of Drund and all dependencies" | |
@echo " gunicorn to run Drund under gunicorn for production use" | |
@echo " help :)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment