pecl/zend config
authorMichael Wallner <mike@php.net>
Tue, 9 Jun 2015 07:38:46 +0000 (09:38 +0200)
committerMichael Wallner <mike@php.net>
Tue, 9 Jun 2015 07:38:46 +0000 (09:38 +0200)
app/Controller/Github/Hook/Receive.php
app/Controller/Github/Release.php
app/Github/API.php
app/views/github/repo.phtml

index fa631e2d97f484d71b3fe5a9f57f13205d7fa5b5..30a744e4ff3d5f69b844b9aca0ae8fe9f1c7fc02 100644 (file)
@@ -97,7 +97,7 @@ class Receive implements Controller
                }
                
                $this->setTokenForUser($release->repository->owner->login);
-               $this->github->uploadAssetForRelease($release->release, $release->repository, function($json) use($response) {
+               $this->github->uploadAssetForRelease($release->release, $release->repository, null, function($json) use($response) {
                        $response->setResponseCode(201);
                        $response->setHeader("Location", $json->url);
                })->send();
@@ -113,7 +113,7 @@ class Receive implements Controller
                }
                
                $this->setTokenForUser($create->repository->owner->login);
-               $this->github->createReleaseFromTag($create->repository, $create->ref, function($json) use($response) {
+               $this->github->createReleaseFromTag($create->repository, $create->ref, null, function($json) use($response) {
                        $response->setResponseCode(201);
                        $response->setHeader("Location", $json->url);
                })->send();
index fd3550567da98d4164eec8c2b64bade9c869e832..f0dd55f840c3498c255515f14e0ea39886a4a6eb 100644 (file)
@@ -15,17 +15,17 @@ class Release extends Github
                                call_user_func(new RepoCallback($this->github), $repo, $links);
 
                                $this->github->listReleases($repo->full_name, null, function($releases) use($repo) {
-                                       $tag = $this->app->getRequest()->getForm("tag");
+                                       $config = $this->app->getRequest()->getForm();
                                        foreach ($releases as $r) {
-                                               if ($r->tag_name === $tag) {
-                                                       $this->github->uploadAssetForRelease($repo, $r, function() use($repo) {
+                                               if ($r->tag_name === $config->tag) {
+                                                       $this->github->uploadAssetForRelease($repo, $r, $config, function() use($repo) {
                                                                $this->app->redirect($this->app->getBaseUrl()->mod("./github/" . $repo->full_name));
                                                        });
                                                        return;
                                                }
                                        }
                                        
-                                       $this->github->createReleaseFromTag($repo, $tag, function() use($repo) {
+                                       $this->github->createReleaseFromTag($repo, $tag, $config, function() use($repo) {
                                                $this->app->redirect($this->app->getBaseUrl()->mod("./github/" . $repo->full_name));
                                        });
                                });
index bd28f3ababa56d1bb711a4c32d18e8c69791cc35..9f37c4f2d56410af18e8a83ecd4769840625c64d 100644 (file)
@@ -241,11 +241,11 @@ class API
                return $call($callback);
        }
 
-       function uploadAssetForRelease($repo, $release, callable $callback) {
-               return $this->listHooks($repo->full_name, function($hooks) use($release, $repo, $callback) {
+       function uploadAssetForRelease($repo, $release, $config, callable $callback) {
+               return $this->listHooks($repo->full_name, function($hooks) use($release, $repo, $config, $callback) {
                        $repo->hooks = $hooks;
                        $hook = $this->checkRepoHook($repo);
-                       $phar = new Pharext\Package($repo->clone_url, $release->tag_name, $repo->name, $hook ? $hook->config : null);
+                       $phar = new Pharext\Package($repo->clone_url, $release->tag_name, $repo->name, $config ?: $hook->config);
                        $name = sprintf("%s-%s.ext.phar", $repo->name, $release->tag_name);
                        $url = uri_template($release->upload_url, compact("name"));
                        $this->createReleaseAsset($url, $phar, "application/phar", function($json) use($release, $repo, $callback) {
@@ -260,9 +260,9 @@ class API
                });
        }
 
-       function createReleaseFromTag($repo, $tag_name, callable $callback) {
+       function createReleaseFromTag($repo, $tag_name, $config, callable $callback) {
                return $this->createRelease($repo->full_name, $tag_name, function($json) use($repo, $callback) {
-                       $this->uploadAssetForRelease($repo, $json, $callback);
+                       $this->uploadAssetForRelease($repo, $json, $config, $callback);
                });
        }
 
index 709908ce64255fbfffddca29ef8b9a97fff1d55a..9d5f7eb62d49211641093a617f39c853e2045e9a 100644 (file)
                                <?php endif; ?>
                                <?php endforeach; ?>
                        <?php else: ?>
-                               <form method="post" action="<?= $baseUrl->mod("./github/repo/". $repo->full_name ."/release") ?>">
+                               <form class="form-inline" method="post" action="<?= $baseUrl->mod("./github/repo/". $repo->full_name ."/release") ?>">
                                        <input type="hidden" name="tag" value="<?= $this->e($v->tag->name) ?>">
+                                       <div class="checkbox">
+                                               <label for="hook-zend">
+                                                       <input id="hook-zend" type="checkbox" name="zend" value="1" <?= (!empty($hook) && !empty($hook->config->zend)) ? "checked":""?>>
+                                                       Mark as a ZendExtension.
+                                               </label>
+                                       </div>
+                                       <div class="checkbox <?= empty($repo->package_xml) ? "disabled text-muted":"" ?>">
+                                               <label for="hook-pecl">
+                                                       <input id="hook-pecl" type="checkbox" name="pecl" value="1" <?= (!empty($hook) && !empty($hook->config->pecl)) ? "checked":""?> <?= empty($repo->package_xml) ? "disabled":"" ?>>
+                                                       Use PECL package XML file.
+                                               </label>
+                                       </div>
                                        <button class="btn btn-warning">
                                                <span class="octicon octicon-package"></span>
                                                Release PHARext package