namespace :dyserver do LOCAL_BASE = '' DIST_BASE = "#{LOCAL_BASE}../../dyserver/" def locally_configured? path # FIXME: is path in cfg.spc? false end def fix_file filename case PLATFORM when /vms/i case filename when /(.gif|.png|.jpg|.jpeg)$/ # FIXME: attrib/type=lfstream filename if /vms/i.match PLATFORM else # FIXME: convert/type=dyulib:stream filename if /vms/i.match PLATFORM end end end rule "public/images/submitgr.gif" "../web/submitgr.gif" do |task| cp task.source,task.name end local = FileList.new dist = FileList["#{DIST_BASE}**/*"].reject do |dist_path| local_path=dist_path.sub /#{DIST_BASE}/, LOCAL_BASE reject_path=File.directory?(local_path) || locally_configured?(local_path) local << local_path unless reject_path reject_path end local.each_index do |index| local_dir=File.dirname(local[index]) mkdir local_dir unless File.directory?(local_dir) rule local[index] => [dist[index]] do copy dist[index], local[index] fix_file local[index] if local[index].match "^#{LOCAL_BASE}public" end end desc "Update all distributed dyserver files from master copy" task :update => local end