Makefile 3.35 KB
Newer Older
1 2 3
##################
# Install commands
##################
4
install-python:
5 6
	pip install -r requirements/django.txt
	pip install -r requirements/base.txt --only-binary=lxml,libsass
7 8 9 10

install-js:
	npm install

11 12
install-test:
	pip install -r requirements/test.txt
13

14
install: install-python install-js install-test javascript sass
15

16 17 18
##############################
# Generate js/css output files
##############################
19
STATIC_JS = openassessment/xblock/static/js
20
STATIC_CSS = openassessment/xblock/static/css
21

22 23 24 25 26
update-npm-requirements:
	npm update --silent
	cp ./node_modules/backgrid/lib/backgrid*.js $(STATIC_JS)/lib/backgrid/
	cp ./node_modules/backgrid/lib/backgrid*.css $(STATIC_CSS)/lib/backgrid/

27 28 29
javascript: update-npm-requirements
	node_modules/.bin/uglifyjs $(STATIC_JS)/src/oa_shared.js $(STATIC_JS)/src/*.js $(STATIC_JS)/src/lms/*.js $(STATIC_JS)/lib/backgrid/backgrid.min.js -c warnings=false > "$(STATIC_JS)/openassessment-lms.min.js"
	node_modules/.bin/uglifyjs $(STATIC_JS)/src/oa_shared.js $(STATIC_JS)/src/*.js $(STATIC_JS)/src/studio/*.js $(STATIC_JS)/lib/backgrid/backgrid.min.js -c warnings=false > "$(STATIC_JS)/openassessment-studio.min.js"
30

31
sass:
Eric Fischer committed
32
	python scripts/compile_sass.py
33

34
################
35
#Translations Handling
36
################
37 38
# creates the django-partial.po & django-partial.mo files
extract_translations:
39 40
	python manage.py makemessages -l en -v1 --ignore=".tox/*" --ignore="build/*" --ignore="docs/*" --ignore="edx-ora2/*" --ignore="logs/*" --ignore="node_modules/*" --ignore="performance/*" --ignore="requirements/*" --ignore="scripts/*" --ignore="settings/*" --ignore="storage/*" -d django
	python manage.py makemessages -l en -v1 --ignore=".tox/*" --ignore="build/*" --ignore="docs/*" --ignore="edx-ora2/*" --ignore="logs/*" --ignore="node_modules/*" --ignore="performance/*" --ignore="requirements/*" --ignore="scripts/*" --ignore="settings/*" --ignore="storage/*" -d djangojs
41 42 43

# compiles the *.po & *.mo files
compile_translations:
44
	cd ./openassessment/ && i18n_tool generate -v && cd ..
45 46 47 48 49

# generate dummy translations
generate_dummy_translations:
	i18n_tool dummy

50 51 52 53
# Test translation files
validate_translations:
	cd ./openassessment/ && i18n_tool validate -v

54 55 56 57
# check if translation files are up-to-date
detect_changed_source_translations:
	i18n_tool changed

58
# pull translations from Transifex
59
pull_translations:
60 61 62 63 64
	cd ./openassessment/ && tx pull -af --mode reviewed --minimum-perc=1

# push source translation files (.po) to Transifex
push_translations:
	tx push -s
65

66
# extract, compile, and check if translation files are up-to-date
67
check_translations_up_to_date: extract_translations compile_translations generate_dummy_translations detect_changed_source_translations
68 69

################
70 71
#Tests and checks
################
72
quality:
73
	./node_modules/.bin/jshint $(STATIC_JS)/src -c .jshintrc --verbose
74
	./node_modules/jscs/bin/jscs $(STATIC_JS)/src --verbose
75 76
	./scripts/run-pep8.sh
	./scripts/run-pylint.sh
77

78
test-python:
79
	coverage run manage.py test openassessment
80

81 82 83 84
render-templates:
	./scripts/render-templates.sh

test-js: render-templates
85
	./scripts/test-js.sh
86

87
test-js-debug: render-templates
88
	./scripts/js-debugger.sh
89

90
test: quality test-python test-js
91

92
# acceptance and a11y tests require a functioning sandbox, and do not run on travis
93 94 95 96 97
test-acceptance:
	./scripts/test-acceptance.sh tests

test-a11y:
	./scripts/test-acceptance.sh accessibility
98

99
test-sandbox: test-acceptance test-a11y