Last active
August 29, 2015 14:01
-
-
Save carlescliment/36d5a791dfd1653b1a7c to your computer and use it in GitHub Desktop.
Configuration of watchr for Symfony projects
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
# Prereqs: | |
# * Ruby | |
# * gem install watchr | |
# Usage: | |
# copy autounit to php project directory | |
# run watchr autounit | |
watch('src/(.*)\.php') do |md| | |
puts "\e[H\e[2J" #clear console | |
testpath = md[1].sub(/./) { |s| s.upcase } | |
if ! /.*Test.php/.match(testpath) | |
parts = md[1].split('/') | |
testfile = 'src/' + parts.slice(0,2).join('/') + '/Tests/'+ parts.slice(2, parts.length() - 2).join('/') + 'Test.php' | |
system("php bin/phpunit -c app #{testfile}") | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment