mirror of
https://github.com/there4/markdown-resume.git
synced 2024-12-03 08:59:35 -05:00
Add a new check for the mbstring dependency. Closes #20
This commit is contained in:
parent
886fc223dd
commit
7103ee343e
@ -16,7 +16,7 @@ $app->add('Resume', __DIR__ . '/src');
|
||||
$console = new Resume\Cli\Resume();
|
||||
|
||||
// If we're running from phar, we get these values from the stub
|
||||
if (!defined("IN_PHAR")) {
|
||||
if (!defined('IN_PHAR')) {
|
||||
$project = json_decode(file_get_contents(__DIR__ . '/composer.json'));
|
||||
}
|
||||
|
||||
|
@ -30,6 +30,9 @@ class Resume extends Application
|
||||
// the alternative is OutputInterface::OUTPUT_PLAIN;
|
||||
$this->outputFormat = OutputInterface::OUTPUT_NORMAL;
|
||||
|
||||
// Exits on missing dependencies
|
||||
$this->checkDependencies();
|
||||
|
||||
// We do this now because we've loaded the project info from the composer file
|
||||
$this->setName($this->project->description);
|
||||
$this->setVersion($this->project->version);
|
||||
@ -65,6 +68,18 @@ class Resume extends Application
|
||||
return parent::getLongVersion().' by <comment>Craig Davis</comment>';
|
||||
}
|
||||
|
||||
public function checkDependencies() {
|
||||
$output = new ConsoleOutput();
|
||||
if (!extension_loaded('mbstring')) {
|
||||
$output->writeln(
|
||||
"\n<error>Missing Dependency: Please install the Multibyte String Functions.</error>\n" .
|
||||
"More help: http://www.php.net/manual/en/mbstring.installation.php\n",
|
||||
$this->outputFormat
|
||||
);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
public function registerStyles(&$output)
|
||||
{
|
||||
// https://github.com/symfony/Console/blob/master/Formatter/OutputFormatterStyle.php
|
||||
|
Loading…
x
Reference in New Issue
Block a user