test for client-side Content-MD5 callback on upload
[ruby-mogilefs-client.git] / GNUmakefile
bloba46107b6594d409e7de4d092f5f95be3a11e5924
1 # use GNU Make to run tests in parallel, and without depending on Rubygems
2 all:: test
3 RSYNC_DEST := bogomips.org:/srv/bogomips/mogilefs-client
4 git_version_gen := $(shell ./GIT-VERSION-GEN)
6 T := $(wildcard test/test*.rb)
7 TO := $(subst .rb,.log,$(T))
9 test: $(T)
10 @cat $(TO) | ruby test/aggregate.rb
11 @$(RM) $(TO)
12 clean:
13 $(RM) $(TO) $(addsuffix +,$(TO))
16 ifndef V
17 quiet_pre = @echo '* $@';
18 quiet_post = >$(t) 2>&1
19 else
20 # we can't rely on -o pipefail outside of bash 3+,
21 # so we use a stamp file to indicate success and
22 # have rm fail if the stamp didn't get created
23 stamp = $@$(log_suffix).ok
24 quiet_pre = @echo $(ruby) $@ $(TEST_OPTS); ! test -f $(stamp) && (
25 quiet_post = && > $(stamp) )>&2 | tee $(t); rm $(stamp) 2>/dev/null
26 endif
27 ruby = ruby
28 run_test = $(quiet_pre) setsid $(ruby) -w $@ $(TEST_OPTS) $(quiet_post) || \
29 (sed "s,^,$(extra): ," >&2 < $(t); exit 1)
31 $(T): t = $(subst .rb,.log,$@)
32 $(T): export RUBYLIB := $(CURDIR)/lib:$(RUBYLIB)
33 $(T):
34 $(run_test)
36 RUBY_VERSION_FILE = lib/mogilefs/version.rb
37 # using make instead of rake since Rakefile takes too long to load
38 manifest: Manifest.txt
39 Manifest.txt:
40 git ls-files > $@+
41 echo $(RUBY_VERSION_FILE) >> $@+
42 cmp $@+ $@ || mv $@+ $@
43 $(RM) -f $@+
45 package: manifest
46 git diff --exit-code HEAD^0
47 $(RM) -r pkg/
48 rake fix_perms
49 rake package
51 libs := $(wildcard lib/*.rb lib/*/*.rb)
52 flay_flags =
53 flog_flags =
54 flay: $(libs)
55 flay $(flay_flags) $^
56 flog: $(libs)
57 flog $(flog_flags) $^
58 .PHONY: $(T) Manifest.txt
60 check-warnings:
61 @(for i in $$(git ls-files '*.rb'| grep -v '^setup\.rb$$'); \
62 do ruby -d -W2 -c $$i; done) | grep -v '^Syntax OK$$' || :
63 RSYNC = rsync
64 WRONGDOC = wrongdoc
66 doc:: .document .wrongdoc.yml $(pkg_extra)
67 -find lib -type f -name '*.rbc' -exec rm -f '{}' ';'
68 $(RM) -r doc
69 $(WRONGDOC) all
70 install -m644 $(shell LC_ALL=C grep '^[A-Z]' .document) doc/
71 cd doc && \
72 ln -s README README.txt && \
73 ln -s README.html README_txt.html && \
74 ln -s LICENSE LICENSE.txt && \
75 ln -s LICENSE.html LICENSE_txt.html && \
76 ln -s History History.txt && \
77 ln -s History.html History_txt.html
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 for i in $(docs); do \
84 gzip --rsyncable -9 < $$i > $$i.gz; touch -r $$i $$i.gz; done
86 # this requires GNU coreutils variants
87 ifneq ($(RSYNC_DEST),)
88 publish_doc:
89 -git set-file-times
90 $(MAKE) doc
91 find doc/images -type f | \
92 TZ=UTC xargs touch -d '1970-01-01 00:00:06' doc/rdoc.css
93 $(MAKE) doc_gz
94 $(RSYNC) -av doc/ $(RSYNC_DEST)/
95 git ls-files | xargs touch
96 endif
98 .PHONY: doc .FORCE-GIT-VERSION-FILE