Created
January 10, 2018 11:29
-
-
Save ChunAllen/8b8e8a3e539e9b8d00f248e675fad089 to your computer and use it in GitHub Desktop.
Running rake test on local before deploying using capistrano
This file contains hidden or 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
namespace :deploy do | |
desc "Runs test before deploying, can't deploy unless they pass" | |
task :run_tests do | |
puts "--> Running tests, please wait ..." | |
test_log = "log/capistrano.log" | |
unless system "bundle exec rake > #{test_log} 2>&1" #' > /dev/null' | |
puts "--> Tests failed. Run `cat #{test_log}` to see what went wrong." | |
exit | |
else | |
puts "--> Tests passed" | |
system "rm #{test_log}" | |
end | |
end | |
end | |
before :deploy, "deploy:run_tests" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment