RELEASE_VERSION = open('VERSION').read.chomp ARCHIVE_NAME = "lztestkit-#{RELEASE_VERSION}.tgz" IGNORE = Dir['**/#*#'] + Dir['**/.#*'] + Dir['build/**'] + Dir['working/**'] + %w{build working agenda.txt} task :archive => ARCHIVE_NAME task :docs => 'build/index.html' file ARCHIVE_NAME => Dir['**/*'] - Dir['*.tgz'] - IGNORE do |t| puts t.prerequisites.sort.join("\n") if ENV['verbose'] sh "tar cfz #{t.name} #{t.prerequisites - ['Rakefile']}" end task :publish => [ARCHIVE_NAME, :docs] do target = "osteele.com:osteele.com/sources/openlaszlo/lztestkit" sh "rsync README #{ARCHIVE_NAME} #{target}" sh "rsync build/index.html #{target}/index.html" end task :clean do files = Dir['*.tgz'] rm files if files.any? end task 'build/index.html' => 'README' do |t| mkdir_p 'build' sh "rdoc --one-file -n build/index.html README" url = "http://osteele.com/sources/openlaszlo/#{ARCHIVE_NAME}" content = File.read(t.name). sub(/.*?<\/title>/, '<title>LzTestKit'). sub(/

File:.*?<\/h2>/, ''). sub(/

Classes<\/h2>/, ''). sub(//m, ''). sub('{download-location}', "#{url}") File.open(t.name, 'w').write(content) end AUTORUN_FILES = %w{autorun-browser.js autorun-lz.js autorun.css list-files.jsp} SHARED_FILES = AUTORUN_FILES + %w(fluently.js jsspec.js lzmock.js lzspec.js lzunit-async.lzx lzunit-extensions.js lztimer.lzx lztimer-browser.js) # TODO: sync sequencing.js, fluently.js with jsutils def dirsync(source_dir, target_dir) options = {} options[:noop] = true if ENV['dryrun'] SHARED_FILES.each do |fname| source = File.expand_path(File.join(source_dir, fname)) target = File.expand_path(File.join(target_dir, fname)) copy = false case when !File.exists?(target) copy = true when (File.size(source) == File.size(target) and File.read(source) == File.read(target)) copy = false when File.mtime(source) < File.mtime(target) puts "Skipping #{fname}: source is older than target" sh "ls -l {#{source_dir},#{target_dir}}/#{fname}" if ENV['verbose'] else copy = true end cp source, target, options if copy end end task :pull do dirsync('~/perforce/dc/client/applib/calendar/test/includes', 'src') end task :push do dirsync('src', '~/perforce/dc/client/applib/calendar/test/includes') end