[7849] | 1 | <?php
|
---|
| 2 |
|
---|
| 3 | require_once('PEAR/PackageFileManager2.php');
|
---|
| 4 |
|
---|
| 5 | PEAR::setErrorHandling(PEAR_ERROR_DIE);
|
---|
| 6 |
|
---|
| 7 | /**
|
---|
| 8 | * Package Options
|
---|
| 9 | */
|
---|
| 10 | $package = 'OCF';
|
---|
| 11 | $baseInstallDir = 'OCF';
|
---|
| 12 | $channel = 'pear.php.net';
|
---|
| 13 |
|
---|
| 14 | $description = 'Open Flash Charts interface library';
|
---|
| 15 | $dirRoles = array(
|
---|
| 16 | // dirname=> role
|
---|
| 17 | 'simpletest'=> 'test',
|
---|
| 18 | 'examples'=> 'data',
|
---|
| 19 | );
|
---|
| 20 |
|
---|
| 21 | $exceptions = array(
|
---|
| 22 | // filename=> role
|
---|
| 23 | 'build_package.php'=> 'data',
|
---|
| 24 | );
|
---|
| 25 |
|
---|
| 26 | $ignore = array(
|
---|
| 27 | // file|dir/
|
---|
| 28 | 'tmp/',
|
---|
| 29 | );
|
---|
| 30 |
|
---|
| 31 | $roles = array(
|
---|
| 32 | // fileext=> role
|
---|
| 33 | 'php'=> 'php',
|
---|
| 34 | );
|
---|
| 35 |
|
---|
| 36 | $category = 'Libraries';
|
---|
| 37 |
|
---|
| 38 | $license = 'PHP';
|
---|
| 39 | $notes = 'Helper library for working with Open Flash Charts';
|
---|
| 40 |
|
---|
| 41 | $version = '2.0.0';
|
---|
| 42 | $apiVersion = '2.0.0';
|
---|
| 43 |
|
---|
| 44 | $simpleoutput = true;
|
---|
| 45 | $state = 'beta';
|
---|
| 46 | $summary = 'Open Flash Charts interface library';
|
---|
| 47 |
|
---|
| 48 |
|
---|
| 49 | /**
|
---|
| 50 | * Package metadata
|
---|
| 51 | */
|
---|
| 52 |
|
---|
| 53 | $releaseStability = 'beta';
|
---|
| 54 | $apiStability = 'stable';
|
---|
| 55 |
|
---|
| 56 | $maintainers = array(
|
---|
| 57 | // role, username on PEAR.net,full name, email
|
---|
| 58 | array('lead', 'open-flash-chart', 'John Glazebrook', 'open-flash-chart@teethgrinder.co.uk'),
|
---|
| 59 | );
|
---|
| 60 |
|
---|
| 61 |
|
---|
| 62 |
|
---|
| 63 |
|
---|
| 64 | $packageSourceDirectory = dirname(__FILE__);
|
---|
| 65 |
|
---|
| 66 | $options = array(
|
---|
| 67 | 'baseinstalldir' => $baseInstallDir,
|
---|
| 68 | 'dir_roles' => $dirRoles,
|
---|
| 69 | 'exceptions' => $exceptions,
|
---|
| 70 | 'filelistgenerator' => 'File',
|
---|
| 71 | 'ignore' => $ignore,
|
---|
| 72 | 'packagedirectory' => $packageSourceDirectory,
|
---|
| 73 | 'pathtopackagefile' => dirname(__FILE__),
|
---|
| 74 | 'roles' => $roles,
|
---|
| 75 | 'simpleoutput' => $simpleoutput,
|
---|
| 76 | 'state' => $state,
|
---|
| 77 | 'version' => $version,
|
---|
| 78 | );
|
---|
| 79 |
|
---|
| 80 | $pkg = new PEAR_PackageFileManager2();
|
---|
| 81 |
|
---|
| 82 | handleError($pkg->setOptions($options));
|
---|
| 83 |
|
---|
| 84 | // Set misc package information
|
---|
| 85 | $pkg->setPackage($package);
|
---|
| 86 | $pkg->setSummary($summary);
|
---|
| 87 | $pkg->setDescription($description);
|
---|
| 88 | $pkg->setChannel($channel);
|
---|
| 89 |
|
---|
| 90 | $pkg->setReleaseStability($releaseStability);
|
---|
| 91 | $pkg->setAPIStability($apiStability);
|
---|
| 92 | $pkg->setReleaseVersion($version);
|
---|
| 93 | $pkg->setAPIVersion($apiVersion);
|
---|
| 94 |
|
---|
| 95 | $pkg->setLicense($license);
|
---|
| 96 | $pkg->setNotes($notes);
|
---|
| 97 |
|
---|
| 98 |
|
---|
| 99 |
|
---|
| 100 | $pkg->setPackageType('php');
|
---|
| 101 | $pkg->setPhpDep('5.0.0');
|
---|
| 102 | $pkg->setPearinstallerDep('1.4.9');
|
---|
| 103 |
|
---|
| 104 | // Require custom file role for our web installation
|
---|
| 105 | // $pkg->addPackageDepWithChannel('required', 'Role_Web', 'pearified.com');
|
---|
| 106 |
|
---|
| 107 | // Define that we will use our custom file role in this script
|
---|
| 108 | // $pkg->addUsesRole('web', 'Webfiles');
|
---|
| 109 |
|
---|
| 110 | // Create the current release and add it to the package definition
|
---|
| 111 | $pkg->addRelease();
|
---|
| 112 |
|
---|
| 113 | handleError($pkg->generateContents());
|
---|
| 114 |
|
---|
| 115 | // Package release needs a maintainer
|
---|
| 116 | foreach($maintainers as $m) {
|
---|
| 117 | handleError($pkg->addMaintainer($m[0], $m[1], $m[2], $m[3]));
|
---|
| 118 | }
|
---|
| 119 |
|
---|
| 120 | if($argv[1] === 'write') {
|
---|
| 121 | handleError($pkg->writePackageFile());
|
---|
| 122 | exit(1);
|
---|
| 123 | }
|
---|
| 124 |
|
---|
| 125 | handleError($pkg->debugPackageFile());
|
---|
| 126 |
|
---|
| 127 |
|
---|
| 128 | /**
|
---|
| 129 | * Simple error handler
|
---|
| 130 | *
|
---|
| 131 | * @param Exception $e
|
---|
| 132 | */
|
---|
| 133 | function handleError($e) {
|
---|
| 134 | if(PEAR::isError($e)) {
|
---|
| 135 | die($e->getMessage());
|
---|
| 136 | }
|
---|
| 137 | }
|
---|
| 138 |
|
---|