Skip to content

Instantly share code, notes, and snippets.

@stefpe
Created January 21, 2019 15:26
Show Gist options
  • Save stefpe/070336074da2fcdf19c0cd3bf4953bc3 to your computer and use it in GitHub Desktop.
Save stefpe/070336074da2fcdf19c0cd3bf4953bc3 to your computer and use it in GitHub Desktop.
File watcher with robo
<?php
require_once './vendor/autoload.php';
/**
* This is project's console commands configuration for Robo task runner.
*
* @see http://robo.li/
*/
class RoboFile extends \Robo\Tasks
{
/**
* Watch specific project files.
* @return \Robo\Result
*/
public function watchProject()
{
return $this->taskWatch()
->monitor(
'src',
function (\Lurker\Event\FilesystemEvent $fse) {
$this->io()->note((string)$fse->getResource());
$this->taskPhpUnit()->run();
},
\Lurker\Event\FilesystemEvent::DELETE
)->run();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment