Skip to content

Commit c948ea3

Browse files
authored
Added support for composer v2 installed.json format + composer.phar fix (#2031)
* fix composer v2 installed.json parsing * add changelog * only use bin/php on phar file * update chagnelog * Update dep
1 parent 7d090af commit c948ea3

3 files changed

Lines changed: 7 additions & 3 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
- Fixed backward compatibility of bin/console for symfony4 recipe
1818
- Keep consistency with executable naming in lock recipe
1919
- Unexpected exception in config:* tasks when no stage is defined for host [#1909] [#1909] [#1909]
20+
- Fixed parsing of installed.json by Composer version 2
21+
- Fixed only call bin/php on the composer.phar file
2022

2123

2224
## v6.7.3

‎bin/dep‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,9 @@ $version = 'master';
106106

107107
$installedFile = $vendorDir . '/composer/installed.json';
108108
if (is_readable($installedFile)) {
109-
$packages = json_decode(file_get_contents($installedFile), true);
109+
$installed = json_decode(file_get_contents($installedFile), true);
110+
$packages = $installed['packages'] ?? $installed;
111+
110112
foreach ($packages as $package) {
111113
if ($package['name'] === 'deployer/deployer') {
112114
$version = $package['version'];

‎recipe/common.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,10 @@
118118

119119
if (empty($composer)) {
120120
run("cd {{release_path}} && curl -sS https://getcomposer.org/installer | {{bin/php}}");
121-
$composer = '{{release_path}}/composer.phar';
121+
$composer = '{{bin/php}} {{release_path}}/composer.phar';
122122
}
123123

124-
return '{{bin/php}} ' . $composer;
124+
return $composer;
125125
});
126126

127127
set('bin/symlink', function () {

0 commit comments

Comments
 (0)