#!/usr/bin/env ratch # publish website to rubyforge # This task publishes the source dir (deafult doc/) # to a rubyforge website. config = config_load('publish') project = config['project'] subdir = config['subdir'] source = config['source'] || %w{web site doc}.find{|f| dir?(f)} username = config['username'] protect = %w{usage statcvs statsvn robot.txt wiki} exclude = %w{.svn} abort("no project name") unless project abort("no username") unless username abort("no source dir") unless source if subdir destination = File.join(project, subdir) else destination = project end dir = source.chomp('/') + '/' url = "#{username}@rubyforge.org:/var/www/gforge-projects/#{destination}" # maybe -p ? op = ['-rLvz', '--delete'] if File.file?(File.join(source,'.rsync-filter')) op << "--filter='dir-merge #{source}/.rsync-filter'" else op.concat exclude.map{|e| "--filter='- #{e}'"} op.concat protect.map{|e| "--filter='P #{e}'"} end args = op + [dir, url] #cd source do rsync *args #end