Skip to content

Instantly share code, notes, and snippets.

@andersonfraga
Created July 30, 2014 15:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andersonfraga/896a92e1bfa0506f1d13 to your computer and use it in GitHub Desktop.
Save andersonfraga/896a92e1bfa0506f1d13 to your computer and use it in GitHub Desktop.
Code watchers default
#!/usr/bin/php
<?php
require '../phpwatcher.php';
phpwatcher(['./tests/unit/', './module/'], '(.*)\.php', function ($file) {
echo ($exec = "php-cs-fixer fix {$file} --level=all") . PHP_EOL;
system($exec);
echo PHP_EOL;
});
#!/usr/bin/php
<?php
require '../phpwatcher.php';
phpwatcher(['./module/','./tests/unit/'], '(.*)\.php', function ($file) {
echo "\nChanged {$file}\n";
echo ($exec = 'cd ./tests/unit/ && phpunit .') . PHP_EOL;
system($exec);
echo PHP_EOL;
});
#!/usr/bin/php
<?php
require '../phpwatcher.php';
phpwatcher('./tests/unit/', '(.*)Test\.php', function ($file, $objfile) {
$exec = 'cd ' . $objfile->getPathIdentifier() . ' && phpunit ' . str_replace([$objfile->getPathIdentifier(), '.php'], '', $file);
echo $exec . PHP_EOL;
system($exec);
echo PHP_EOL;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment