Skip to content

Commit

Permalink
Made extrasetup.php mode flexible.
Browse files Browse the repository at this point in the history
  • Loading branch information
boenrobot committed Aug 2, 2012
1 parent 604f2ef commit e9e205b
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
28 changes: 24 additions & 4 deletions extrasetup.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,28 @@
<?php
$extrafiles = array();

$phpDir = Pyrus\Config::current()->php_dir . DIRECTORY_SEPARATOR;
$packages = array('PEAR2/Autoload');

$PEAR2_Autoload_Path = 'PEAR2/Autoload.php';
$extrafiles = array(
'src/' . $PEAR2_Autoload_Path => $phpDir . $PEAR2_Autoload_Path
);
foreach ($packages as $pkg) {
$prefix = $phpDir . $pkg;

if (is_dir($prefix)) {
foreach (
new RecursiveIteratorIterator(
new RecursiveDirectoryIterator(
$prefix,
RecursiveDirectoryIterator::UNIX_PATHS
),
RecursiveIteratorIterator::LEAVES_ONLY
) as $path
) {
$pathname = $path->getPathname();
$extrafiles['src/' . $pathname] = $pathname;
}
}

if (is_file($prefix . '.php')) {
$extrafiles['src/' . $pkg . '.php'] = $prefix . '.php';
}
}
1 change: 1 addition & 0 deletions packagexmlsetup.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@
$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(
Expand Down

0 comments on commit e9e205b

Please sign in to comment.