desc "Tests the files, then commits"
task :commit do |t|
# check to see if there's unadded files.
# If there are, I'm not saving anything
# darn it.
if (unadded_files = system "svn status | grep \?")
puts "There were unadded files!"
else
system "script/reload_everything.sh && svn commit"
end
end
Put that in tasks/svn_commit.task.
Then create a script and put it in script/reload_everything.sh that drops and recreates both the test and development databases, then populate them with fixture data, then runs all the unit tests (and returns -1 if anything failed).
The end result of this is that you can run “rake commit” every time you want to check something into svn. It won’t let you do anything if there’s any files in the repository that subversion doesn’t know about. Then it’ll run all the tests from scratch. And then if everything’s ok, then it’ll let you add the files.
Sorry, comments are closed for this article.