Skip to content

Commit 42aefe6

Browse files
committed
Added COMPOSER env var support for ct php:composer
1 parent 00b9693 commit 42aefe6

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/app/CliTools/Console/Command/Php/ComposerCommand.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,21 +51,27 @@ public function execute(InputInterface $input, OutputInterface $output)
5151
{
5252
$paramList = $this->getFullParameterList();
5353

54+
// Get composer.json from env variable
55+
$composerJson = getenv('COMPOSER');
56+
if (empty($composerJson)) {
57+
$composerJson = 'composer.json';
58+
}
59+
5460
if ($this->checkIfComposerJsonIsNeeded($paramList)) {
55-
$composerJsonPath = UnixUtility::findFileInDirectortyTree('composer.json');
61+
$composerJsonPath = UnixUtility::findFileInDirectortyTree($composerJson);
5662

5763
if (!empty($composerJsonPath)) {
5864
// composer.json found
5965

6066
$path = dirname($composerJsonPath);
61-
$this->output->writeln('<comment>Found composer.json directory: ' . $path . '</comment>');
67+
$this->output->writeln('<comment>Found ' . $composerJson . ' directory: ' . $path . '</comment>');
6268
// Switch to directory of docker-compose.yml
6369
PhpUtility::chdir($path);
6470

6571
return $this->runComposer($paramList);
6672
} else {
6773
// no composer.json found but try to run the command anyway
68-
$this->output->writeln('<warning>No composer.json found in tree</warning>');
74+
$this->output->writeln('<warning>No ' . $composerJson . ' found in tree</warning>');
6975
return $this->runComposer($paramList);
7076
}
7177
} else {

0 commit comments

Comments
 (0)