Commit 9ecbb7df authored by Bas de Nooijer's avatar Bas de Nooijer

Merge branch 'develop' of github.com:solariumphp/solarium into thomascorthals-develop

parents 906c76b6 cf4843c6
build
phpunit.xml
composer.phar
composer.lock
vendor
/build
/phpunit.xml
/composer.phar
/composer.lock
/vendor
/phar/solarium.phar
......@@ -49,27 +49,36 @@ $strip = (isset($options['s']) && $options['s'] == '1');
$start = microtime(true);
// Create a new Solarium phar file
// Create a new Solarium PHAR file.
@unlink('solarium.phar');
$phar = new Phar('solarium.phar', 0, 'solarium.phar');
$phar->setStub(file_get_contents("stub.php"));
$phar->setStub(file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . 'stub.php'));
$phar->setSignatureAlgorithm(Phar::SHA1);
// Add files to the phar
$basePath = realpath(__DIR__."/../library/Solarium");
if ($strip) {
$directoryIterator = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator($basePath),
// Add files to the PHAR.
$basePath = dirname(__DIR__);
$directoryIterator = new AppendIterator();
$directoryIterator->append(
new RecursiveIteratorIterator(
new RecursiveDirectoryIterator($basePath . DIRECTORY_SEPARATOR . 'library'),
RecursiveIteratorIterator::SELF_FIRST
)
);
$directoryIterator->append(
new RecursiveIteratorIterator(
new RecursiveDirectoryIterator($basePath . DIRECTORY_SEPARATOR . 'vendor'),
RecursiveIteratorIterator::SELF_FIRST
);
)
);
if ($strip) {
foreach ($directoryIterator as $file) {
if (preg_match('/\\.php$/i', $file)) {
if (0 !== preg_match('/\\.php$/i', $file)) {
$phar->addFromString(substr($file, strlen($basePath) + 1), php_strip_whitespace($file));
}
}
} else {
$phar->buildFromDirectory($basePath, '/\.php$/');
$phar->buildFromIterator($directoryIterator, $basePath);
}
// Create compressed versions
......@@ -79,4 +88,4 @@ if ($compress) {
}
$time = round(microtime(true)-$start, 5);
echo "\nDONE ($time seconds)\n\n";
echo "\nDONE ($time seconds)\nsolarium.phar has been created.\n\n";
......@@ -34,7 +34,7 @@
*/
Phar::mapPhar("solarium.phar");
require_once 'phar://solarium.phar/Autoloader.php';
require_once 'phar://solarium.phar/vendor/autoload.php';
\Solarium\Autoloader::register();
if ('cli' === php_sapi_name() && basename(__FILE__) === basename($_SERVER['argv'][0]) && isset($_SERVER['argv'][1])) {
......@@ -46,9 +46,8 @@ if ('cli' === php_sapi_name() && basename(__FILE__) === basename($_SERVER['argv'
break;
default:
echo "Unknown command '" . $_SERVER['argv'][1] . "' (Supported commands: version)\n";
echo 'Unknown command \'' . $_SERVER['argv'][1] . '\' (Supported commands: version)' . "\n";
}
}
__HALT_COMPILER();
?>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment