Changeset View
Changeset View
Standalone View
Standalone View
scripts/arcanist.php
#!/usr/bin/env php | #!/usr/bin/env php | ||||
<?php | <?php | ||||
sanity_check_environment(); | sanity_check_environment(); | ||||
require_once dirname(__FILE__).'/__init_script__.php'; | require_once __DIR__.'/__init_script__.php'; | ||||
/** | /** | ||||
* Adjust 'include_path' to add locations where we'll search for libraries. | * Adjust 'include_path' to add locations where we'll search for libraries. | ||||
* We look in these places: | * We look in these places: | ||||
* | * | ||||
* - Next to 'arcanist/'. | * - Next to 'arcanist/'. | ||||
* - Anywhere in the normal PHP 'include_path'. | * - Anywhere in the normal PHP 'include_path'. | ||||
* - Inside 'arcanist/externals/includes/'. | * - Inside 'arcanist/externals/includes/'. | ||||
*/ | */ | ||||
function arcanist_adjust_php_include_path() { | function arcanist_adjust_php_include_path() { | ||||
// The 'arcanist/' directory. | // The 'arcanist/' directory. | ||||
$arcanist_dir = dirname(dirname(__FILE__)); | $arcanist_dir = dirname(__DIR__); | ||||
// The parent directory of 'arcanist/'. | // The parent directory of 'arcanist/'. | ||||
$parent_dir = dirname($arcanist_dir); | $parent_dir = dirname($arcanist_dir); | ||||
// The 'arcanist/externals/includes/' directory. | // The 'arcanist/externals/includes/' directory. | ||||
$include_dir = implode( | $include_dir = implode( | ||||
DIRECTORY_SEPARATOR, | DIRECTORY_SEPARATOR, | ||||
array( | array( | ||||
▲ Show 20 Lines • Show All 655 Lines • ▼ Show 20 Lines | try { | ||||
// This means we only execute code in the `arcanist/` directory which is | // This means we only execute code in the `arcanist/` directory which is | ||||
// associated with the binary you are running, whereas we would normally | // associated with the binary you are running, whereas we would normally | ||||
// execute local code. | // execute local code. | ||||
// This can make `arc` development slightly confusing if your setup is | // This can make `arc` development slightly confusing if your setup is | ||||
// especially bizarre, but it allows `arc` to be used in automation | // especially bizarre, but it allows `arc` to be used in automation | ||||
// workflows more easily. For some context, see PHI13. | // workflows more easily. For some context, see PHI13. | ||||
$executing_directory = dirname(dirname(__FILE__)); | $executing_directory = dirname(__DIR__); | ||||
$working_directory = dirname($location); | $working_directory = dirname($location); | ||||
fwrite( | fwrite( | ||||
STDERR, | STDERR, | ||||
tsprintf( | tsprintf( | ||||
"**<bg:yellow> %s </bg>** %s\n", | "**<bg:yellow> %s </bg>** %s\n", | ||||
pht('VERY META'), | pht('VERY META'), | ||||
pht( | pht( | ||||
Show All 10 Lines |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0