Fixed issue with boolean options evaluating to true

This commit is contained in:
Chris 2017-01-10 16:47:09 +01:00
parent 688b9dcfca
commit 70c510ff9b
3 changed files with 15 additions and 7 deletions

View File

@ -1,9 +1,6 @@
phar "makephar.phar" { phar "makephar.phar" {
// Set to true to build a library-only phar
library false;
// Set stub // Set stub
stub "src/bootstrap.php"; stub "src/bootstrap.php";
@ -13,4 +10,8 @@ phar "makephar.phar" {
dir "src"; dir "src";
} }
exclude {
dir ".git";
}
} }

View File

@ -98,7 +98,8 @@ class Application
$manifests = Manifest::createFromFile($this->config->manifest); $manifests = Manifest::createFromFile($this->config->manifest);
foreach ($manifests as $manifest) { foreach ($manifests as $manifest) {
log_info("Building %s", $manifest->getOutput()); $type = $manifest->getIsLibrary()?"library":"application";
log_info("Building %s %s", $type, $manifest->getOutput());
$builder = new PharBuilder($manifest); $builder = new PharBuilder($manifest);
$builder->prepare(); $builder->prepare();
$builder->build(); $builder->build();

View File

@ -57,13 +57,19 @@ class Manifest
foreach ($tag->getChildren() as $child) switch ($child->getTagName()) { foreach ($tag->getChildren() as $child) switch ($child->getTagName()) {
case 'library': case 'library':
$mf->setIsLibrary($child->getValue()?:true); $val = $child->getValue();
if ($val === null) $val = true;
$mf->setIsLibrary($val);
break; break;
case 'compress': case 'compress':
$mf->setCompression($child->getValue()?:true); $val = $child->getValue();
if ($val === null) $val = true;
$mf->setCompression($val);
break; break;
case 'verbatim': case 'verbatim':
$mf->setVerbatim($child->getValue()?:true); $val = $child->getValue();
if ($val === null) $val = true;
$mf->setVerbatim($val);
break; break;
case 'stub': case 'stub':
$mf->setStubFile($child->getValue()); $mf->setStubFile($child->getValue());