summaryrefslogtreecommitdiffstats
path: root/js/dav/Makefile
blob: 4ef8d4ab9f031d0cc8cbe7ea96be2639655843eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
HBS := $(shell find lib/template/ -name "*.hbs")
JS := $(shell find lib/ -name "*.js")

SABRE_DAV_VERSION=2.0.1
SABRE_DAV_RELEASE=sabredav-$(SABRE_DAV_VERSION)
SABRE_DAV_ZIPBALL=$(SABRE_DAV_RELEASE).zip

dav.zip: dav.js dav.min.js dav.js.map
	zip dav dav.js dav.js.map dav.min.js

dav.min.js dav.js.map: dav.js node_modules
	./node_modules/.bin/uglifyjs dav.js \
		--lint \
		--screw-ie8 \
		--output ./dav.min.js \
		--source-map ./dav.js.map

dav.js: build node_modules
	rm -rf dav.js /tmp/dav.js
	./node_modules/.bin/browserify --standalone dav ./build/index.js > /tmp/dav.js
	cat lib/polyfill/*.js /tmp/dav.js > dav.js

build: $(JS) $(HBS) node_modules
	rm -rf build/
	./node_modules/.bin/babel lib \
		--modules common \
		--out-dir build \
		--stage 4

node_modules: package.json
	npm install

.PHONY: clean
clean:
	rm -rf *.zip SabreDAV build coverage dav.* node_modules test/integration/server/SabreDAV

.PHONY: test
test: test-unit test-integration

.PHONY: test-unit
test-unit: node_modules
	./node_modules/.bin/mocha test/unit

.PHONY: test-integration
test-integration: node_modules test/integration/server/SabreDAV
	./node_modules/.bin/mocha test/integration

.PHONY: toc
toc: node_modules
	./node_modules/.bin/doctoc CONTRIBUTING.md
	./node_modules/.bin/doctoc HISTORY.md
	./node_modules/.bin/doctoc README.md

test/integration/server/SabreDAV: SabreDAV
	cp -r SabreDAV test/integration/server/SabreDAV
	cd test/integration/server/SabreDAV && cp ../calendarserver.php calendarserver.php

SabreDAV:
	wget -O $(SABRE_DAV_ZIPBALL) https://github.com/fruux/sabre-dav/releases/download/$(SABRE_DAV_VERSION)/$(SABRE_DAV_ZIPBALL)
	unzip -q $(SABRE_DAV_ZIPBALL)