SX cap production setup files
This commit is contained in:
18
lib/capistrano/tasks/run_tests.cap
Normal file
18
lib/capistrano/tasks/run_tests.cap
Normal file
@@ -0,0 +1,18 @@
|
||||
namespace :deploy do
|
||||
desc "Runs test before deploying, can't deploy unless they pass"
|
||||
task :run_tests do
|
||||
test_log = "log/capistrano.test.log"
|
||||
tests = fetch(:tests)
|
||||
tests.each do |test|
|
||||
puts "--> Running tests: '#{test}', please wait ..."
|
||||
unless system "bundle exec rspec #{test} > #{test_log} 2>&1"
|
||||
puts "--> Tests: '#{test}' failed. Results in: #{test_log} and below:"
|
||||
system "cat #{test_log}"
|
||||
exit;
|
||||
end
|
||||
puts "--> '#{test}' passed"
|
||||
end
|
||||
puts "--> All tests passed"
|
||||
system "rm #{test_log}"
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user