diff --git a/PHPCI/Command/GenerateCommand.php b/PHPCI/Command/GenerateCommand.php index c77708f6..57bb209c 100644 --- a/PHPCI/Command/GenerateCommand.php +++ b/PHPCI/Command/GenerateCommand.php @@ -36,4 +36,4 @@ class GenerateCommand extends Command $gen->generateModels(); $gen->generateStores(); } -} \ No newline at end of file +} diff --git a/PHPCI/Command/InstallCommand.php b/PHPCI/Command/InstallCommand.php index f299240b..f28c0b8f 100644 --- a/PHPCI/Command/InstallCommand.php +++ b/PHPCI/Command/InstallCommand.php @@ -42,7 +42,9 @@ class InstallCommand extends Command $ghId = $this->ask('(Optional) Github Application ID: ', true); $ghSecret = $this->ask('(Optional) Github Application Secret: ', true); - $cmd = 'mysql -u' . $dbUser . (!empty($dbPass) ? ' -p' . $dbPass : '') . ' -h' . $dbHost . ' -e "CREATE DATABASE IF NOT EXISTS ' . $dbName . '"'; + $cmd = 'mysql -u' . $dbUser . (!empty($dbPass) ? ' -p' . $dbPass : '') . ' -h' . $dbHost . + ' -e "CREATE DATABASE IF NOT EXISTS ' . $dbName . '"'; + shell_exec($cmd); $str = "set('install_url', '{$ciUrl}'); "; - if(!empty($ghId) && !empty($ghSecret)) - { - $str .= PHP_EOL . "\$registry->set('github_app', array('id' => '{$ghId}', 'secret' => '{$ghSecret}'));" . PHP_EOL; + if (!empty($ghId) && !empty($ghSecret)) { + $str .= PHP_EOL . + "\$registry->set('github_app', array('id' => '{$ghId}', 'secret' => '{$ghSecret}'));" . + PHP_EOL; } @@ -76,8 +79,7 @@ b8\Database::setReadServers(array('{$dbHost}')); $adminPass = $this->ask('Enter your desired admin password: '); $adminName = $this->ask('Enter your name: '); - try - { + try { $user = new \PHPCI\Model\User(); $user->setEmail($adminEmail); $user->setName($adminName); @@ -88,15 +90,13 @@ b8\Database::setReadServers(array('{$dbHost}')); $store->save($user); print 'User account created!' . PHP_EOL; - } - catch(\Exception $ex) - { + } catch (\Exception $ex) { print 'There was a problem creating your account. :(' . PHP_EOL; print $ex->getMessage(); } } - function ask($question, $emptyOk = false) + protected function ask($question, $emptyOk = false) { print $question . ' '; @@ -107,11 +107,10 @@ b8\Database::setReadServers(array('{$dbHost}')); $rtn = trim($rtn); - if(!$emptyOk && empty($rtn)) - { + if (!$emptyOk && empty($rtn)) { $rtn = $this->ask($question, $emptyOk); } return $rtn; } -} \ No newline at end of file +} diff --git a/PHPCI/Command/RunCommand.php b/PHPCI/Command/RunCommand.php index 7f62521d..5d776f9b 100644 --- a/PHPCI/Command/RunCommand.php +++ b/PHPCI/Command/RunCommand.php @@ -15,8 +15,8 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use b8\Store\Factory; -use PHPCI\Builder, - PHPCI\BuildFactory; +use PHPCI\Builder; +use PHPCI\BuildFactory; /** * Run console command - Runs any pending builds. @@ -40,14 +40,12 @@ class RunCommand extends Command $store = Factory::getStore('Build'); $result = $store->getByStatus(0); - foreach($result['items'] as $build) - { + foreach ($result['items'] as $build) { $build = BuildFactory::getBuild($build); if ($input->getOption('verbose')) { $builder = new Builder($build, array($this, 'logCallback')); - } - else { + } else { $builder = new Builder($build); } @@ -59,4 +57,4 @@ class RunCommand extends Command { $this->output->writeln($log); } -} \ No newline at end of file +}