Example #1
0
 public function actionCache($args)
 {
     $opt = \Gini\Util::getOpt($args, 'he:', ['help', 'env:']);
     if (isset($opt['h']) || isset($opt['help'])) {
         echo "Usage: gini cache [-h|--help] [-e|--env=ENV] [clean]\n";
         return;
     }
     $env = $opt['e'] ?: $opt['env'] ?: null;
     if (count($args) == 0) {
         $errors = \Gini\App\Doctor::diagnose(['dependencies', 'composer']);
         if ($errors) {
             return;
         }
         \Gini\App\Cache::setup($env);
     } elseif (in_array('clean', $args)) {
         \Gini\App\Cache::clean();
     }
 }
Example #2
0
 public function actionPreview($args)
 {
     $errors = \Gini\App\Doctor::diagnose(['dependencies', 'web']);
     if ($errors) {
         return;
     }
     $addr = $args[0] ?: 'localhost:3000';
     $command = sprintf('php -S %s -c %s -t %s 2>&1', $addr, APP_PATH . '/raw/cli-server.ini', APP_PATH . '/web');
     $descriptors = [['file', '/dev/tty', 'r'], ['file', '/dev/tty', 'w'], ['file', '/dev/tty', 'w']];
     $proc = proc_open($command, $descriptors, $pipes);
     if (is_resource($proc)) {
         proc_close($proc);
     }
 }
Example #3
0
File: Web.php Project: iamfat/gini
 public function actionPreview($args)
 {
     $errors = \Gini\App\Doctor::diagnose(['dependencies', 'web']);
     if ($errors) {
         return;
     }
     $addr = $args[0] ?: 'localhost:3000';
     $command = sprintf('php -S %s -c %s -t %s', $addr, APP_PATH . '/raw/cli-server.ini', APP_PATH . '/web');
     $proc = proc_open($command, [STDIN, STDOUT, STDERR], $pipes);
     if (is_resource($proc)) {
         proc_close($proc);
     }
 }