From: Michael Wallner Date: Thu, 11 Jun 2015 08:38:32 +0000 (+0200) Subject: fix pharext package name, release and metadata X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=98e8aa941a26ed0990814a2d87bf590e70fe3ce7;p=pharext%2Fpharext.org fix pharext package name, release and metadata --- diff --git a/app/Github/API.php b/app/Github/API.php index 493984d..3eea40d 100644 --- a/app/Github/API.php +++ b/app/Github/API.php @@ -264,7 +264,7 @@ class API $repo->name, $config ?: (array) $this->checkRepoHook($repo)->config ); - $name = sprintf("%s-%s.ext.phar", $repo->name, $release->tag_name); + $name = $phar->build(); $url = uri_template($release->upload_url, compact("name")); $promise = $this->createReleaseAsset($url, $phar, "application/phar"); if ($release->draft) { diff --git a/app/Pharext/Package.php b/app/Pharext/Package.php index fb91d36..342a103 100644 --- a/app/Pharext/Package.php +++ b/app/Pharext/Package.php @@ -8,21 +8,48 @@ use pharext\Task; class Package { + private $source; private $file; + private $name; + private $release; + private $zend; function __construct($git_url, $tag_name, $pkg_name, $options) { $dir = (new Task\GitClone($git_url, $tag_name))->run(); $src = !empty($options["pecl"]) ? new SourceDir\Pecl($dir) : new SourceDir\Git($dir); + + /* setup defaults */ + $this->release = $tag_name; + $this->name = $pkg_name; + $this->zend = !empty($options["zend"]); + + /* override with package info from SourceDir */ + foreach ($src->getPackageInfo() as $key => $val) { + switch ($key) { + case "name": + case "release": + case "zend": + $this->$key = $val; + break; + } + } + + $this->source = $src; + } + + function build() { $meta = Metadata::all() + [ - "name" => $pkg_name, - "release" => $tag_name, - "license" => $src->getLicense(), + "name" => $this->name, + "release" => $this->release, + "license" => $this->source->getLicense(), "stub" => "pharext_installer.php", - "type" => !empty($options["zend"]) ? "zend_extension" : "extension", + "type" => $this->zend ? "zend_extension" : "extension", ]; - $this->file = (new Task\PharBuild($src, $meta))->run(); + $this->file = (new Task\PharBuild($this->source, $meta))->run(); + + return sprintf("%s-%s.ext.phar", $this->name, $this->release); } function __toString() { @@ -32,4 +59,12 @@ class Package function getFile() { return $this->file; } + + function getName() { + return $this->name; + } + + function getRelease() { + return $this->release; + } }