I have this commands sequence into a Rake file
task :compile => :environment do
system "bundle exec rake assets:clean"
system "bundle exec rake assets:precompile RAILS_ENV=production"
system "chmod 777 -R /var/www/app/tmp/cache/"
system "/etc/init.d/apache2 restart"
end
let’s suppose that one of the command generate an exception, is there a way to perform a rollback over the past commands?
The three firsts can be done in Ruby. Use
Rake::Task['assets:clean'].invokefor example.For the last one, you could raise an exception depending of the exit status (system returns it).