protected function execute(InputInterface $input, OutputInterface $output) { $output->writeln('<info>Watching templates and pages for changes</info>'); $files = new Filesystem(); $tracker = new Tracker(); $watcher = new Watcher($tracker, $files); $generator = $this->getPageGenerator(); $command = $this; $pageListener = $watcher->watch($generator->getPagesDir()); $pageListener->anything(function ($event, $resource, $path) use($command, $output, $generator) { $command->onChange($resource, $path, $output, $generator); }); $templateListener = $watcher->watch($generator->getTemplatesDir()); $templateListener->anything(function ($event, $resource, $path) use($command, $output, $generator) { $command->onChange($resource, $path, $output, $generator); }); $watcher->start(); }
protected function startWatching() { $this->watcher->startWatch(); }