-
Notifications
You must be signed in to change notification settings - Fork 62
/
Rookbook.yaml
204 lines (181 loc) · 5.82 KB
/
Rookbook.yaml
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
###
### $Release$
### $Copyright$
###
properties:
- release : 0.0.0
- copyright : copyright(c) 2006-2010 kuwata-lab all rights reserved.
parameters:
- project : erubis
- text_files : [CHANGES.txt, README.txt, MIT-LICENSE, setup.rb, erubis.gemspec]
- guide : doc/users-guide.html
- doc_files : [$(guide), doc/docstyle.css]
- apidocdir : doc-api
- home* : ENV['HOME']
- inline_require_script : $(home)/src/inline-require/trunk/bin/inline-require
- abstract_rb : $(home)/src/abstract/trunk/lib/abstract.rb
- benchmark_files* : Dir.glob('benchmark/erubybench{-lib.rb,.rb,.rhtml,.yaml}')
- libfiles* : Dir.glob("lib/**/*")
- base : $(project)-$(release)
- base2 : $(project)-$(release)
#
- exclude_libs : # [cache.rb]
recipes:
- product: :all
ingreds: [ $(text_files), $(doc_files) ]
- product: :packages
desc: create packages
ingreds: [ :clean, build/$(base).tar.gz, build/$(base).tar.bz2, build/$(base).zip, build/$(base2).gem ]
- product: :doc
method*: |
chdir 'doc' do sys "#{rook_command()} :doc" end
- product: :test
method*: |
#sys "ruby test/test-erubis.rb"
#sys "ruby test/test-engines.rb"
#sys "ruby test/test-main.rb"
#sys "ruby test/test-notext.rb"
sys "ruby test/test.rb 2>&1 | tee test.log"
- product: :clean
method*: |
rm_rf '$(project)-*.*', '$(project)-*.gem', '{lib,test}/**/*.rbc', apidocdir
- product: :apidoc
desc: create api document by RDoc
ingreds: [ $(apidocdir)/index.html ]
- product: $(apidocdir)/index.html
ingreds: [ $(libfiles), README.txt ]
method*: |
rm_rf '$(apidocdir)'
opts = "-o ../$(apidocdir) -S -m README.txt"
if exclude_libs
opts << exclude_libs.collect { |f| " -x erubis/#{f}" }.join(" ")
end
cp 'README.txt', 'lib'
chdir 'lib' do
sys "rdoc #{opts} *"
end
rm_f 'lib/README.txt'
- product: :chmod
desc: chmod files
method*: |
chmod 0644, '**/*', :filetype=>'file'
chmod 0755, 'bin/*'
- product: build/$(project)-*.tar.bz2
desc: create *.tar.bz2
ingreds: [ build/$(project)-$(1) ]
method*: |
rm_f @product if test(?f, @product)
#tar_cjf @product, @ingred
sys "tar cjf #{@product} #{@ingred}"
- product: build/$(project)-*.tar.gz
desc: create *.tar.gz
ingreds: [ build/$(project)-$(1) ]
method*: |
rm_f @product if test(?f, @product)
#tar_czf @product, @ingred
sys "tar czf #{@product} #{@ingred}"
- product: build/$(project)-*.zip
desc: create *.zip
ingreds: [ build/$(project)-$(1) ]
method*: |
rm_f @product if test(?f, @product)
#zip_r @product, @ingred
sys "zip -qr9 #{@product} #{@ingred}"
- product: build/$(project)-*.gem
desc: create *.gem
ingreds: [ build/$(project)-$(1) ]
method*: |
dir = @ingred
cd dir do
#Gem.manage_gems
require 'rubygems/gem_runner'
Gem::GemRunner.new.run ['build', '$(project).gemspec']
end
mv "#{dir}/#{File.basename(@product)}", "build"
- product: $(guide)
method*: |
chdir "doc" do sys "rook :all" end
- product: build/$(project)-*
ingreds: [ $(text_files), $(doc_files), :apidoc ]
method*: |
comment 'delete and create directory'
release = '$(1)' # @matches[1]
dir = "build/$(project)-#{release}"
rm_rf dir if test(?d, dir)
mkdir_p dir
#
rm_f 'test/data/**/*.cache', 'lib/**/*.rbc'
#store 'lib/**/*', 'bin/*', 'test/**/*', text_files, dir
store 'lib/**/*', 'bin/*', 'test/**/*', text_files, dir do |f|
base = File.basename(f)
! (exclude_libs && exclude_libs.include?(base))
end
rm_f "#{dir}/test/Rookbook.yaml", "#{dir}/test/test.log"
#
store 'public_html/{index.cgi,index.rhtml,_htaccess,README.txt}', dir
#
store 'benchmark/{bench.rb,bench_context.yaml}',
'benchmark/templates/*', 'benchmark/Makefile', dir
#
Dir.glob('examples/*').each { |d| chdir d do sys 'make clean' end }
store 'examples/**/*', dir
f = "#{dir}/examples/pi-xhtml"
rm_rf f if test(?e, f)
#
store '$(apidocdir)/**/*', dir
#
chdir 'doc' do sys 'rook :all' end
mkdir_p "#{dir}/doc"
cp_r doc_files, "#{dir}/doc"
#
store 'contrib/*', dir
#mkdir_p "#{dir}/contrib"
cp_r '$(inline_require_script)', "#{dir}/contrib"
#
edit "#{dir}/**/*" do |content|
content.gsub!(/\$Release\$/, "$(1)")
content.gsub!(/\$Release:.*?\$/, "$Release: $(1) $")
content.gsub!(/\$Copyright.*?\$/, '$(copyright)')
content
end
#
begin
cp abstract_rb, "#{dir}/lib"
chdir dir do
rubybin = '/opt/local/bin/ruby'
rubybin = 'ruby' unless test(?f, rubybin)
sys "RUBYLIB= #{rubybin} $(inline_require_script) -I lib bin/erubis > contrib/erubis"
end
ensure
rm "#{dir}/lib/abstract.rb"
end
#
chmod 0644, "#{dir}/**/*", :filetype=>'file'
chmod 0755, "#{dir}/bin/*", :filetype=>'file'
chmod 0755, "#{dir}/contrib/{erubis,inline-require}", :filetype=>'file'
chmod 0755, "#{dir}/public_html/index.cgi"
- product: :duplicate
method*: |
files = []
files += Dir.glob('lib/**/*.rb')
files += Dir.glob('bin/*')
files += Dir.glob('benchmark/erubybench.{rb,rhtml,yaml}')
files += Dir.glob('benchmark/pibench.*')
archive = "#{@product}.tar.gz"
tar_czf archive, files
dir = '/Volumes/WORKGROUP;DENEB/src/erubis/trunk'
cp archive, dir
chdir dir do
tar_xzf archive
end
- product: :svn2git
method*: |
edit 'lib/**/*', 'bin/**/*', 'doc/**/*', 'test/**/*', text_files do |cont|
cont.gsub!(/^\#+ *\$Rev: \d+ \$\n/, '')
cont.gsub!(/^\#+ *\$Date: \d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d .*?\$/, '$Date$')
cont.gsub!(/\$Date: \d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d .*?\$/, '$Date$')
cont.gsub!(/last update: \$Date: \d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d .*\$<br>/, 'release: $Release$')
cont.gsub!(/\.\?lastupdate:(\s+)\$Date: \d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d .*\$<br>/, '.?lastupdate:\1$Date$')
cont.gsub!(/^(\#+ \$Rev:) \d+ \$/, '\1 $')
cont
end