svn: /pear2/sandbox/SimpleChannelServer/trunk/src/SimpleChannelServer/ CLI.php Categories.php Main.php
| From: | Brett Bieber | Date: | Sat, 31 Oct 2009 13:41:13 +0000 |
| Subject: | svn: /pear2/sandbox/SimpleChannelServer/trunk/src/SimpleChannelServer/ CLI.php Categories.php Main.php | ||
| Groups: | php.pear.cvs php.pear.core | ||
| Request: | Send a blank email to pear-core+get-9010@lists.php.net to get a copy of this message | ||
saltybeagle Sat, 31 Oct 2009 13:41:13 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=290105
Log:
Add non-functioning 'categorize' command. TODO: Categories object needs to auto-detect all
the existing categories for the current channel.
Changed paths:
U pear2/sandbox/SimpleChannelServer/trunk/src/SimpleChannelServer/CLI.php
U pear2/sandbox/SimpleChannelServer/trunk/src/SimpleChannelServer/Categories.php
U pear2/sandbox/SimpleChannelServer/trunk/src/SimpleChannelServer/Main.php
Modified: pear2/sandbox/SimpleChannelServer/trunk/src/SimpleChannelServer/CLI.php
===================================================================
--- pear2/sandbox/SimpleChannelServer/trunk/src/SimpleChannelServer/CLI.php 2009-10-31 13:34:23 UTC
(rev 290104)
+++ pear2/sandbox/SimpleChannelServer/trunk/src/SimpleChannelServer/CLI.php 2009-10-31 13:41:13 UTC
(rev 290105)
@@ -48,6 +48,9 @@
case 'add-category':
$this->handleAddCategory();
break;
+ case 'categorize':
+ $this->handleCategorize();
+ break;
case 'release':
$this->handleRelease();
break;
@@ -58,6 +61,28 @@
}
}
+ function handleCategorize()
+ {
+ if ($_SERVER['argc'] < 3) {
+ $this->printCategorizeUsage();
+ return false;
+ }
+ $args = array();
+ $args['package'] = $_SERVER['argv'][2];
+ $args['category'] = $_SERVER['argv'][3];
+ Categories::linkPackageToCategory($args['package'], $args['category']);
+ echo "Added {$args['package']} to {$args['category']} \n";
+ }
+
+ function printCategorizeUsage()
+ {
+ echo 'Usage: pearscs categorize package category
+ This will add the given package to a category.
+
+ package Name of the package.
+ category Name of the category.' . PHP_EOL;
+ }
+
function handleAddCategory()
{
if ($_SERVER['argc'] < 3) {
@@ -271,13 +296,14 @@
public function printUsage()
{
echo '
-Usage: pearscs update|create|add-maintainer|add-category|release [option]
+Usage: pearscs create|update|release|... [option]
Commands:
update [channel.xml] Update the channel xml files.
create pear.example.com summary [...] Create a new channel.
add-maintainer handle Add a maintainer.
add-category category [description] Add a category.
release package.tgz maintainer Release package.
+ categorize package category Categorize a package.
';
}
}
Modified: pear2/sandbox/SimpleChannelServer/trunk/src/SimpleChannelServer/Categories.php
===================================================================
--- pear2/sandbox/SimpleChannelServer/trunk/src/SimpleChannelServer/Categories.php 2009-10-31
13:34:23 UTC (rev 290104)
+++ pear2/sandbox/SimpleChannelServer/trunk/src/SimpleChannelServer/Categories.php 2009-10-31
13:41:13 UTC (rev 290105)
@@ -129,6 +129,9 @@
*/
static function linkPackageToCategory($package, $category, $strict = false)
{
+ if (!isset(self::$_category)) {
+ self::$_category = new Categories;
+ }
return self::$_category->link($package, $category, $strict);
}
Modified: pear2/sandbox/SimpleChannelServer/trunk/src/SimpleChannelServer/Main.php
===================================================================
--- pear2/sandbox/SimpleChannelServer/trunk/src/SimpleChannelServer/Main.php 2009-10-31 13:34:23 UTC
(rev 290104)
+++ pear2/sandbox/SimpleChannelServer/trunk/src/SimpleChannelServer/Main.php 2009-10-31 13:41:13 UTC
(rev 290105)
@@ -54,7 +54,7 @@
$this->webpath = $webpath;
}
if (!$pyruspath) {
- $pyruspath = __DIR__;
+ $pyruspath = __DIR__;
}
$rest = $channel->protocols->rest;
foreach ($rest as $restpath) {