<?php
/**
 * script to automate the generation of the
 * package.xml file.
 * 
 * Originally writted by Stephan Schmidt <schst@php-tools.net>
 *
 * @author      Joshua May
 * @package     sfPropel13Plugin
 */

require_once 'PEAR/PackageFileManager2.php';

/**
 * Base version
 */
$baseVersion = '0.6.0';

/**
 * current version
 */
$version    = $baseVersion;
$dir        = dirname( __FILE__ );

/**
 * Current API version
 */
$apiVersion = '0.6.0';

/**
 * current state
 */
$state = 'beta';

/**
 * current API stability
 */
$apiStability = 'beta';

/**
 * release notes
 */
$notes = <<<EOT
--
EOT;

/**
 * package description
 */
$description = <<<EOT
sfPropel13Plugin instroduces Propel 1.3 (beta) functionality into symfony 1.0. It *should* work without modifying
any core libraries, thus offering greater stability (despite being beta, it's now using PDO instead of Creole), and
immensely improved performance.
EOT;

$package = new PEAR_PackageFileManager2();

$result = $package->setOptions(array(
    'filelistgenerator' => 'file',
    'ignore'            => array('autopackage2.php', 'package.xml', '.svn'),
    'simpleoutput'      => true,
    'baseinstalldir'    => '/',
    'packagedirectory'  => $dir,
    'dir_roles'         => array(
                                 'docs' => 'doc',
                                 'examples' => 'doc',
                                 'tests' => 'test',
                                 )
    ));
if (PEAR::isError($result)) {
    echo $result->getMessage();
    die();
}

$package->setPackage('sfPropel13Plugin');
$package->setSummary('Propel 1.3 (beta) functionality in symfony 1.0');
$package->setDescription($description);

$package->setChannel('pear.symfony-project.com');
$package->setAPIVersion($apiVersion);
$package->setReleaseVersion($version);
$package->setReleaseStability($state);
$package->setAPIStability($apiStability);
$package->setNotes($notes);
$package->setPackageType('php');
$package->setLicense('MIT License', 'http://www.symfony-project.com/license');

$package->addMaintainer('lead', 'notjosh', 'Joshua May', 'josh@notjosh.com', 'yes');

$package->setPhpDep('5.2.0');
$package->setPearinstallerDep('1.4.1');

$package->addPackageDepWithChannel(
	'required',
    'symfony',
	'pear.symfony-project.com',
    '1.0.0',
	'1.1.0',
	false,
	'1.1.0');


$package->generateContents();

$result = $package->writePackageFile();

if (PEAR::isError($result)) {
    echo $result->getMessage();
    die();
}