Skip to content

Commit da8e557

Browse files
committed
fixes thanks to Nicolas
1 parent acd3b0f commit da8e557

File tree

2 files changed

+12
-19
lines changed

2 files changed

+12
-19
lines changed

src/Downloader.php

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@
2929
class Downloader
3030
{
3131
private const DEFAULT_ENDPOINTS = [
32-
// TODO: REVERT THIS
33-
'https://raw.githubusercontent.com/weaverryan/recipes/flex/main/index.json',
32+
'https://raw.githubusercontent.com/symfony/recipes/flex/main/index.json',
3433
'https://raw.githubusercontent.com/symfony/recipes-contrib/flex/main/index.json',
3534
];
3635
private const MAX_LENGTH = 1000;
@@ -183,21 +182,15 @@ public function getRecipes(array $operations): array
183182
$data['locks'][$package->getName()]['version'] = $version;
184183
$data['locks'][$package->getName()]['recipe']['version'] = $v;
185184

186-
if (null !== $recipeRef) {
187-
// TODO: add a new archived_recipe_template to _links
188-
$endpointRoot = substr(
189-
$this->endpoints[$endpoint]['_links']['recipe_template'],
190-
0,
191-
strpos($this->endpoints[$endpoint]['_links']['recipe_template'], '{package_dotted}')
192-
);
193-
// TODO: remove - just for testing
194-
$endpointRoot = str_replace('symfony/recipes', 'weaverryan/recipes', $endpointRoot);
195-
$urls[] = sprintf(
196-
'%sarchived/%s/%s.json',
197-
$endpointRoot,
198-
str_replace('/', '.', $package->getName()),
199-
$recipeRef
200-
);
185+
if (null !== $recipeRef && isset($this->endpoints[$endpoint]['_links']['archived_recipes_template'])) {
186+
$url = strtr($this->endpoints[$endpoint]['_links']['archived_recipes_template'], [
187+
'{package_dotted}' => str_replace('/', '.', $package->getName()),
188+
'{ref}' => $recipeRef,
189+
]);
190+
191+
// TODO: remove once symfony/recipes has full history
192+
$url = str_replace('symfony/recipes', 'weaverryan/recipes', $url);
193+
$urls[] = $url;
201194

202195
break;
203196
}

src/Update/RecipePatcher.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function __construct(string $rootDir, IOInterface $io)
3434
/**
3535
* Applies the patch. If it fails unexpectedly, an exception will be thrown.
3636
*
37-
* @return bool returns true of fully successful, false if conflicts were encountered
37+
* @return bool returns true if fully successful, false if conflicts were encountered
3838
*/
3939
public function applyPatch(RecipePatch $patch): bool
4040
{
@@ -198,7 +198,7 @@ private function generateBlobs(array $originalFiles, string $originalFilesRoot):
198198
{
199199
$addedBlobs = [];
200200
foreach ($originalFiles as $filename => $contents) {
201-
// if the didn't originally exist, no blob needed
201+
// if the file didn't originally exist, no blob needed
202202
if (!file_exists($originalFilesRoot.'/'.$filename)) {
203203
continue;
204204
}

0 commit comments

Comments
 (0)