public function run(array $arguments) { if ($arguments) { foreach ($arguments as $dep) { $this->deps->install($dep, false); } } else { foreach ($this->deps->getPackages() as $package) { try { $dep = $package->getName(); $this->deps->install($dep, false); } catch (\Exception $error) { Terminal::error($error->getMessage() . "\n"); } } } return true; }
public function printStatus(Package $package) { $dir = $package->getDirectory(); $name = $package->getName(); $result = `cd {$dir}; LANG=en_US.UTF-8 git status`; $errors = array(); $warnings = array(); $messages = array(); if (strstr($result, 'Changes not staged for commit:') !== false) { $errors[] = 'Unstaged changes'; } if (strstr($result, 'Changes to be committed:') !== false) { $errors[] = 'Changes to commit'; } if (strstr($result, 'Your branch is ahead of') !== false) { $errors[] = 'Not pushed changes'; } if (strstr($result, 'Your branch is behind') !== false) { $warnings[] = 'Branch is behind origin'; } if (strstr($result, 'Untracked files:') !== false) { $warnings[] = 'Untracked files'; } $messages = implode(', ', array_merge($errors, $warnings, $messages)); if ($messages) { $messages = '(' . $messages . ')'; } $branch = $package->getBranch(); if (count($errors)) { Terminal::error("* [{$branch}] {$name}: ERROR {$messages}\n"); } else { if (count($warnings)) { Terminal::warning("* [{$branch}] {$name}: WARNING {$messages}\n"); } else { Terminal::success("* [{$branch}] {$name}: OK {$messages}\n"); } } }
public function run(array $args) { if (count($args)) { $parts = explode(':', array_shift($args)); $command = array_shift($parts); if (isset($this->commands[$command])) { $this->commands[$command]->setFlags($parts); try { if ($this->commands[$command]->run($args)) { exit(10); } } catch (\Exception $error) { Terminal::error("Error: " . $error->getMessage() . "\n"); } return; } else { Terminal::error("Error: Unknown command {$command}\n"); } } $this->help(); }
} else { $ll_segok = true; } } else { $ll_segok = true; } */ $ll_segok = true; /** se não for seguro */ if (!$ll_segok) { /** mostra um erro */ throw new Exception('privado'); } } catch (Exception $ex) { if ($_ll['terminal']) { Terminal::error($ex->getMessage()); } $_ll['operation_type'] = 'opt'; $_ll['operation_load'] = 'msg'; $_ll['operation_mode'] = 'start'; $msg_mensage = $ex->getMessage(); } /* Define os dados do APP da requisição */ $_ll[$_ll['operation_type']]['home'] = $_ll['operation_load']; $_ll[$_ll['operation_type']]['onserver'] = 'onserver/' . $_ll[$_ll['operation_type']]['home']; $_ll[$_ll['operation_type']]['onclient'] = 'onclient/' . $_ll[$_ll['operation_type']]['home']; $_ll[$_ll['operation_type']]['pasta'] = $_ll['operation_type'] . '/' . $_ll['operation_load'] . '/'; $_ll[$_ll['operation_type']]['pagina'] = $_ll[$_ll['operation_type']]['pasta'] . ($_ll['enter_mode'] == 'nli' ? 'nli/' : '') . $_ll['operation_mode'] . '.php'; /** carrega a requisicao do usuario */ require_once $_ll[$_ll['operation_type']]['pagina']; //echo '<pre>abre '.$_ll['operation_type'].' - '.$_ll['operation_load'].' - '.$_ll['enter_mode'].'</pre>';