Created
July 4, 2014 08:08
-
-
Save rossmari/413a4ba1a3ffc2f15d80 to your computer and use it in GitHub Desktop.
task to start rspec before deploy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
desc 'Start rspec before deploy' | |
task :rspec, :roles => :app do | |
puts 'Starting rspec examples ... prepare to be punished!' | |
output = %x[bundle exec rspec] | |
respond = output.split(/\n/) | |
if respond.any? { |e| e.match(/Failures:/)} | |
set(:confirmed) do | |
puts "\n\t#{'='*75}\n\n\tThere are errors:\n\n\t>>> #{respond.detect { |e| e.match(/.*failure.*/) }.upcase}\n\n\t#{'='*75}\n" | |
Capistrano::CLI.ui.ask("\n\tAre you sure you want to continue? (Y) ") == 'Y' ? true : false | |
end | |
unless fetch(:confirmed) | |
puts "\nDeploy canceled!" | |
exit | |
end | |
else | |
puts 'All tests are done! Lets rock baby!' | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment