diff --git a/composer.json b/composer.json index a6a4bb8..b28c212 100644 --- a/composer.json +++ b/composer.json @@ -18,6 +18,10 @@ "require": { "php": ">=5.3.0" }, + "suggest": { + "ext-apc": ">=3.0.13", + "ext-wincache": ">=1.1.0" + }, "autoload": { "psr-0": { "PEAR2\\Cache\\SHM": "src/" diff --git a/docs/phpdoc.dist.xml b/docs/phpdoc.dist.xml index 7a53de5..80127e5 100644 --- a/docs/phpdoc.dist.xml +++ b/docs/phpdoc.dist.xml @@ -3,7 +3,7 @@ PEAR2_Cache_SHM documentation PEAR2_Cache_SHM - PEAR2_Cache_SHM__PhpDocumentor_Documentation + PEAR2_Cache_SHM__PhpDocumentor_Cache php diff --git a/extrasetup.php b/extrasetup.php index be68ddf..5eabfcd 100644 --- a/extrasetup.php +++ b/extrasetup.php @@ -12,6 +12,7 @@ new RecursiveDirectoryIterator( $pkg, RecursiveDirectoryIterator::UNIX_PATHS + | RecursiveDirectoryIterator::SKIP_DOTS ), RecursiveIteratorIterator::LEAVES_ONLY ) as $path diff --git a/package.xml b/package.xml index a928ff4..638efaf 100644 --- a/package.xml +++ b/package.xml @@ -11,8 +11,8 @@ boen.robot@gmail.com yes - 2013-05-04 - + 2013-08-15 + 0.1.2 0.1.0 @@ -29,7 +29,9 @@ - + + + @@ -132,6 +134,9 @@ + + + @@ -139,6 +144,7 @@ + diff --git a/packagexmlsetup.php b/packagexmlsetup.php index a5f927f..e3308c4 100644 --- a/packagexmlsetup.php +++ b/packagexmlsetup.php @@ -1,59 +1,38 @@ array( - array( - 'attribs' => array( - 'from' => '../src', - 'to' => 'php_dir', - 'type' => 'pear-config' - ) - ) - ) -); - -$srcFileTasks = array( - 'tasks:replace' => array( - array( - 'attribs' => array( - 'from' => '~~summary~~', - 'to' => 'summary', - 'type' => 'package-info' - ) - ), - array( - 'attribs' => array( - 'from' => '~~description~~', - 'to' => 'description', - 'type' => 'package-info' - ) - ), - array( - 'attribs' => array( - 'from' => 'GIT: $Id$', - 'to' => 'version', - 'type' => 'package-info' +$packageGen = function ( + v2 $package, + v2 $compatible = null +) { + $srcDirTask = array( + 'tasks:replace' => array( + array( + 'attribs' => array( + 'from' => '../src', + 'to' => 'php_dir', + 'type' => 'pear-config' + ) ) ) - ) -); - - -$package->files['tests/bootstrap.php'] = array_merge_recursive( - $package->files['tests/bootstrap.php']->getArrayCopy(), - $srcDirTask -); - -$package->files['docs/phpdoc.dist.xml'] = array_merge_recursive( - $package->files['docs/phpdoc.dist.xml']->getArrayCopy(), - $srcDirTask -); + ); -$package->files['docs/doxygen.ini'] = array_merge_recursive( - $package->files['docs/doxygen.ini']->getArrayCopy(), - $srcDirTask, - array( + $srcFileTasks = array( 'tasks:replace' => array( + array( + 'attribs' => array( + 'from' => '~~summary~~', + 'to' => 'summary', + 'type' => 'package-info' + ) + ), + array( + 'attribs' => array( + 'from' => '~~description~~', + 'to' => 'description', + 'type' => 'package-info' + ) + ), array( 'attribs' => array( 'from' => 'GIT: $Id$', @@ -62,73 +41,131 @@ ) ) ) - ) -); + ); + + $package->files['tests/bootstrap.php'] = array_merge_recursive( + $package->files['tests/bootstrap.php']->getArrayCopy(), + $srcDirTask + ); + + $package->files['docs/phpdoc.dist.xml'] = array_merge_recursive( + $package->files['docs/phpdoc.dist.xml']->getArrayCopy(), + $srcDirTask + ); + $package->files['docs/apigen.neon'] = array_merge_recursive( + $package->files['docs/apigen.neon']->getArrayCopy(), + $srcDirTask + ); -$hasCompatible = isset($compatible); -if ($hasCompatible) { - $compatible->license = $package->license; - $compatible->files[ - "test/{$package->channel}/{$package->name}/bootstrap.php" - ] = array_merge_recursive( - $compatible->files[ + $package->files['docs/doxygen.ini'] = array_merge_recursive( + $package->files['docs/doxygen.ini']->getArrayCopy(), + $srcDirTask, + array( + 'tasks:replace' => array( + array( + 'attribs' => array( + 'from' => 'GIT: $Id$', + 'to' => 'version', + 'type' => 'package-info' + ) + ) + ) + ) + ); + $hasCompatible = null !== $compatible; + if ($hasCompatible) { + $compatible->license = $package->license; + $compatible->files[ "test/{$package->channel}/{$package->name}/bootstrap.php" - ]->getArrayCopy(), - $srcDirTask - ); + ] = array_merge_recursive( + $compatible->files[ + "test/{$package->channel}/{$package->name}/bootstrap.php" + ]->getArrayCopy(), + $srcDirTask + ); - $compatible->files[ - "doc/{$package->channel}/{$package->name}/phpdoc.dist.xml" - ] = array_merge_recursive( - $compatible->files[ + $compatible->files[ "doc/{$package->channel}/{$package->name}/phpdoc.dist.xml" - ]->getArrayCopy(), - $srcDirTask - ); + ] = array_merge_recursive( + $compatible->files[ + "doc/{$package->channel}/{$package->name}/phpdoc.dist.xml" + ]->getArrayCopy(), + $srcDirTask + ); - $compatible->files["doc/{$package->channel}/{$package->name}/doxygen.ini"] - = array_merge_recursive( - $compatible->files[ - "doc/{$package->channel}/{$package->name}/doxygen.ini" - ]->getArrayCopy(), - $srcDirTask, - array( - 'tasks:replace' => array( - array( - 'attribs' => array( - 'from' => 'GIT: $Id$', - 'to' => 'version', - 'type' => 'package-info' + $compatible->files["doc/{$package->channel}/{$package->name}/doxygen.ini"] + = array_merge_recursive( + $compatible->files[ + "doc/{$package->channel}/{$package->name}/doxygen.ini" + ]->getArrayCopy(), + $srcDirTask, + array( + 'tasks:replace' => array( + array( + 'attribs' => array( + 'from' => 'GIT: $Id$', + 'to' => 'version', + 'type' => 'package-info' + ) ) ) ) - ) - ); -} + ); + } -$oldCwd = getcwd(); -chdir(__DIR__); -foreach ( - new RecursiveIteratorIterator( - new RecursiveDirectoryIterator( - 'src', - RecursiveDirectoryIterator::UNIX_PATHS - ), - RecursiveIteratorIterator::LEAVES_ONLY - ) as $path) { - $filename = $path->getPathname(); - - $package->files[$filename] = array_merge_recursive( - $package->files[$filename]->getArrayCopy(), - $srcFileTasks - ); - - if ($hasCompatible) { - $compatibleFilename = str_replace('src/', 'php/', $filename); - $compatible->files[$compatibleFilename] = array_merge_recursive( - $compatible->files[$compatibleFilename]->getArrayCopy(), - $srcFileTasks - ); + $oldCwd = getcwd(); + chdir(__DIR__); + foreach ( + new RecursiveIteratorIterator( + new RecursiveDirectoryIterator( + 'src', + RecursiveDirectoryIterator::UNIX_PATHS + | RecursiveDirectoryIterator::SKIP_DOTS + ), + RecursiveIteratorIterator::LEAVES_ONLY + ) as $path) { + $filename = $path->getPathname(); + + $package->files[$filename] = array_merge_recursive( + $package->files[$filename]->getArrayCopy(), + $srcFileTasks + ); + + if ($hasCompatible) { + $compatibleFilename = str_replace('src/', 'php/', $filename); + $compatible->files[$compatibleFilename] = array_merge_recursive( + $compatible->files[$compatibleFilename]->getArrayCopy(), + $srcFileTasks + ); + } + } + + foreach ( + new RecursiveIteratorIterator( + new RecursiveDirectoryIterator( + '.', + RecursiveDirectoryIterator::UNIX_PATHS + | RecursiveDirectoryIterator::SKIP_DOTS + ), + RecursiveIteratorIterator::LEAVES_ONLY + ) as $path) { + $filename = substr($path->getPathname(), 2); + + if (isset($package->files[$filename])) { + $as = (strpos($filename, 'examples') === 0) + ? $filename + : substr($filename, strpos($filename, '/') + 1); + $package->getReleaseToInstall('php')->installAs($filename, $as); + } } + chdir($oldCwd); + return array($package, $compatible); +}; + +list($package, $compatible) = $packageGen( + $package, + isset($compatible) ? $compatible : null +); +if (null === $compatible) { + unset($compatible); } -chdir($oldCwd); diff --git a/stub.php b/stub.php index eee0eae..6827a87 100644 --- a/stub.php +++ b/stub.php @@ -10,19 +10,19 @@ header('Content-Type: text/plain;charset=UTF-8'); } echo "@PACKAGE_NAME@ @PACKAGE_VERSION@\n"; - + if (version_compare(phpversion(), '5.3.0', '<')) { echo "\nThis package requires PHP 5.3.0 or later."; exit(1); } - + $available_extensions = array(); foreach (array('apc', 'wincache') as $ext) { if (extension_loaded($ext)) { $available_extensions[] = $ext; } } - + if (extension_loaded('phar')) { try { $phar = new Phar(__FILE__); @@ -47,7 +47,7 @@ HEREDOC; } - + if (in_array('apc', $available_extensions)) { if (version_compare(phpversion('apc'), '3.0.13', '>=')) { echo "A compatible APC version is available on this server.\n"; @@ -60,7 +60,7 @@ echo "\n"; } } - + if (in_array('wincache', $available_extensions)) { if (version_compare(phpversion('wincache'), '1.1.0', '>=')) { echo "A compatible WinCache version is available on this server.\n"; @@ -73,7 +73,7 @@ echo "\n"; } } - + if ($isHttp) { if (empty($available_extensions)) { echo "You don't have any compatible extensions for this SAPI (",