% require 'fileutils' source_dir = File.expand_path File.dirname(__FILE__) dest_dir = Dir.getwd begin Dir.chdir source_dir all_files = [] # Everything in base except self Dir.glob('*').each do |file| next if File.directory? file next if File.expand_path(file) == __FILE__ all_files << file end # Plus these folders of examples %w{hello rails jquery modules}.each do |path| all_files += Dir.glob("#{path}/**/*") end # Minus compiler output all_files -= %w{hello/legume.js} all_files.reject!{|f|f=~/compiler_/} ensure Dir.chdir dest_dir end conflict = false all_files.each do |file| conflict = true if File.exist? File.join dest_dir, file break if conflict end if post? and !conflict all_files.each do |file| next if File.directory? File.join source_dir, file FileUtils.mkdir_p File.dirname File.join dest_dir, file File.open(File.join(dest_dir, file), 'w') do |f| f.write File.read File.join source_dir, file end end render 'svn', :svn_name => 'Closure Library', :svn_path => 'closure-library', :svn_url => 'http://closure-library.googlecode.com/svn/trunk', :svn_update => 'HEAD' response.redirect path end if get? -%>