public function run() { if (version_compare(phpversion(), '5.4.0', '<')) { Console::writeWarning("you must have PHP 5.4.0 or greater to use this feature. you are using PHP " . phpversion() . "..."); } else { // set-up defaults $publicDir = Config::getOption("publicDir"); $coreDir = Config::getOption("coreDir"); $host = Console::findCommandOptionValue("host"); $host = $host ? $host : "localhost"; $port = Console::findCommandOptionValue("port"); $host = $port ? $host . ":" . $port : $host . ":8080"; $quiet = Console::findCommandOption("quiet"); // set-up the base command $command = $this->pathPHP . " -S " . $host . " " . $coreDir . "/server/router.php"; $commands = array(); $commands[] = array("command" => $command, "cwd" => $publicDir, "timeout" => null, "idle" => 1800); // get the watch command info if (Console::findCommandOption("with-watch")) { $watchCommand = new WatchCommand(); $commands[] = array("command" => $watchCommand->build() . " --no-procs", "timeout" => null, "idle" => 1800); } Console::writeInfo("server started on http://" . $host . " - use ctrl+c to exit..."); $processSpawner = new ProcessSpawner(); $processSpawner->spawn($commands, $quiet); } }
public function run() { // set-up required vars $options = array(); $options["moveStatic"] = Console::findCommandOption("p|patternsonly") ? false : true; $options["noCacheBuster"] = Console::findCommandOption("n|nocache"); // see if the starterKit flag was passed so you know what dir to watch if (Console::findCommandOption("sk")) { // load the starterkit watcher $w = new Watcher(); $w->watchStarterKit(); } else { if (Console::findCommandOption("no-procs")) { // don't have to worry about loading processes so launch watcher // load the generator $g = new Generator(); $g->generate($options); // load the watcher $w = new Watcher(); $w->watch($options); } else { // a vanilla --watch command needs to have a --no-procs version built // so we don't get caught in while() loops. re-request the console command $commands = array(); $commands[] = array("command" => $this->build() . " --no-procs", "timeout" => null, "idle" => 600); Console::writeInfo("spawning the watch process..."); $process = new ProcessSpawner(); $process->spawn($commands); } } }