com web/rmtools: add options help, catch some exception: client/include/PickleExt.php client/script/pickle.php
| From: | Anatol Belski | Date: | Tue, 05 May 2015 20:04:32 +0000 |
| Subject: | com web/rmtools: add options help, catch some exception: client/include/PickleExt.php client/script/pickle.php | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-26009@lists.php.net to get a copy of this message | ||
Commit: a86febd3ce1b8f074ea44270529d59ce14ab0d4a
Author: Anatol Belski <ab@php.net> Tue, 5 May 2015 22:04:32 +0200
Parents: 3c8f4b2db635f31144347d657d1bab7e9b3e8a53
Branches: master pecl_legacy
Link: http://git.php.net/?p=web/rmtools.git;a=commitdiff;h=a86febd3ce1b8f074ea44270529d59ce14ab0d4a
Log:
add options help, catch some exception
Changed paths:
M client/include/PickleExt.php
M client/script/pickle.php
Diff:
diff --git a/client/include/PickleExt.php b/client/include/PickleExt.php
index 35177bf..d87d67e 100644
--- a/client/include/PickleExt.php
+++ b/client/include/PickleExt.php
@@ -17,6 +17,10 @@ class PickleExt
public function __construct($pkg_uri, $build)
{
+ if (!file_exists($pkg_uri)) {
+ throw new \Exception("'$pkg_uri' does not exist");
+ }
+
$this->pkg_uri = $pkg_uri;
$this->build = $build;
}
diff --git a/client/script/pickle.php b/client/script/pickle.php
index 7cc0a01...16f5547 100644
--- a/client/script/pickle.php
+++ b/client/script/pickle.php
@@ -19,6 +19,19 @@ $is_snap = isset($options['is-snap']);
$is_last_run = isset($options['last']);
$is_first_run = isset($options['first']);
+if (NULL == $branch_name || NULL == $pkg_path) {
+ echo "Usage: pickle.php [OPTION] ..." . PHP_EOL;
+ echo " --config Configuration file name without suffix, required." . PHP_EOL;
+ echo " --package Path to the PECL package, required." . PHP_EOL;
+ echo " --upload Upload the builds to the windows.php.net, optional." . PHP_EOL;
+ echo " --is-snap We upload to releases by default, but this one goes to snaps,
optional." . PHP_EOL;
+ echo " --first This call is the first in the series for the same package file,
optional." . PHP_EOL;
+ echo " --last This call is the last in the series for the same package file,
optional." . PHP_EOL;
+ echo PHP_EOL;
+}
+
+
+
$config_path = __DIR__ . '/../data/config/pickle/' . $branch_name . '.ini';
$branch = new rm\PickleBranch($config_path);
@@ -41,8 +54,16 @@ foreach ($builds as $build_name) {
//$build_config = $branch->config->getBuildFromName($build_name);
- $build = $branch->createBuildInstance($build_name);
- $ext = new rm\PickleExt($pkg_path, $build);
+ try {
+ $build = $branch->createBuildInstance($build_name);
+ $ext = new rm\PickleExt($pkg_path, $build);
+ } catch (Exception $e) {
+ echo 'Error: ' . $e->getMessage() . PHP_EOL;
+
+ /* send error mail*/
+
+ continue;
+ }
$ext->init();