示例#1
0
$description = <<<EOT
XML_Serializer serializes complex data structures like arrays or object as XML documents.
This class helps you generating any XML document you require without the need for DOM.
Furthermore this package can be used as a replacement to serialize() and unserialize() as it comes with a matching XML_Unserializer that is able to create PHP data structures (like arrays and objects) from XML documents, if type hints are available.
If you use the XML_Unserializer on standard XML files, it will try to guess how it has to be unserialized. In most cases it does exactly what you expect it to do.
Try reading a RSS file with XML_Unserializer and you have the whole RSS file in a structured array or even a collection of objects, similar to XML_RSS.

Since version 0.8.0 the package is able to treat XML documents similar to the simplexml extension of PHP 5.
EOT;
$package = new PEAR_PackageFileManager();
$result = $package->setOptions(array('package' => 'XML_Serializer', 'summary' => 'Swiss-army knife for reading and writing XML files. Creates XML files from data structures and vice versa.', 'description' => $description, 'version' => $version, 'state' => $state, 'license' => 'BSD License', 'filelistgenerator' => 'cvs', 'ignore' => array('package.php', 'package.xml', 'package2.xml'), 'notes' => $notes, 'simpleoutput' => true, 'baseinstalldir' => 'XML', 'packagedirectory' => './', 'dir_roles' => array('docs' => 'doc', 'examples' => 'doc', 'tests' => 'test')));
if (PEAR::isError($result)) {
    echo $result->getMessage();
    die;
}
$package->addMaintainer('schst', 'lead', 'Stephan Schmidt', '*****@*****.**');
$package->addMaintainer('ashnazg', 'lead', 'Chuck Burgess', '*****@*****.**');
$package->addGlobalReplacement('package-info', '@package_version@', 'version');
$package->addDependency('php', '4.2.0', 'ge', 'php', false);
$package->addDependency('PEAR', '', 'has', 'pkg', false);
$package->addDependency('XML_Parser', '1.2.6', 'ge', 'pkg', false);
$package->addDependency('XML_Util', '1.1.1', 'ge', 'pkg', false);
if (isset($_GET['make']) || isset($_SERVER['argv'][1]) && $_SERVER['argv'][1] == 'make') {
    $result = $package->writePackageFile();
} else {
    $result = $package->debugPackageFile();
}
if (PEAR::isError($result)) {
    echo $result->getMessage();
    die;
}
示例#2
0
failure triggers an alert and a description of the mismatch.

These tools are designed for the developer. Tests are written in the PHP
language itself more or less as the application itself is built. The advantage
of using PHP itself as the testing language is that there are no new languages
to learn, testing can start straight away, and the developer can test any part
of the code. Basically, all parts that can be accessed by the application code
can also be accessed by the test code if they are in the same language. 
EOD;
$packagexml = new PEAR_PackageFileManager();
$e = $packagexml->setOptions(array('baseinstalldir' => 'simpletest', 'version' => '1.0.0', 'license' => 'The Open Group Test Suite License', 'packagedirectory' => '/var/www/html/tmp/simpletest', 'state' => 'stable', 'package' => 'simpletest', 'simpleoutput' => true, 'summary' => $shortDesc, 'description' => $longDesc, 'filelistgenerator' => 'file', 'notes' => 'See the CHANGELOG for full list of changes', 'dir_roles' => array('extensions' => 'php', 'test' => 'test'), 'ignore' => array('packages/', 'tutorials/', 'ui/', 'docs/', '*CVS*', 'TODO'), 'roles' => array('php' => 'php', 'html' => 'php', '*' => 'php'), 'exceptions' => array('VERSION' => 'doc', 'HELP_MY_TESTS_DONT_WORK_ANYMORE' => 'doc', 'LICENSE' => 'doc', 'README' => 'doc')));
if (is_a($e, 'PEAR_Error')) {
    echo $e->getMessage();
    die;
}
$e = $packagexml->addMaintainer('lastcraft', 'lead', 'Marcus Baker', '*****@*****.**');
if (is_a($e, 'PEAR_Error')) {
    echo $e->getMessage();
    exit;
}
$e = $packagexml->addMaintainer('tswicegood', 'developer', 'Travis Swicegood', '*****@*****.**');
if (is_a($e, 'PEAR_Error')) {
    echo $e->getMessage();
    exit;
}
$e = $packagexml->addMaintainer('jsweat', 'helper', 'Jason Sweat', '*****@*****.**');
if (is_a($e, 'PEAR_Error')) {
    echo $e->getMessage();
    exit;
}
$e = $packagexml->addMaintainer('pp11', 'helper', 'Perrick Penet', '*****@*****.**');
示例#3
0
            die("!! Paramètre obligatoire non renseigné.\n");
        }
    }
}
// Par défaut, on considère que le package se situe dans le réperoire courant
$pkg_dir = isset($opts_h['--packagedir']) ? $opts_h['--packagedir'] : $opts_h['p'];
$pkg_dir = isset($pkg_dir) ? $pkg_dir : getcwd();
echo "Looking for files in {$pkg_dir}...\n";
$pkgxml = new PEAR_PackageFileManager();
# -- Options
$e = $pkgxml->setOptions(array('baseinstalldir' => '/', 'package' => 'Blogmarks', 'version' => '0.1', 'summary' => 'Stop bookmarking, start blogmarking', 'description' => 'Soon to come...', 'license' => 'GPL', 'packagedirectory' => $pkg_dir, 'filelistgenerator' => 'cvs', 'state' => 'beta', 'notes' => 'first try', 'ignore' => array('make_pkg.php'), 'installexceptions' => array(), 'dir_roles' => array('Blogmarks/tutorials' => 'doc'), 'exceptions' => array()));
# -- Roles
$pkgxml->addRole('ini', 'php');
$pkgxml->addRole('dist', 'php');
# -- Maintainers
$pkgxml->addMaintainer('mbertier', 'lead', 'Tristan Rivoallan', '*****@*****.**');
$pkgxml->addMaintainer('benfle', 'developer', 'Benoit Fleury', '*****@*****.**');
# -- Dépendances
$pkgxml->addDependency('DB_DataObject', '1.5.3', 'ge', 'pkg');
$pkgxml->addDependency('HTTP_Request', '1.2', 'ge', 'pkg');
if (PEAR::isError($e)) {
    echo "*** Erreur: " . $e->getMessage() . "\n";
    exit;
}
/*
$e = $pkgxml->debugPackageFile( false );

if ( PEAR::isError($e) ) {
    echo "*** Erreur: ". $e->getMessage() . "\n";
    exit;
}
示例#4
0
<?php

/**
 * Net_growl package generator
 * @package Net_Growl
 */
require_once 'PEAR/PackageFileManager.php';
$version = '0.7.0';
$notes = <<<EOT
Initial release
EOT;
$description = <<<EOT
Growl is a MACOSX application that listen to notifications sent by 
applications and displays them on the desktop using different display 
styles. Net_Growl offers the possibility to send notifications to Growl 
from your PHP application through network communication using UDP.
EOT;
$package = new PEAR_PackageFileManager();
$e = $package->setOptions(array('package' => 'Net_Growl', 'summary' => 'Send notifications to Growl from PHP on MACOSX', 'description' => $description, 'version' => $version, 'state' => 'beta', 'license' => 'BSD', 'filelistgenerator' => 'file', 'ignore' => array('package.php', 'package.xml'), 'notes' => $notes, 'changelogoldtonew' => false, 'simpleoutput' => true, 'baseinstalldir' => 'Net', 'packagedirectory' => '/Volumes/doc/Dev/trunk/Bindings/php/Net_Growl'));
if (PEAR::isError($e)) {
    echo $e->getMessage();
    exit;
}
$package->addMaintainer('mansion', 'lead', 'Bertrand Mansion', '*****@*****.**');
$package->addDependency('PEAR', '1.3.3', 'ge', 'pkg', false);
$e = $package->writePackageFile();
if (PEAR::isError($e)) {
    echo $e->getMessage();
    exit;
}
echo "package.xml generated successfully!\n";
示例#5
0
    define('STDOUT', fopen('php://stdout', 'w'));
    define('STDERR', fopen('php://stderr', 'w'));
    register_shutdown_function(create_function('', 'fclose(STDOUT); fclose(STDERR); return true;'));
}
/**
* A giant array to configure the PackageFileManager. For the "roles" see
* http://pear.php.net/manual/en/developers.packagedef.php
*/
$options = array('baseinstalldir' => 'simpletest', 'version' => $version, 'packagedirectory' => $packagedir, 'outputdirectory' => $packagedir, 'pathtopackagefile' => $packagedir, 'state' => $state, 'summary' => $shortDesc, 'description' => $longDesc, 'filelistgenerator' => 'file', 'notes' => $releaseNotes, 'package' => 'SimpleTest', 'license' => 'The Open Group Test Suite License', 'dir_roles' => array('docs' => 'doc', 'test' => 'test', 'extensions' => 'php'), 'exceptions' => array('HELP_MY_TESTS_DONT_WORK_ANYMORE' => 'doc', 'LICENSE' => 'doc', 'README' => 'doc', 'TODO' => 'doc', 'VERSION' => 'doc'), 'ignore' => array("{$packagedir}/packages", "{$packagedir}/ui"));
$status = $PPFM->setOptions($options);
if (PEAR::isError($status)) {
    fwrite(STDERR, $status->getMessage());
    exit;
}
foreach ($maintainers as $maintainer) {
    $PPFM->addMaintainer($maintainer['handle'], $maintainer['role'], $maintainer['name'], $maintainer['email']);
}
// Adds a dependency of PHP 4.2.3+
$status = $PPFM->addDependency('php', '4.2.3', 'ge', 'php');
if (PEAR::isError($status)) {
    fwrite(STDERR, $status->getMessage());
    exit;
}
// hack (apparently)
$PPFM->addRole('tpl', 'php');
$PPFM->addRole('png', 'php');
$PPFM->addRole('gif', 'php');
$PPFM->addRole('jpg', 'php');
$PPFM->addRole('css', 'php');
$PPFM->addRole('js', 'php');
$PPFM->addRole('ini', 'php');
            die("!! Paramètre obligatoire non renseigné.\n");
        }
    }
}
// Par défaut, on considère que le package se situe dans le réperoire courant
$pkg_dir = isset($opts_h['--packagedir']) ? $opts_h['--packagedir'] : $opts_h['p'];
$pkg_dir = isset($pkg_dir) ? $pkg_dir : getcwd();
echo "Looking for files in {$pkg_dir}...\n";
$pkgxml = new PEAR_PackageFileManager();
# -- Options
$e = $pkgxml->setOptions(array('baseinstalldir' => '/', 'package' => 'MicroBuilder', 'version' => '0.1', 'summary' => 'MicroBuilder', 'description' => 'Soon to come...', 'license' => 'GPL', 'packagedirectory' => $pkg_dir, 'filelistgenerator' => 'cvs', 'state' => 'beta', 'notes' => 'first try', 'ignore' => array('make_pkg.php'), 'installexceptions' => array(), 'dir_roles' => array(), 'exceptions' => array()));
# -- Roles
$pkgxml->addRole('ini', 'php');
$pkgxml->addRole('dist', 'php');
# -- Maintainers
$pkgxml->addMaintainer('mbertier', 'lead', 'Tristan Rivoallan', '*****@*****.**');
# -- Dépendances
$pkgxml->addDependency('DB_DataObject', '1.5.3', 'ge', 'pkg');
$pkgxml->addDependency('HTTP_Request', '1.2', 'ge', 'pkg');
if (PEAR::isError($e)) {
    echo "*** Erreur: " . $e->getMessage() . "\n";
    exit;
}
/*
$e = $pkgxml->debugPackageFile( false );

if ( PEAR::isError($e) ) {
    echo "*** Erreur: ". $e->getMessage() . "\n";
    exit;
}
*/