Skip to content

Commit a86cb69

Browse files
committed
Composer 1 support
1 parent 863a2a0 commit a86cb69

File tree

4 files changed

+12
-5
lines changed

4 files changed

+12
-5
lines changed

src/Command/UpdateRecipesCommand.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
use Composer\Command\BaseCommand;
1515
use Composer\IO\IOInterface;
16-
use Composer\Util\HttpDownloader;
1716
use Symfony\Component\Console\Exception\RuntimeException;
1817
use Symfony\Component\Console\Formatter\OutputFormatterStyle;
1918
use Symfony\Component\Console\Input\InputArgument;
@@ -38,7 +37,7 @@ class UpdateRecipesCommand extends BaseCommand
3837
private $rootDir;
3938
private $githubApi;
4039

41-
public function __construct(/* cannot be type-hinted */ $flex, Downloader $downloader, HttpDownloader $httpDownloader, Configurator $configurator, string $rootDir)
40+
public function __construct(/* cannot be type-hinted */ $flex, Downloader $downloader, $httpDownloader, Configurator $configurator, string $rootDir)
4241
{
4342
$this->flex = $flex;
4443
$this->downloader = $downloader;

src/GithubApi.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,14 @@
1212
namespace Symfony\Flex;
1313

1414
use Composer\Util\HttpDownloader;
15+
use Composer\Util\RemoteFilesystem;
1516

1617
class GithubApi
1718
{
19+
/** @var HttpDownloader|RemoteFilesystem */
1820
private $downloader;
1921

20-
public function __construct(HttpDownloader $downloader)
22+
public function __construct($downloader)
2123
{
2224
$this->downloader = $downloader;
2325
}

src/Update/RecipePatcher.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ public function applyPatch(RecipePatch $patch): bool
5353

5454
$output = '';
5555
$statusCode = $this->processExecutor->execute('git apply "_flex_recipe_update.patch" -3', $output, $this->rootDir);
56-
$this->io->debug('git apply output: '.$output);
5756

5857
if (0 === $statusCode) {
5958
// successful with no conflicts

tests/Command/UpdateRecipesCommandTest.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use Composer\Factory;
1515
use Composer\IO\BufferIO;
16+
use Composer\Plugin\PluginInterface;
1617
use Composer\Util\Platform;
1718
use PHPUnit\Framework\TestCase;
1819
use Symfony\Component\Console\Application;
@@ -24,6 +25,7 @@
2425
use Symfony\Flex\Downloader;
2526
use Symfony\Flex\Flex;
2627
use Symfony\Flex\Options;
28+
use Symfony\Flex\ParallelDownloader;
2729

2830
class UpdateRecipesCommandTest extends TestCase
2931
{
@@ -86,7 +88,12 @@ private function createCommandUpdateRecipes(): CommandTester
8688
$composer = (new Factory())->createComposer($this->io, null, false, FLEX_TEST_DIR);
8789
$flex = new Flex();
8890
$flex->activate($composer, $this->io);
89-
$rfs = Factory::createHttpDownloader($this->io, $composer->getConfig());
91+
if (version_compare('2.0.0', PluginInterface::PLUGIN_API_VERSION, '<=')) {
92+
$rfs = Factory::createHttpDownloader($this->io, $composer->getConfig());
93+
} else {
94+
$rfs = Factory::createRemoteFilesystem($this->io, $composer->getConfig());
95+
$rfs = new ParallelDownloader($this->io, $composer->getConfig(), $rfs->getOptions(), $rfs->isTlsDisabled());
96+
}
9097
$options = new Options(['root-dir' => FLEX_TEST_DIR]);
9198
$command = new UpdateRecipesCommand(
9299
$flex,

0 commit comments

Comments
 (0)