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
|
require 'rake/clean'
require 'rake/testtask'
require 'bundler/gem_tasks'
RUBY = ENV['RUBY'] ||= 'ruby'
DOCS = FileList['ChangeLog', 'readme.en.html', 'readme.ja.html',
'index.en.html', 'index.ja.html']
DOCSRC = FileList['readme.html', 'index.html', 'img', 'sample']
TESTS = FileList['test/*_test.rb']
TESTLOGS = Dir.glob('test/*_test.rb').map{|f|
File.basename(f).ext('log')
}
WWWUSER = ENV['WWWUSER'] ||= 'hisashim,docdiff'
WWWSITE = ENV['WWWSITE'] ||= 'web.sourceforge.net'
WWWSITEPATH = ENV['WWWSITEPATH'] ||= 'htdocs/'
WWWDRYRUN = ENV['WWWDRYRUN'] ||= '--dry-run'
Rake::TestTask.new do |t|
t.test_files = TESTS
t.verbose = true
end
task :default => :test
desc "generate documents"
task :docs => DOCS
file 'ChangeLog' do |t|
sh "devutil/changelog.sh > #{t.name}"
end
rule(/.*\.(?:en|ja)\.html/ => proc{|tn| tn.gsub(/\.(?:en|ja)/, '')}) do |t|
sh "#{RUBY} -E UTF-8 langfilter.rb" +
" --#{t.name.gsub(/.*?\.(en|ja)\.html/){$1}}" +
" #{t.prerequisites.first} > #{t.name}"
end
desc "force to rsync web contents"
task :wwwupload do |t|
sh "rake www WWWDRYRUN="
end
desc "rsync web contents"
task :www => DOCSRC + DOCS do |t|
sh "rsync #{WWWDRYRUN} -auv -e ssh --delete" +
" --exclude='.svn' --exclude='.git'" +
t.prerequisites.join(' ') +
" #{WWWUSER}@#{WWWSITE}:#{WWWSITEPATH}"
end
CLEAN.include(DOCS, TESTLOGS)
|