From d4a4eae6b299ec3c066a4b8b68e048ddf69e0268 Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Tue, 19 May 2015 14:31:16 +0200 Subject: [PATCH] hook config for pecl/zend extensions --- app/Controller/Github/Hook/Receive.php | 9 +++++++-- app/Github/API/Hooks/CreateHook.php | 2 ++ app/Github/API/Hooks/UpdateHook.php | 12 ++++++++++-- app/Github/API/Releases/CreateRelease.php | 2 +- composer.lock | 12 ++++++------ 5 files changed, 26 insertions(+), 11 deletions(-) diff --git a/app/Controller/Github/Hook/Receive.php b/app/Controller/Github/Hook/Receive.php index ec0d9fc..eda96fa 100644 --- a/app/Controller/Github/Hook/Receive.php +++ b/app/Controller/Github/Hook/Receive.php @@ -92,14 +92,19 @@ class Receive implements Controller } private function createReleaseAsset($release, $repo) { + $hook = $this->github->checkRepoHook($repo); $dir = (new Task\GitClone($repo->clone_url, $release->tag_name))->run(); - $src = new SourceDir\Git($dir); + if (!empty($hook->config->pecl)) { + $src = new SoureDir\Pecl($dir); + } else { + $src = new SourceDir\Git($dir); + } $meta = Metadata::all() + [ "name" => $repo->name, "release" => $release->tag_name, "license" => $src->getLicense(), "stub" => "pharext_installer.php", - "type" => false ? "zend_extension" : "extension", + "type" => !empty($hook->config->zend) ? "zend_extension" : "extension", ]; $file = (new Task\PharBuild($src, $meta))->run(); return $file; diff --git a/app/Github/API/Hooks/CreateHook.php b/app/Github/API/Hooks/CreateHook.php index 8e7c050..1579b5b 100644 --- a/app/Github/API/Hooks/CreateHook.php +++ b/app/Github/API/Hooks/CreateHook.php @@ -28,6 +28,8 @@ class CreateHook extends Call "name" => "web", "events" => $events, "config" => [ + "zend" => !empty($this->args["conf"]["zend"]), + "pecl" => !empty($this->args["conf"]["pecl"]), "url" => $this->config->hook->url, "content_type" => $this->config->hook->content_type, "insecure_ssl" => $this->config->hook->insecure_ssl, diff --git a/app/Github/API/Hooks/UpdateHook.php b/app/Github/API/Hooks/UpdateHook.php index 1fb8231..a891b13 100644 --- a/app/Github/API/Hooks/UpdateHook.php +++ b/app/Github/API/Hooks/UpdateHook.php @@ -19,8 +19,16 @@ class UpdateHook extends \app\Github\API\Call if (!empty($this->args["conf"]["release"])) { $events[] = "release"; } - - $request->getBody()->append(json_encode(compact("events"))); + $config = [ + "zend" => !empty($this->args["conf"]["zend"]), + "pecl" => !empty($this->args["conf"]["pecl"]), + "url" => $this->config->hook->url, + "content_type" => $this->config->hook->content_type, + "insecure_ssl" => $this->config->hook->insecure_ssl, + "secret" => $this->config->client->secret, // FIXME: bad idea? + ]; + + $request->getBody()->append(json_encode(compact("events", "config"))); $this->api->getClient()->enqueue($request, function($response) use($callback) { if ($response->getResponseCode() >= 400 || null === ($json = json_decode($response->getBody()))) { throw new \app\Github\Exception\RequestException($response); diff --git a/app/Github/API/Releases/CreateRelease.php b/app/Github/API/Releases/CreateRelease.php index 5942f0c..68854f7 100644 --- a/app/Github/API/Releases/CreateRelease.php +++ b/app/Github/API/Releases/CreateRelease.php @@ -16,7 +16,7 @@ class CreateRelease extends Call "Content-Type" => "application/json", ]); $request->getBody()->append(json_encode([ - "tag_name" => $this->args["tag"] + "tag_name" => $this->args["tag"], ])); $this->api->getClient()->enqueue($request, function($response) use($callback) { if ($response->getResponseCode() >= 400 || null === ($json = json_decode($response->getBody()))) { diff --git a/composer.lock b/composer.lock index 95ccc25..e458cd3 100644 --- a/composer.lock +++ b/composer.lock @@ -1,7 +1,7 @@ { "_readme": [ "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], "hash": "910f08879af0e54cb4aaa21d1ca5eef2", @@ -104,12 +104,12 @@ "source": { "type": "git", "url": "https://github.com/m6w6/pharext.git", - "reference": "e44f0adc7b18845a2cd3dc63fdab5d9bcdc10f76" + "reference": "c99dfed4c3056e0a8ed1351adb79dd4f16324965" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/m6w6/pharext/zipball/e44f0adc7b18845a2cd3dc63fdab5d9bcdc10f76", - "reference": "e44f0adc7b18845a2cd3dc63fdab5d9bcdc10f76", + "url": "https://api.github.com/repos/m6w6/pharext/zipball/c99dfed4c3056e0a8ed1351adb79dd4f16324965", + "reference": "c99dfed4c3056e0a8ed1351adb79dd4f16324965", "shasum": "" }, "bin": [ @@ -129,7 +129,7 @@ "package", "phar" ], - "time": "2015-05-15 10:52:54" + "time": "2015-05-18 15:11:04" }, { "name": "m6w6/pharext.wiki", @@ -351,7 +351,7 @@ }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rdlowrey/Auryn/zipball/be3807b62a6991e61151b55b6974dc1289afabd5", + "url": "https://api.github.com/repos/rdlowrey/Auryn/zipball/d0d875868e1d7d241983c88252c07965a65224c1", "reference": "2e03bf93ddcd855e962d314cce74ce2a01a49228", "shasum": "" }, -- 2.30.2