###
### $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 .*\$
/, 'release: $Release$')
cont.gsub!(/\.\?lastupdate:(\s+)\$Date: \d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d .*\$
/, '.?lastupdate:\1$Date$')
cont.gsub!(/^(\#+ \$Rev:) \d+ \$/, '\1 $')
cont
end