hook config for pecl/zend extensions
authorMichael Wallner <mike@php.net>
Tue, 19 May 2015 12:31:16 +0000 (14:31 +0200)
committerMichael Wallner <mike@php.net>
Tue, 19 May 2015 12:31:16 +0000 (14:31 +0200)
app/Controller/Github/Hook/Receive.php
app/Github/API/Hooks/CreateHook.php
app/Github/API/Hooks/UpdateHook.php
app/Github/API/Releases/CreateRelease.php
composer.lock

index ec0d9fc35e24d82575acedc4b4116f021d9f1f13..eda96fac3e5eff07fbd35c1c651b4f65db0768c0 100644 (file)
@@ -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;
index 8e7c050e0c0ff1b62b9bb46b9b11c56379f429b9..1579b5b4b73a9840cae9b1c4d739a94993b0b3ea 100644 (file)
@@ -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,
index 1fb8231cdfde9c8d7d1de044426dfdda1955ea52..a891b13351c1d2382be41e720c6da99df2bff134 100644 (file)
@@ -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);
index 5942f0ce1ea0ab4d2c5f31670ab6516a8abde45f..68854f7697d8c730f4060165c2dad2ba9fda2e86 100644 (file)
@@ -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()))) {
index 95ccc25886a04667a8a103a25e8b695c30cf9d9e..e458cd3ed6aa61b61739cb283aa39362f9bf48c1 100644 (file)
@@ -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",
             "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": [
                 "package",
                 "phar"
             ],
-            "time": "2015-05-15 10:52:54"
+            "time": "2015-05-18 15:11:04"
         },
         {
             "name": "m6w6/pharext.wiki",
             },
             "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": ""
             },