Skip to content

Commit

Permalink
Remove DaemonUtils, update autoloader locator
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelbausor committed Mar 5, 2018
1 parent f980c8d commit d72266f
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 56 deletions.
20 changes: 15 additions & 5 deletions Core/bin/google-cloud-batch
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,25 @@

namespace Google\Cloud\Core\Batch;

use Google\Cloud\Core\Daemon\DaemonUtils;
$foundAutoloader = false;
$autoloaderCandidates = [
'/../vendor/autoload.php', // Git clone of google-cloud-php-core
'/../../vendor/autoload.php', // Git clone of google-cloud-php
'/../../../autoload.php', // google/cloud-core installation
'/../../../../autoload.php', // google/cloud installation
];
foreach ($autoloaderCandidates as $candidate) {
if (file_exists($candidate)) {
require_once $candidate;
$foundAutoloader = true;
break;
}
}

$autoloader = DaemonUtils::locateAutoloader(__DIR__ . '/..');
if (is_null($autoloader)) {
if (!$foundAutoloader) {
die('No autoloader found');
}

require_once $autoloader;

function showUsageAndDie()
{
die("usage: " . __FILE__ . " [daemon|retry] {id}");
Expand Down
46 changes: 0 additions & 46 deletions Core/src/Daemon/DaemonUtils.php

This file was deleted.

20 changes: 15 additions & 5 deletions Debugger/bin/google-cloud-debugger
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,25 @@

namespace Google\Cloud\Debugger;

use Google\Cloud\Core\Daemon\DaemonUtils;
$foundAutoloader = false;
$autoloaderCandidates = [
'/../vendor/autoload.php', // Git clone of google-cloud-php-debugger
'/../../vendor/autoload.php', // Git clone of google-cloud-php
'/../../../autoload.php', // google/cloud-debugger installation
'/../../../../autoload.php', // google/cloud installation
];
foreach ($autoloaderCandidates as $candidate) {
if (file_exists($candidate)) {
require_once $candidate;
$foundAutoloader = true;
break;
}
}

$autoloader = DaemonUtils::locateAutoloader(__DIR__ . '/..');
if (is_null($autoloader)) {
if (!$foundAutoloader) {
die('No autoloader found');
}

require_once $autoloader;

function showUsageAndDie()
{
$filename = basename(__FILE__);
Expand Down

0 comments on commit d72266f

Please sign in to comment.