X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=src%2Fpharext%2FPackager.php;h=23bcdc9999c52906cf6edcf0254789503c84500e;hb=2b97fd09b475f30027599e45e793af9610bf2a31;hp=4d70a0d6c5f748c68acb6179a4a3185823ee5e35;hpb=223047dbd4ea2950f319179821b0bdb273c50a32;p=pharext%2Fpharext diff --git a/src/pharext/Packager.php b/src/pharext/Packager.php index 4d70a0d..23bcdc9 100644 --- a/src/pharext/Packager.php +++ b/src/pharext/Packager.php @@ -3,7 +3,6 @@ namespace pharext; use Phar; -use pharext\Exception; /** * The extension packaging command executed by bin/pharext @@ -106,8 +105,8 @@ class Packager implements Command try { /* source needs to be evaluated before Cli\Args validation, - * so e.g. name and version can be overriden and Cli\Args - * does not complain about missing arguments + * so Cli\Args does not complain about missing arguments, + * which come from SourceDir::getPackageInfo() */ $this->loadSource(); } catch (\Exception $e) { @@ -196,9 +195,15 @@ class Packager implements Command $source = $this->download($source); $this->cleanup[] = new Task\Cleanup($source); } - $source = realpath($source); - if (!is_dir($source)) { - $source = $this->extract($source); + if (!$real = realpath($source)) { + $error = "Cannot find source '$source'"; + if ($this->args->git) { + $error .= "; did you forget to specify --branch for a remote git source?"; + } + throw new Exception($error); + } + if (!is_dir($real)) { + $source = $this->extract($real); $this->cleanup[] = new Task\Cleanup($source); if (!$this->args->git) { @@ -231,7 +236,10 @@ class Packager implements Command } foreach ($this->source->getPackageInfo() as $key => $val) { - $this->args->$key = $val; + /* do not override command line arguments */ + if (!isset($this->args->$key)) { + $this->args->$key = $val; + } } } }