diff --git a/classes/prompt.php b/classes/prompt.php index 0e5f150..096c7a7 100644 --- a/classes/prompt.php +++ b/classes/prompt.php @@ -2,11 +2,8 @@ namespace mageekguy\atoum\autoloop; -use Illuminate\Filesystem\Filesystem; -use JasonLewis\ResourceWatcher\Event; -use JasonLewis\ResourceWatcher\Resource\FileResource; -use JasonLewis\ResourceWatcher\Tracker; -use JasonLewis\ResourceWatcher\Watcher; +use Lurker\Event\FilesystemEvent; +use Lurker\ResourceWatcher; class prompt extends \mageekguy\atoum\script\prompt { @@ -27,32 +24,34 @@ class prompt extends \mageekguy\atoum\script\prompt */ public function ask($message) { - $runAgainText = "Press to reexecute, press any other key and to stop..."; if ($message != $runAgainText) { return parent::ask($message); } - $watcher = new Watcher(new Tracker, new Filesystem); /** @var \mageekguy\atoum\writers\std\out $outputWriter */ $outputWriter = $this->getOutputWriter(); - $onEvent = function(Event $event, FileResource $fileResource, $path) use ($watcher, $outputWriter) { - $outputWriter->write($fileResource->getPath() . " has been modified." . PHP_EOL); + $watcher = new ResourceWatcher; + + $onEvent = function(FilesystemEvent $event) use ($watcher, $outputWriter) { + $outputWriter->write($event->getResource()->getId() . " has been modified." . PHP_EOL); $watcher->stop(); }; foreach ($this->configuration->getWatchedFiles() as $watchedFile) { - $watcher->watch($watchedFile)->onAnything($onEvent); + $watcher->track($watchedFile, $watchedFile); + $watcher->addListener($watchedFile, $onEvent); } foreach ($this->getRunner()->getTestPaths() as $path) { - $watcher->watch($path)->onAnything($onEvent); + $watcher->track($path, $path); + $watcher->addListener($path, $onEvent); } $outputWriter->write('Waiting for a file to change to run the test(s)... (Use CTRL+C to stop)'. PHP_EOL); - $watcher->start(10000); + $watcher->start(); return ''; } diff --git a/composer.json b/composer.json index f9d14fe..4c39461 100644 --- a/composer.json +++ b/composer.json @@ -18,6 +18,6 @@ }, "require": { "atoum/atoum": ">=2.5.0,<3.0", - "jasonlewis/resource-watcher": ">=1.1.1,<2.0" + "henrikbjorn/lurker": ">=1.1,<2.0" } }