Updating the UpdateCommand to check for a config key rather than a specific file.

This commit is contained in:
Dan Cryer 2015-02-25 09:36:50 +00:00
parent f4a0804100
commit db90f2ea11

View file

@ -9,6 +9,7 @@
namespace PHPCI\Command; namespace PHPCI\Command;
use b8\Config;
use Monolog\Logger; use Monolog\Logger;
use PHPCI\Helper\Lang; use PHPCI\Helper\Lang;
use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Command\Command;
@ -59,19 +60,9 @@ class UpdateCommand extends Command
protected function verifyInstalled(OutputInterface $output) protected function verifyInstalled(OutputInterface $output)
{ {
if (!file_exists(PHPCI_DIR . 'PHPCI/config.yml')) { $config = Config::getInstance();
$output->writeln('<error>'.Lang::get('not_installed').'</error>'); $phpciUrl = $config->get('phpci.url');
$output->writeln('<error>'.Lang::get('install_instead').'</error>');
return false;
}
$content = file_get_contents(PHPCI_DIR . 'PHPCI/config.yml'); return !empty($phpciUrl);
if (empty($content)) {
$output->writeln('<error>'.Lang::get('not_installed').'</error>');
$output->writeln('<error>'.Lang::get('install_instead').'</error>');
return false;
}
return true;
} }
} }