From: Michael Wallner Date: Tue, 9 Jun 2015 07:38:46 +0000 (+0200) Subject: pecl/zend config X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=1097a4f83de3562c3518f31b168448c2c2ac0451;p=pharext%2Fpharext.org pecl/zend config --- diff --git a/app/Controller/Github/Hook/Receive.php b/app/Controller/Github/Hook/Receive.php index fa631e2..30a744e 100644 --- a/app/Controller/Github/Hook/Receive.php +++ b/app/Controller/Github/Hook/Receive.php @@ -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(); diff --git a/app/Controller/Github/Release.php b/app/Controller/Github/Release.php index fd35505..f0dd55f 100644 --- a/app/Controller/Github/Release.php +++ b/app/Controller/Github/Release.php @@ -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)); }); }); diff --git a/app/Github/API.php b/app/Github/API.php index bd28f3a..9f37c4f 100644 --- a/app/Github/API.php +++ b/app/Github/API.php @@ -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); }); } diff --git a/app/views/github/repo.phtml b/app/views/github/repo.phtml index 709908c..9d5f7eb 100644 --- a/app/views/github/repo.phtml +++ b/app/views/github/repo.phtml @@ -239,8 +239,20 @@ -
full_name ."/release") ?>"> + full_name ."/release") ?>"> +
+ +
+
"> + +