Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom binary location #47

Merged
merged 2 commits into from
Jan 8, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion phpqa
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,26 @@ if (file_exists(__DIR__ . '/vendor/autoload.php')) {
define('COMPOSER_BINARY_DIR', __DIR__ . "/vendor/bin/");
require_once __DIR__ . '/vendor/autoload.php';
} elseif (file_exists(__DIR__ . '/../../autoload.php')) {
define('COMPOSER_BINARY_DIR', __DIR__ . "/../../bin/");
$projectRoot = __DIR__ . '/../../..';
$binPaths = [
"{$projectRoot}/vendor/bin",
"{$projectRoot}/bin",
$projectRoot,
"{$projectRoot}/" . getenv('COMPOSER_BIN_DIR'),
];
foreach ($binPaths as $bin) {
if (is_file("{$bin}/phploc")) {
define('COMPOSER_BINARY_DIR', "{$bin}/");
break;
}
}
require_once __DIR__ . '/../../autoload.php';
}

if (!defined('COMPOSER_BINARY_DIR') || !is_file(COMPOSER_BINARY_DIR . 'phploc')) {
die("Composer binary directory was not found (define path in environment variable 'COMPOSER_BIN_DIR')\n");
}

/**
* RoboFile is in phpqa repository, but analysis is runned in cwd.
* Robo\Runner:loadRoboFile calls chdir when option --load-from=__DIR__
Expand Down