#!/usr/bin/php <?php $argParser = new ArgParser(); $command = $argParser->getCommand(); if ($command == ArgParser::CMD_START) { Container::checkDocker(); foreach (Framework::getFrameworks() as $framework) { $container = new Container($framework); $container->run(); } } else { if ($command == ArgParser::CMD_STOP) { Container::checkDocker(); foreach (Framework::getFrameworks() as $framework) { $container = new Container($framework); $container->stop(); } } else { if ($command == ArgParser::CMD_BENCHMARK) { out("Doing " . Benchmark::NUMBER_OF_CALLS . " calls per framework. Displaying averages."); foreach (Framework::getFrameworks() as $framework) { $benchmark = new Benchmark($framework); $benchmark->run()->outputTimes(); } } else { out("== Available commands: =="); out(ArgParser::CMD_BENCHMARK); out(ArgParser::CMD_START); out(ArgParser::CMD_STOP); } }
$this->formatter($ok, 'Version Control', implode(', ', $availableVcs), 'This only checks for subversion, git, and mercurial as they are the most common. I recommend git. You may safely ignore this check if you\'re using somethign else, but you *should* be using something.'); } public function checkKernel() { $availableVcs = []; $kernel = strtolower(php_uname('s')); $ok = $kernel == 'darwin' || $kernel == 'linux'; $this->formatter($ok, 'Kernel', $kernel, 'If you are not running on linux or osx, you\'re in uncharted territory. If on windows, you should probably look into cygwin or setting up some kind of unix-like environment on your machine.'); } public function checkCaseSensitive() { $ok = !(file_exists(strtoupper(__FILE__)) && file_exists(strtolower(__FILE__))); $caseSensitive = true; $this->formatter($ok, 'FS Case Sensitive', $ok ? 'Sensitive' : 'Insensitive', 'Your current filesystem appears to be case-insensitive, which may lead to problems if you deploy your code to a case-sensitive production server.'); } } Container::addTask(new SystemReport()); # load additional tasks from the project directories, if we're in a valid project Container::findTasks(); # Determine what the task we're trying to run is # the first element of the array is simply this filename, so get rid of it right away array_shift($argv); # Determine if a task is being passed. If not, default to 'usage' if (count($argv) > 0) { $task = array_shift($argv); } else { $task = 'usage'; } # run the task and exit. Container::run($task, $argv); exit;