Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

file 100 lines (82 sloc) 3.087 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 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
.PHONY: all build tests test serve clean

COFFEE:=./node_modules/.bin/coffee

all: sockjs.js

build: sockjs.js sockjs.min.js

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

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

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

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

tests/html/lib/%.js: tests/html/src/%.coffee
@$(COFFEE) -v > /dev/null
$(COFFEE) -o tests/html/lib/ -c --bare $<

build_tests: tests/html/lib/sockjs.js tests/html/lib/tests.js \
tests/html/lib/unittests.js tests/html/lib/domtests.js \
tests/html/lib/endtoendtests.js

test: tests
tests: build_tests
node tests/server.js


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

@while [ 1 ]; do \
make build_tests; \
echo " [*] Running http server"; \
make test & \
SRVPID=$$!; \
echo $$SRVPID > .pidfile.pid; \
echo " [*] Server pid: $$SRVPID"; \
inotifywait -r -q -e modify . ../sockjs-node; \
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)
# The first two dots: 1.2.3 -> 1.2
MAJVER:=$(shell echo $(VER)|sed 's|^\([^.]\+\)[.]\([^.]\+\)[.]\([^.]\+\)[.].*$$|\1.\2|' )

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

upload: build
echo "Majver=$(MAJVER)"
[ -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
echo "Majver=$(MAJVER)"
for f in sock*js; do \
cp $$f ../sockjs-client-gh-pages/`echo $$f|sed 's|\(sockjs\)\(.*[.]js\)|\1-$(MAJVER)\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; git add sock*js; git commit sock*js -m "Release $(VER)";)
(cd ../sockjs-client-gh-pages; node generate_index.js > index.html; git add index.html; git commit index.html --amend -m "Release $(VER)";)
@echo ' [*] Now run: '
@echo '(cd ../sockjs-client-gh-pages; git push; )'
@echo '(cd ../sockjs-client-gh-pages; \
s3cmd sync . s3://sockjs --acl-public --exclude ".*" --include index.html --include "sockjs*.js"; );'
Something went wrong with that request. Please try again.