-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move SimpleChannelServer to trunk/branches layout
- Loading branch information
0 parents
commit 34f7303
Showing
26 changed files
with
2,373 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
;; maintainers of SimpleChannelServer | ||
Gregory Beaver [cellog] <[email protected]> (lead) | ||
Brett Bieber [saltybeagle] <[email protected]> (lead) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
A Simple Channel Server for PEAR2 compatible channels | ||
|
||
This package contains a set of scripts to create a simple PEAR compatible | ||
channel server. Included with the package is the pearscs command which you | ||
can use for the command line to manage a pear channel. | ||
|
||
The pearscs utility will be installed in the directory configured by the | ||
bin_dir setting within Pyrus. | ||
|
||
Example usage from the command line: | ||
pearscs create pear.example.com "My Channel" myalias | ||
pearscs release MyPackage-0.0.0.tgz myhandle | ||
|
||
Test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
First attempt. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
TODO - | ||
Help appreciated! You'll need at least php 5.3! | ||
|
||
* Implement the remaining commands in the CLI utility. | ||
* Build some tests to ensure stability of existing functions. | ||
** Use the SimpleChannelServer's package.xml as a starting point - should be able to build a complete channel for this package. | ||
* Check for phar ini settings to ensure we can open & write phars or .tgzs --- phar.require_hash, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<commands version="2.0" xmlns="http://pear2.php.net/dtd/customcommand-2.0"> | ||
<command> | ||
<name>scs-update</name> | ||
<class>pear2\SimpleChannelServer\CLI</class> | ||
<function>pyrusUpdate</function> | ||
<autoloadpath/> | ||
<summary>Simple channel server: Update all releases of a within the get/ directory.</summary> | ||
<shortcut>su</shortcut> | ||
<options/> | ||
<arguments/> | ||
<doc> | ||
This command scans all existing .tar and .tgz files within the get/ directory, | ||
and then uses them to re-generate the REST files in the rest/ directory. | ||
|
||
It must be executed from the channel root directory, the directory must | ||
contain the get/ directory with all releases, and must contain channel.xml. | ||
|
||
In addition, the handle configuration variable must be set to your handle | ||
</doc> | ||
</command> | ||
<command> | ||
<name>scs-create</name> | ||
<class>pear2\SimpleChannelServer\CLI</class> | ||
<function>pyrusCreate</function> | ||
<autoloadpath/> | ||
<summary>Simple channel server: Create a channel.xml, get/ and rest/ directory for a channel</summary> | ||
<shortcut>sc</shortcut> | ||
<options/> | ||
<arguments> | ||
<argument> | ||
<name>name</name> | ||
<multiple>0</multiple> | ||
<optional>0</optional> | ||
<doc>Name of the channel to create. This should be the full name, such as pear2.php.net or pear.example.com/path</doc> | ||
</argument> | ||
<argument> | ||
<name>summary</name> | ||
<multiple>0</multiple> | ||
<optional>0</optional> | ||
<doc>Short, 1-line description of the channnel</doc> | ||
</argument> | ||
<argument> | ||
<name>alias</name> | ||
<multiple>0</multiple> | ||
<optional>1</optional> | ||
<doc>Channel alias, such as pear2 for pear2.php.net</doc> | ||
</argument> | ||
<argument> | ||
<name>file</name> | ||
<multiple>0</multiple> | ||
<optional>1</optional> | ||
<doc>full path to the channel.xml to create. Default is channel.xml in the working directory</doc> | ||
</argument> | ||
</arguments> | ||
<doc> | ||
This command creates a new channel in the current directory, or the directory | ||
specified by the location of the channel.xml file. | ||
</doc> | ||
</command> | ||
<command> | ||
<name>scs-add-maintainer</name> | ||
<class>pear2\SimpleChannelServer\CLI</class> | ||
<function>pyrusAddMaintainer</function> | ||
<autoloadpath/> | ||
<summary>Simple Channel Server: Add a new maintaing developer to the channel</summary> | ||
<shortcut>sam</shortcut> | ||
<options/> | ||
<arguments> | ||
<argument> | ||
<name>handle</name> | ||
<multiple>0</multiple> | ||
<optional>0</optional> | ||
<doc>Developer handle as used in package.xml</doc> | ||
</argument> | ||
<argument> | ||
<name>name</name> | ||
<multiple>0</multiple> | ||
<optional>0</optional> | ||
<doc>Developer name</doc> | ||
</argument> | ||
<argument> | ||
<name>uri</name> | ||
<multiple>0</multiple> | ||
<optional>1</optional> | ||
<doc>Developer homepage</doc> | ||
</argument> | ||
</arguments> | ||
<doc> | ||
This command adds a developer to the channel, and is useful for adding developers | ||
to be listed prior to making their first release. | ||
</doc> | ||
</command> | ||
<command> | ||
<name>scs-add-category</name> | ||
<class>pear2\SimpleChannelServer\CLI</class> | ||
<function>pyrusAddCategory</function> | ||
<autoloadpath/> | ||
<summary>Simple Channel Server: Add a new category to the channel</summary> | ||
<shortcut>sac</shortcut> | ||
<options/> | ||
<arguments> | ||
<argument> | ||
<name>category</name> | ||
<multiple>0</multiple> | ||
<optional>0</optional> | ||
<doc>Name of the category. This may contain spaces (use "" to contain them)</doc> | ||
</argument> | ||
<argument> | ||
<name>description</name> | ||
<multiple>0</multiple> | ||
<optional>0</optional> | ||
<doc>Short description of the category's packages</doc> | ||
</argument> | ||
</arguments> | ||
<doc> | ||
Categories are used to organize channels with large numbers of packages. Use this | ||
command to create a new category. | ||
</doc> | ||
</command> | ||
<command> | ||
<name>scs-release</name> | ||
<class>pear2\SimpleChannelServer\CLI</class> | ||
<function>pyrusRelease</function> | ||
<autoloadpath/> | ||
<summary>Simple Channel Server: Release a package</summary> | ||
<shortcut>sr</shortcut> | ||
<options/> | ||
<arguments> | ||
<argument> | ||
<name>path</name> | ||
<multiple>0</multiple> | ||
<optional>0</optional> | ||
<doc>path to the release tarball</doc> | ||
</argument> | ||
</arguments> | ||
<doc> | ||
Release a package. This command uses the handle configuration variable as the | ||
releasing maintainer's handle, and generates REST files for the release in the | ||
rest/ directory as well as the released tarballs in the get/ directory. | ||
</doc> | ||
</command> | ||
</commands> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
error_reporting(E_ALL | E_NOTICE); | ||
ini_set('display_errors',true); | ||
// Get the autoloader | ||
require __DIR__ . '/../../../autoload.php'; | ||
|
||
/* | ||
$channel = new PEAR2_SimpleChannelServer('pear2.php.net','/Library/WebServer/Documents/pearserver', null, '/Users/bbieber/pyrus', array('saltybeagle','cellog')); | ||
if (!@unserialize(file_get_contents('/tmp/categories.inf'))) { | ||
$cat = PEAR2_SimpleChannelServer_Categories::create('Name1', | ||
'Description 1', 'Alias1')-> | ||
create('Name2', 'Description 2')-> | ||
create('Name3', 'Description 3', 'Alias3')-> | ||
create('Name4', 'Description 4'); | ||
file_put_contents('/tmp/categories.inf', serialize($cat)); | ||
} | ||
$categories = PEAR2_SimpleChannelServer_Categories::getCategories(); | ||
$categories = $channel->listCategories(); | ||
foreach($categories as $category) { | ||
var_dump($category); | ||
} | ||
*/ | ||
$channel = new pear2\SimpleChannelServer\Channel('pear2.php.net','Brett Bieber\'s PEAR Channel','salty'); | ||
|
||
//$scs = new pear2\SimpleChannelServer\Main($channel,'/Library/WebServer/Documents/pearserver','/home/bbieber/pyrus/php'); | ||
$scs = new pear2\SimpleChannelServer\Main($channel,'/home/cellog/testapache/htdocs',\pear2\Pyrus\Config::current()->location); | ||
$categories = pear2\SimpleChannelServer\Categories::create('Default', 'This is the default category'); | ||
$scs->saveChannel(); | ||
$scs->saveRelease(new \pear2\Pyrus\Package(dirname(__FILE__) . '/../package.xml'), 'cellog'); | ||
echo 'did it'.PHP_EOL; | ||
/* | ||
$manager = new pear2\SimpleChannelServer\REST_Manager('/Library/WebServer/Documents/pearserver','pear2.php.net','rest/',array('cellog')); | ||
var_dump($manager->saveRelease(new \pear2\Pyrus\Package(dirname(__FILE__) . '/../package.xml'),'cellog')); | ||
*/ | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
/** | ||
* This example shows how to upgrade a pear channel running Chiara_PEAR_Server | ||
* to PEAR2_SimpleChannelServer. | ||
* | ||
* All release dates are taken from the package.xml, so we can easily re-create | ||
* the channel. | ||
* | ||
* This could also be accomplished with: | ||
* for i in *.tgz; do php pearscs.phar release $i saltybeagle; done | ||
* | ||
* This example shows you how to use the API to release the packages. | ||
*/ | ||
|
||
require_once '/Users/bbieber/pyrus/src/PEAR2/Autoload.php'; | ||
|
||
// Here we re-create the channel.xml | ||
$channel = new PEAR2_SimpleChannelServer_Channel('pear.saltybeagle.com','Brett Bieber\'s PEAR Channel','salty','Chiara_PEAR_Server_REST/'); | ||
$scs = new PEAR2_SimpleChannelServer($channel, dirname(__FILE__).'/pearchannel'); | ||
$scs->saveChannel(); | ||
|
||
// Path to the get directory. | ||
$dirname = dirname(__FILE__).'/pearchannel/get/'; | ||
|
||
$dir = new DirectoryIterator($dirname); | ||
foreach ($dir as $file) { | ||
if (!$file->isDot() && substr($file->getFilename(), -3) != 'tar') { | ||
$scs->saveRelease(new \pear2\Pyrus\Package($dirname.$file->getFilename()), 'saltybeagle'); | ||
} | ||
} | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
$pyrus = new \pear2\Pyrus\Package(__DIR__ . '/../../Pyrus/package.xml'); | ||
$pyrus->setPackagingFilter('pear2\Pyrus\PackageFile\v2Iterator\MinimalPackageFilter'); | ||
$extrafiles = array( | ||
new \pear2\Pyrus\Package(__DIR__ . '/../../HTTP_Request/package.xml'), | ||
$pyrus, | ||
new \pear2\Pyrus\Package(__DIR__ . '/../../Pyrus_Developer/package.xml'), | ||
new \pear2\Pyrus\Package(__DIR__ . '/../../Exception/package.xml'), | ||
); | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<?php | ||
error_reporting(E_ALL); | ||
ini_set('display_errors',true); | ||
require_once dirname(__FILE__).'/../../autoload.php'; | ||
|
||
$a = new \pear2\Pyrus\Developer\PackageFile\PEAR2SVN(dirname(__FILE__), 'PEAR2_SimpleChannelServer'); | ||
|
||
$package = new \pear2\Pyrus\Package('package.xml'); | ||
$outfile = $package->name.'-'.$package->version['release']; | ||
$a = new \pear2\Pyrus\Package\Creator(array( | ||
//new \pear2\Pyrus\Developer\Creator\Tar($outfile.'.tar', 'none'), | ||
new \pear2\Pyrus\Developer\Creator\Phar($outfile.'.tgz', false, Phar::TAR, Phar::GZ),), | ||
dirname(__FILE__).'/../../Exception/src', | ||
dirname(__FILE__).'/../../Autoload/src', | ||
dirname(__FILE__).'/../../MultiErrors/src'); | ||
$a->render($package); | ||
|
||
$a = new \pear2\Pyrus\Package\Creator(array( | ||
new \pear2\Pyrus\Developer\Creator\Phar(__DIR__ . '/pearscs.phar', '<?php | ||
function __autoload($class) | ||
{ | ||
include \'phar://\' . PYRUS_PHAR_FILE . \'/PEAR2_SimpleChannelServer-' . | ||
$package->version['release'] . '/php/\' . implode(\'/\', explode(\'_\', $class)) . \'.php\'; | ||
} | ||
set_include_path(\'phar://\' . PYRUS_PHAR_FILE . \'/PEAR2_SimpleChannelServer-' . | ||
$package->version['release'] . '/php/\'.PATH_SEPARATOR.get_include_path()); | ||
$cli = new \pear2\SimpleChannelServer\CLI(); | ||
$cli->process(); | ||
'),), | ||
dirname(__FILE__) . '/../../Exception/src', | ||
dirname(__FILE__) . '/../../Autoload/src', | ||
dirname(__FILE__) . '/../../MultiErrors/src'); | ||
$b = new \pear2\Pyrus\Package(__DIR__ . '/package.xml'); | ||
$rp = __DIR__ . '/../../HTTP_Request/src/HTTP'; | ||
|
||
$additional_files = array( | ||
'php/PEAR2/HTTP/Request.php' => $rp . '/Request.php', | ||
'php/PEAR2/HTTP/Request/Adapter.php' => $rp . '/Request/Adapter.php', | ||
'php/PEAR2/HTTP/Request/Adapter/Phpsocket.php' => $rp . '/Request/Adapter/Phpsocket.php', | ||
'php/PEAR2/HTTP/Request/Adapter/Phpstream.php' => $rp . '/Request/Adapter/Phpstream.php', | ||
'php/PEAR2/HTTP/Request/Exception.php' => $rp . '/Request/Exception.php', | ||
'php/PEAR2/HTTP/Request/Headers.php' => $rp . '/Request/Headers.php', | ||
'php/PEAR2/HTTP/Request/Response.php' => $rp . '/Request/Response.php', | ||
'php/PEAR2/HTTP/Request/Uri.php' => $rp . '/Request/Uri.php', | ||
); | ||
$pyrus = new \pear2\Pyrus\Package(__DIR__ . '/../../Pyrus/package.xml'); | ||
$pyrus_developer = new \pear2\Pyrus\Package(__DIR__ . '/../../Pyrus_Developer/package.xml'); | ||
$exception = new \pear2\Pyrus\Package(__DIR__ . '/../../Exception/package.xml'); | ||
foreach (array('Pyrus' => $pyrus, | ||
'Pyrus_Developer' => $pyrus_developer, | ||
'Exception' => $exception) as $add_dir=>$add_package) { | ||
foreach ($add_package->installcontents as $filename=>$details) { | ||
$add_filename = __DIR__ . '/../../'.$add_dir.'/'.$filename; | ||
switch($details['attribs']['role']) { | ||
case 'php': | ||
$additional_files[str_replace('src/','php/PEAR2/', $filename)] = $add_filename; | ||
break; | ||
case 'data': | ||
$additional_files['php/'.$filename] = $add_filename; | ||
$additional_files[$filename] = $add_filename; | ||
break; | ||
} | ||
} | ||
} | ||
$a->render($b, $additional_files); | ||
|
||
?> |
Oops, something went wrong.