Find.find(File.dirname(__FILE__)) { |path| `rm -rf #{path}` if path =~ /\.svn$/}I've needed this enough times that I thought it might save someone else some time.
When did I use this? Every time I start a new project I check it into a local subversion repository. After working on the code for a bit, if I decide that it's a project worth distributing I register it somewhere else (such as RubyForge). If my project is accepted, I'll transfer the code to the projects repository. The easiest way, I've found, to move the code is to remove the local .svn directories and check out version 0 of the new repository into the project's root. At this point, I can svn add everything and check in.
I'm sure there's a better way, but this is simple and it works.
From the command line this also works:
ReplyDeletefind ./ -name .svn -exec rm -fr {} \;
find . -name ".svn" -exec rm '{}' \;
ReplyDeleteAh, ships crossing in the night. He's right, though. I forgot -rf.
ReplyDelete@jonathan and evan
ReplyDeleteThanks, my command line-fu is weak. =)
require 'fileutils'
ReplyDeleteFileUtils.rm_rf(Dir["**/*.svn"])
Regards,
Dan
I use this in my Apache config:
ReplyDeleteRewriteRule \.svn .nosvnallowed
Then I just have a current checkout in my DocumentRoot dir and when I want to update my website I just do an svn up in place. Since the .svn components are rewrtten there's no way anybody can access those files from outside. This is faster than the other options especially for bigger sites because you don't have to recopy the entire website, but instead just update the pages that have changed.
Best regards,
Rudi Cilibrasi
svn export {url of project tree} {local directory}
ReplyDeletefind . -type d -name ".svn" -exec rm -rf {} \;
ReplyDelete