import selected parts of test suite from Rainbows!
[zbatery.git] / local.mk.sample
blob27311efe56b5f2fb7baed27f42cefb0f5d180c78
2 # this is the local.mk file used by Eric Wong on his dev boxes.
3 # GNUmakefile will source local.mk in the top-level source tree
4 # if it is present.
6 # This is depends on a bunch of GNU-isms from bash, sed, touch.
8 RSYNC = rsync
9 DLEXT := so
10 gems := rack-1.0.1
11 # gems += unicorn-0.95.2 # installed via setup.rb
12 # gems += rainbows-0.8.0 # installed via setup.rb
13 gems += rev-0.3.1
14 gems += iobuffer-0.1.1
15 gems += eventmachine-0.12.10
16 gems += async_sinatra-0.1.5 sinatra-0.9.4
18 # Avoid loading rubygems to speed up tests because gmake is
19 # fork+exec heavy with Ruby.
20 prefix = $(HOME)
21 ifeq ($(r19),)
22   RUBY := $(prefix)/bin/ruby
23   gem_paths := $(addprefix $(prefix)/lib/ruby/gems/1.8/gems/,$(gems))
24 else
25   prefix := $(prefix)/ruby-1.9
26   export PATH := $(prefix)/bin:$(PATH)
27   RUBY := $(prefix)/bin/ruby --disable-gems
28   gems += case-0.5 revactor-0.1.5
29   gem_paths := $(addprefix $(prefix)/lib/ruby/gems/1.9.1/gems/,$(gems))
30 endif
32 ifdef gem_paths
33   sp :=
34   sp +=
35   export RUBYLIB := $(subst $(sp),:,$(addsuffix /lib,$(gem_paths)))
36 endif
38 # pipefail is THE reason to use bash (v3+) or never revisions of ksh93
39 # SHELL := /bin/bash -e -o pipefail
40 SHELL := /bin/ksh93 -e -o pipefail
42 # trace execution of tests
43 # TRACER = strace -f -o $(t_pfx).strace -s 100000
44 TRACER = /usr/bin/time -v -o $(t_pfx).time
46 full-test: test-18 test-19
47 test-18:
48         $(MAKE) test 2>&1 | sed -e 's!^!1.8 !'
49 test-19:
50         $(MAKE) test r19=t 2>&1 | sed -e 's!^!1.9 !'
52 latest: NEWS
53         @awk 'BEGIN{RS="=== ";ORS=""}NR==2{sub(/\n$$/,"");print RS""$$0 }' < $<
55 # publishes docs to http://zbatery.bogomip.org/
56 publish_doc:
57         -git set-file-times
58         $(RM) -r doc ChangeLog NEWS
59         $(MAKE) doc LOG_VERSION=$(shell git tag -l | tail -1)
60         $(MAKE) -s latest > doc/LATEST
61         find doc/images doc/js -type f | \
62                 TZ=UTC xargs touch -d '1970-01-01 00:00:00' doc/rdoc.css
63         $(MAKE) doc_gz
64         chmod 644 $$(find doc -type f)
65         $(RSYNC) -av doc/ dcvr:/srv/zbatery/
66         git ls-files | xargs touch
68 # Create gzip variants of the same timestamp as the original so nginx
69 # "gzip_static on" can serve the gzipped versions directly.
70 doc_gz: docs = $(shell find doc -type f ! -regex '^.*\.\(gif\|jpg\|png\|gz\)$$')
71 doc_gz:
72         touch doc/NEWS.atom.xml -d "$$(awk 'NR==1{print $$4,$$5,$$6}' NEWS)"
73         for i in $(docs); do \
74           gzip --rsyncable -9 < $$i > $$i.gz; touch -r $$i $$i.gz; done
76 # launches any of the following shells with RUBYLIB set
77 irb sh bash ksh:
78         $@