mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-22 23:02:42 +01:00
23786784ef
Summary: Adds the Balanced PHP API to externals/. Ref T2787. Test Plan: Used in next diff. Reviewers: btrahan, chad Reviewed By: chad CC: aran, aurelijus Maniphest Tasks: T2787 Differential Revision: https://secure.phabricator.com/D5764
36 lines
No EOL
1 KiB
PHP
Executable file
36 lines
No EOL
1 KiB
PHP
Executable file
#!/usr/bin/php
|
|
<?php
|
|
include('src/Balanced/Settings.php');
|
|
|
|
function exit_unless($condition, $msg = null) {
|
|
if ($condition)
|
|
return;
|
|
echo "[FAIL] $msg";
|
|
exit(1);
|
|
}
|
|
|
|
echo "Building Phar... ";
|
|
$base_dir = dirname(__FILE__);
|
|
$source_dir = $base_dir . '/src/Balanced/';
|
|
$phar_name = 'balanced.phar';
|
|
$phar_path = $base_dir . '/' . $phar_name;
|
|
$phar = new Phar($phar_path, 0, $phar_name);
|
|
$stub = <<<HEREDOC
|
|
<?php
|
|
// Phar Stub File
|
|
Phar::mapPhar('balanced.phar');
|
|
include('phar://balanced.phar/Balanced/Bootstrap.php');
|
|
\Balanced\Bootstrap::pharInit();
|
|
|
|
__HALT_COMPILER();
|
|
HEREDOC;
|
|
$phar->setStub($stub);
|
|
exit_unless($phar, "Unable to create a phar. Make sure you have phar.readonly=0 set in your ini file.");
|
|
$phar->buildFromDirectory(dirname($source_dir));
|
|
echo "[ OK ]\n";
|
|
|
|
echo "Renaming Phar... ";
|
|
$phar_versioned_name = 'balanced-' . \Balanced\Settings::VERSION . '.phar';
|
|
$phar_versioned_path = $base_dir . '/' . $phar_versioned_name;
|
|
rename($phar_path, $phar_versioned_path);
|
|
echo "[ OK ]\n"; |