use duck typing for REMOTE_ADDR detection
[rainbows.git] / local.mk.sample
blobaf12efb216dd7af7744aa3efd80fd61c01257d76
1 # this is the local.mk file used by Eric Wong on his dev boxes.
2 # GNUmakefile will source local.mk in the top-level source tree
3 # if it is present.
5 # This is depends on a bunch of GNU-isms from bash, sed, touch.
7 RSYNC = rsync
8 DLEXT := so
9 gems := rack-1.1.0
10 # gems += unicorn-0.96.0 # installed via setup.rb
11 gems += rev-0.3.2
12 gems += iobuffer-0.1.3
13 gems += eventmachine-0.12.10
14 gems += async_sinatra-0.1.5 sinatra-0.9.4
15 gems += neverblock-0.1.6.2
17 # Cramp isn't enabled by default since it depends on several prerelease gems
18 ifdef CRAMP
19   gems += cramp-0.7
20   gems += activesupport-3.0.pre
21   gems += activemodel-3.0.pre
22   gems += arel-0.2.pre
23   gems += usher-0.6.2
24   gems += fuzzyhash-0.0.11
25   gems += mysqlplus-0.1.1
26 endif
28 # Avoid loading rubygems to speed up tests because gmake is
29 # fork+exec heavy with Ruby.
30 prefix = $(HOME)
31 ifeq ($(r19),)
32   RUBY := $(prefix)/bin/ruby
33   gem_paths := $(addprefix $(prefix)/lib/ruby/gems/1.8/gems/,$(gems))
34 else
35   prefix := $(prefix)/ruby-1.9
36   export PATH := $(prefix)/bin:$(PATH)
37   RUBY := $(prefix)/bin/ruby --disable-gems
38   gems += case-0.5 revactor-0.1.5
39   gem_paths := $(addprefix $(prefix)/lib/ruby/gems/1.9.1/gems/,$(gems))
40 endif
42 ifdef gem_paths
43   sp :=
44   sp +=
45   export RUBYLIB := $(subst $(sp),:,$(addsuffix /lib,$(gem_paths)))
46 endif
48 # pipefail is THE reason to use bash (v3+) or never revisions of ksh93
49 # SHELL := /bin/bash -e -o pipefail
50 SHELL := /bin/ksh93 -e -o pipefail
52 # trace execution of tests
53 # TRACER = strace -f -o $(t_pfx).strace -s 100000
54 TRACER = /usr/bin/time -v -o $(t_pfx).time
56 full-test: test-18 test-19
57 test-18:
58         $(MAKE) test 2>&1 | sed -u -e 's!^!1.8 !'
59 test-19:
60         $(MAKE) test r19=t 2>&1 | sed -u -e 's!^!1.9 !'
62 latest: NEWS
63         @awk 'BEGIN{RS="=== ";ORS=""}NR==2{sub(/\n$$/,"");print RS""$$0 }' < $<
65 # publishes docs to http://rainbows.rubyforge.org
66 publish_doc:
67         -git set-file-times
68         $(RM) -r doc ChangeLog NEWS
69         $(MAKE) doc LOG_VERSION=$(shell git tag -l | tail -1)
70         $(MAKE) -s latest > doc/LATEST
71         find doc/images doc/js -type f | \
72                 TZ=UTC xargs touch -d '1970-01-01 00:00:00' doc/rdoc.css
73         $(MAKE) doc_gz
74         chmod 644 $$(find doc -type f)
75         $(RSYNC) -av doc/ rubyforge.org:/var/www/gforge-projects/rainbows/
76         $(RSYNC) -av doc/ dcvr:/srv/rainbows/
77         git ls-files | xargs touch
79 # Create gzip variants of the same timestamp as the original so nginx
80 # "gzip_static on" can serve the gzipped versions directly.
81 doc_gz: docs = $(shell find doc -type f ! -regex '^.*\.\(gif\|jpg\|png\|gz\)$$')
82 doc_gz:
83         touch doc/NEWS.atom.xml -d "$$(awk 'NR==1{print $$4,$$5,$$6}' NEWS)"
84         for i in $(docs); do \
85           gzip --rsyncable -9 < $$i > $$i.gz; touch -r $$i $$i.gz; done
87 # launches any of the following shells with RUBYLIB set
88 irb sh bash ksh:
89         $@