Skip to content

Commit

Permalink
Merge pull request #127 from php-etl/fix/composer-from-local
Browse files Browse the repository at this point in the history
fix composer.from_local
  • Loading branch information
clemzarch authored Sep 14, 2023
2 parents 85404bf + cba0155 commit 89ed54f
Show file tree
Hide file tree
Showing 7 changed files with 534 additions and 600 deletions.
1,102 changes: 531 additions & 571 deletions composer.lock

Large diffs are not rendered by default.

14 changes: 0 additions & 14 deletions src/Adapter/Composer.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,20 +174,6 @@ public function autoload(array $autoloads): void
file_put_contents($this->workdir.'/composer.json', json_encode($composer, \JSON_PRETTY_PRINT | \JSON_UNESCAPED_SLASHES));
}

public function install(): void
{
$this->command(
'composer',
'install',
'--prefer-dist',
'--no-progress',
'--prefer-stable',
'--sort-packages',
'--optimize-autoloader',
'--no-dev',
);
}

public function addGithubRepository(string $name, string $url): void
{
$this->command(
Expand Down
3 changes: 0 additions & 3 deletions src/Adapter/Docker/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,6 @@ public function __invoke(array $configuration): Configurator\SatelliteBuilderInt
} else {
$builder->withComposerFile(new Packaging\Asset\LocalFile('composer.json'));
}
if (file_exists('vendor')) {
$builder->withDirectory(new Packaging\Directory('vendor/'));
}
}

if (\array_key_exists('autoload', $configuration['composer']) && \array_key_exists('psr4', $configuration['composer']['autoload'])) {
Expand Down
1 change: 0 additions & 1 deletion src/Adapter/Docker/SatelliteBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,6 @@ public function build(): Configurator\SatelliteInterface
}

$dockerfile->push(new Dockerfile\PHP\Composer());
$dockerfile->push(new Dockerfile\PHP\ComposerInstall());
} else {
$dockerfile->push(new Dockerfile\PHP\Composer());
$dockerfile->push(new Dockerfile\PHP\ComposerInit(sprintf('satellite/%s', substr(hash('sha512', random_bytes(64)), 0, 64))));
Expand Down
9 changes: 3 additions & 6 deletions src/Adapter/Filesystem/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,14 @@ public function __invoke(array $configuration): Configurator\SatelliteBuilderInt
if (\array_key_exists('from_local', $configuration['composer']) && true === $configuration['composer']['from_local']) {
if (file_exists('composer.lock')) {
$builder->withComposerFile(
new Packaging\Asset\LocalFile('composer.json'),
new Packaging\Asset\LocalFile('composer.lock'),
new Packaging\File('composer.json', new Packaging\Asset\LocalFile('composer.json')),
new Packaging\File('composer.lock', new Packaging\Asset\LocalFile('composer.lock')),
);
} else {
$builder->withComposerFile(
new Packaging\Asset\LocalFile('composer.json'),
new Packaging\File('composer.json', new Packaging\Asset\LocalFile('composer.json')),
);
}
if (file_exists('vendor')) {
$builder->withDirectory(new Packaging\Directory('vendor/'));
}
}

if (\array_key_exists('autoload', $configuration['composer']) && \array_key_exists('psr4', $configuration['composer']['autoload'])) {
Expand Down
2 changes: 0 additions & 2 deletions src/Adapter/Filesystem/SatelliteBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,6 @@ public function build(): Configurator\SatelliteInterface
if (null !== $this->composerLockFile) {
$satellite->withFile($this->composerLockFile);
}

$composer->install();
} else {
$composer->init(sprintf('satellite/%s', substr(hash('sha512', random_bytes(64)), 0, 64)));
$composer->minimumStability('dev');
Expand Down
3 changes: 0 additions & 3 deletions src/Adapter/Tar/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ public function __invoke(array $configuration): Configurator\SatelliteBuilderInt
} else {
$builder->withComposerFile(new Packaging\Asset\LocalFile('composer.json'));
}
if (file_exists('vendor')) {
$builder->withDirectory(new Packaging\Directory('vendor/'));
}
}

if (\array_key_exists('autoload', $configuration['composer']) && \array_key_exists('psr4', $configuration['composer']['autoload'])) {
Expand Down

0 comments on commit 89ed54f

Please sign in to comment.