Skip to content
This repository
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 78 lines (62 sloc) 2.253 kb
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 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
.PHONY: all build tests test serve clean

all: sockjs.js

build: sockjs.js sockjs.min.js

sockjs.js: lib/*js version
coffee bin/render.coffee --set-version $(VER) lib/all.js > $@

sockjs.min.js: lib/*js version
coffee bin/render.coffee --set-version $(VER) --minify lib/all.js > $@

sockjs.pretty.js: lib/*js version
coffee bin/render.coffee --set-version $(VER) --minify --pretty lib/all.js > $@

tests/html/lib/sockjs.js: sockjs.js
cp $< $@

tests/html/lib/tests.js: tests/html/src/tests.coffee
coffee -o tests/html/lib/ -c --bare $<

test: tests
tests: tests/html/lib/sockjs.js tests/html/lib/tests.js
node tests/server.js


serve:
@if [ -e .pidfile.pid ]; then \
kill `cat .pidfile.pid`; \
rm .pidfile.pid; \
fi

@while [ 1 ]; do \
echo " [*] Running http server"; \
make test & \
SRVPID=$$!; \
echo $$SRVPID > .pidfile.pid; \
echo " [*] Server pid: $$SRVPID"; \
inotifywait -r -q -e modify .; \
kill `cat .pidfile.pid`; \
rm -f .pidfile.pid; \
sleep 0.1; \
done

clean:
rm -f sockjs*.js tests/html/lib/*.js

# To release:
# 1) commit everything you need
# 2) amend 'version' file (don't commit)
# 3) run 'make tag', and git push/git push --tag as suggested
# 4) run 'make upload', and suggested commands

RVER:=$(shell cat version)
VER:=$(shell ./VERSION-GEN)

.PHONY: tag upload
tag:
-git tag -d v$(RVER)
git commit $(TAG_OPTS) version -m "Release $(RVER)"
git tag -a v$(RVER) -m "Release $(RVER)"
@echo ' [*] Now run'
@echo 'git push; git push --tag'

upload: build
[ -e ../sockjs-client-gh-pages ] || \
git clone `git remote -v|tr "[:space:]" "\t"|cut -f 2` \
--branch gh-pages ../sockjs-client-gh-pages
(cd ../sockjs-client-gh-pages; git pull;)
for f in sock*js; do \
cp $$f ../sockjs-client-gh-pages/`echo $$f|sed 's|\(sockjs\)\(.*[.]js\)|\1-$(VER)\2|g'`; \
done
for f in sock*js; do \
cp $$f ../sockjs-client-gh-pages/`echo $$f|sed 's|\(sockjs\)\(.*[.]js\)|\1-latest\2|g'`; \
done
(cd ../sockjs-client-gh-pages; node generate_index.js > index.html;)
@echo ' [*] Now run:'
@echo '(cd ../sockjs-client-gh-pages; git add sock*js; git commit -m sock*js index.html -m "Release $(VER)"; git push;)'
Something went wrong with that request. Please try again.