Skip to content

Commit

Permalink
Fix package groups (#25)
Browse files Browse the repository at this point in the history
* Added fix for shell exec and composer lock packages

* Added fix for shell exec and composer lock packages

* Updated coverage paths

* Updated coverage paths

---------

Co-authored-by: di.martinsr <martins.rucevskis@di.lv>
  • Loading branch information
MartinsRucevskis and di.martinsr authored Jan 9, 2024
1 parent e5fcf0d commit 9edbb1a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/ComposerJsonFromLockBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function versionsFromLock(array $originalVersionPrefixes): string

foreach ($requirementPrefixes as $prefix) {
$packageNames = $this->packageNames($composerJson, $prefix);
$composerLockPackages = $composerLock['packages' . $prefix];
$composerLockPackages = array_merge($composerLock['packages'], $composerLock['packages-dev']);
$usedPackagesFromLock = array_filter($composerLockPackages, fn ($package): bool => in_array($package['name'], $packageNames));
$usedPackageVersions = array_column($usedPackagesFromLock, 'version', 'name');

Expand Down
11 changes: 7 additions & 4 deletions src/ComposerUpdater.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@

class ComposerUpdater
{
/**
* @throws ExecException
*/
public function updateComposer(): string
{
return shell_exec('composer update');
try {
$output = shell_exec('composer update');
} catch (ExecException $e) {
$output = 'Shell exec didn\'t finish correctly.';
}

return $output;
}
}

0 comments on commit 9edbb1a

Please sign in to comment.