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
| | # use GNU Make to run tests in parallel, and without depending on Rubygems
all:: test
RSYNC_DEST := bogomips.org:/srv/bogomips/mogilefs-client
T := $(wildcard test/test*.rb)
TO := $(subst .rb,.log,$(T))
test: $(T)
@cat $(TO) | ruby test/aggregate.rb
@$(RM) $(TO)
clean:
$(RM) $(TO) $(addsuffix +,$(TO))
ifndef V
quiet_pre = @echo '* $@';
quiet_post = >$(t) 2>&1
else
# we can't rely on -o pipefail outside of bash 3+,
# so we use a stamp file to indicate success and
# have rm fail if the stamp didn't get created
stamp = $@$(log_suffix).ok
quiet_pre = @echo $(ruby) $@ $(TEST_OPTS); ! test -f $(stamp) && (
quiet_post = && > $(stamp) )>&2 | tee $(t); rm $(stamp) 2>/dev/null
endif
ruby = ruby
run_test = $(quiet_pre) setsid $(ruby) -w $@ $(TEST_OPTS) $(quiet_post) || \
(sed "s,^,$(extra): ," >&2 < $(t); exit 1)
$(T): t = $(subst .rb,.log,$@)
$(T): export RUBYLIB := $(CURDIR)/lib:$(RUBYLIB)
$(T):
$(run_test)
# using make instead of rake since Rakefile takes too long to load
manifest: Manifest.txt
Manifest.txt:
git ls-files > $@+
cmp $@+ $@ || mv $@+ $@
$(RM) -f $@+
package: manifest
git diff --exit-code HEAD^0
$(RM) -r pkg/
rake fix_perms
rake package
libs := $(wildcard lib/*.rb lib/*/*.rb)
flay_flags =
flog_flags =
flay: $(libs)
flay $(flay_flags) $^
flog: $(libs)
flog $(flog_flags) $^
.PHONY: $(T) Manifest.txt
check-warnings:
@(for i in $$(git ls-files '*.rb'| grep -v '^setup\.rb$$'); \
do ruby -d -W2 -c $$i; done) | grep -v '^Syntax OK$$' || :
RSYNC = rsync
WRONGDOC = wrongdoc
doc:: .document .wrongdoc.yml $(pkg_extra)
-find lib -type f -name '*.rbc' -exec rm -f '{}' ';'
$(RM) -r doc
$(WRONGDOC) all
install -m644 $(shell LC_ALL=C grep '^[A-Z]' .document) doc/
cd doc && \
ln -s README README.txt && \
ln -s README.html README_txt.html && \
ln -s LICENSE LICENSE.txt && \
ln -s LICENSE.html LICENSE_txt.html && \
ln -s History History.txt && \
ln -s History.html History_txt.html
# Create gzip variants of the same timestamp as the original so nginx
# "gzip_static on" can serve the gzipped versions directly.
doc_gz: docs = $(shell find doc -type f ! -regex '^.*\.\(gif\|jpg\|png\|gz\)$$')
doc_gz:
for i in $(docs); do \
gzip --rsyncable -9 < $$i > $$i.gz; touch -r $$i $$i.gz; done
# this requires GNU coreutils variants
ifneq ($(RSYNC_DEST),)
publish_doc:
-git set-file-times
$(MAKE) doc
find doc/images -type f | \
TZ=UTC xargs touch -d '1970-01-01 00:00:06' doc/rdoc.css
$(MAKE) doc_gz
$(RSYNC) -av doc/ $(RSYNC_DEST)/
git ls-files | xargs touch
endif
.PHONY: doc
|