-
Notifications
You must be signed in to change notification settings - Fork 11
/
Makefile
127 lines (104 loc) · 3.72 KB
/
Makefile
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
LUA := lua
VERSION := $(shell cd src && $(LUA) -e "m = require [[Spore]]; print(m._VERSION)")
TARBALL := lua-spore-$(VERSION).tar.gz
ifndef REV
REV := 1
endif
ifndef DESTDIR
DESTDIR := /usr/local
endif
LIBDIR := $(DESTDIR)/share/lua/5.1
install:
mkdir -p $(LIBDIR)/Spore/Middleware/Auth
mkdir -p $(LIBDIR)/Spore/Middleware/Format
mkdir -p $(LIBDIR)/Spore/Middleware/Parameter
mkdir -p $(LIBDIR)/Spore/Middleware/Proxy
cp src/Spore.lua $(LIBDIR)
cp src/Spore/Core.lua $(LIBDIR)/Spore
cp src/Spore/Protocols.lua $(LIBDIR)/Spore
cp src/Spore/Request.lua $(LIBDIR)/Spore
cp src/Spore/Middleware/Cache.lua $(LIBDIR)/Spore/Middleware
cp src/Spore/Middleware/Logging.lua $(LIBDIR)/Spore/Middleware
cp src/Spore/Middleware/Mock.lua $(LIBDIR)/Spore/Middleware
cp src/Spore/Middleware/Redirection.lua $(LIBDIR)/Spore/Middleware
cp src/Spore/Middleware/Runtime.lua $(LIBDIR)/Spore/Middleware
cp src/Spore/Middleware/UserAgent.lua $(LIBDIR)/Spore/Middleware
cp src/Spore/Middleware/Auth/Basic.lua $(LIBDIR)/Spore/Middleware/Auth
cp src/Spore/Middleware/Auth/OAuth.lua $(LIBDIR)/Spore/Middleware/Auth
cp src/Spore/Middleware/Format/JSON.lua $(LIBDIR)/Spore/Middleware/Format
cp src/Spore/Middleware/Format/XML.lua $(LIBDIR)/Spore/Middleware/Format
cp src/Spore/Middleware/Format/YAML.lua $(LIBDIR)/Spore/Middleware/Format
cp src/Spore/Middleware/Parameter/Default.lua $(LIBDIR)/Spore/Middleware/Parameter
cp src/Spore/Middleware/Parameter/Force.lua $(LIBDIR)/Spore/Middleware/Parameter
cp src/Spore/Middleware/Proxy/Basic.lua $(LIBDIR)/Spore/Middleware/Proxy
uninstall:
rm -f $(LIBDIR)/Spore.lua
rm -rf $(LIBDIR)/Spore
manifest_pl := \
use strict; \
use warnings; \
my @files = qw{MANIFEST}; \
while (<>) { \
chomp; \
next if m{^\.}; \
next if m{^doc/\.}; \
next if m{^doc/google}; \
next if m{^rockspec/}; \
push @files, $$_; \
} \
print join qq{\n}, sort @files;
rockspec_pl := \
use strict; \
use warnings; \
use Digest::MD5; \
open my $$FH, q{<}, q{$(TARBALL)} \
or die qq{Cannot open $(TARBALL) ($$!)}; \
binmode $$FH; \
my %config = ( \
version => q{$(VERSION)}, \
rev => q{$(REV)}, \
md5 => Digest::MD5->new->addfile($$FH)->hexdigest(), \
); \
close $$FH; \
while (<>) { \
s{@(\w+)@}{$$config{$$1}}g; \
print; \
}
version:
@echo $(VERSION)
CHANGES:
perl -i.bak -pe "s{^$(VERSION).*}{q{$(VERSION) }.localtime()}e" CHANGES
tag:
git tag -a -m 'tag release $(VERSION)' $(VERSION)
doc:
git read-tree --prefix=doc/ -u remotes/origin/gh-pages
MANIFEST: doc
git ls-files | perl -e '$(manifest_pl)' > MANIFEST
$(TARBALL): MANIFEST
[ -d lua-Spore-$(VERSION) ] || ln -s . lua-Spore-$(VERSION)
perl -ne 'print qq{lua-Spore-$(VERSION)/$$_};' MANIFEST | \
tar -zc -T - -f $(TARBALL)
rm lua-Spore-$(VERSION)
rm -rf doc
git rm doc/*
dist: $(TARBALL)
rockspec: $(TARBALL)
perl -e '$(rockspec_pl)' rockspec.in > rockspec/lua-spore-$(VERSION)-$(REV).rockspec
install-rock: clean dist rockspec
perl -pe 's{http://cloud.github.com/downloads/fperrad/lua-Spore/}{};' \
rockspec/lua-spore-$(VERSION)-$(REV).rockspec > lua-spore-$(VERSION)-$(REV).rockspec
luarocks install lua-spore-$(VERSION)-$(REV).rockspec
check: test
export LUA_PATH=;;src/?.lua
test:
prove --exec=$(LUA) ./test/*.t
coverage:
rm -f ./luacov.stats.out ./luacov.report.out
-prove --exec="$(LUA) -lluacov" ./test/*.t ./eg/*.lua
luacov
README.html: README.md
Markdown.pl README.md > README.html
clean:
rm -rf doc
rm -f MANIFEST *.bak src/luacov.*.out *.rockspec README.html
.PHONY: test rockspec CHANGES