- Add unadded files to Subversion (svn add)
- Delete missing files from Subversion (svn rm)
- Update my local files from Subversion (svn up)
- Run the tests (rake)
- Display the status of the files (svn st)
namespace :svn doIf you add the above code to a .rake file in lib/tasks you can simply run
task :st do
puts %x[svn st]
end
task :up do
puts %x[svn up]
end
task :add do
%x[svn st].split(/\n/).each do |line|
trimmed_line = line.delete('?').lstrip
if line[0,1] =~ /\?/
%x[svn add #{trimmed_line}]
puts %[added #{trimmed_line}]
end
end
end
task :delete do
%x[svn st].split(/\n/).each do |line|
trimmed_line = line.delete('!').lstrip
if line[0,1] =~ /\!/
%x[svn rm #{trimmed_line}]
puts %[removed #{trimmed_line}]
end
end
end
end
desc "Run before checking in"
task :pc => ['svn:add', 'svn:delete', 'svn:up', :default, 'svn:st']
rake pc
when you are ready to commit. If everything executes successfully, you are ready to commit.Obviously, this only works for Subversion, but you are using Subversion anyway, right?
Jay,
ReplyDeleteI'm working on a svn rake library - It's getting there slowly but surely, with the holy grail to be able to bootstrap a new Rails app into the repository with all the proper svn:ignores etc.
Here's a link: Subversion Rake Tools