Skip to content

Commit

Permalink
feat(manager/asdf): support multiple spaces in .tool-versions for rtx…
Browse files Browse the repository at this point in the history
… compatibility (#23995)
  • Loading branch information
pdecat committed Aug 21, 2023
1 parent 6c8c469 commit 745edc1
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
33 changes: 33 additions & 0 deletions lib/modules/manager/asdf/extract.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,39 @@ dummy 1.2.3
});
});

it('can handle multiple tools with indented versions in one file', () => {
const res = extractPackageFile(
codeBlock`
adr-tools 3.0.0
argocd 2.5.4
awscli 2.8.6
`
);
expect(res).toEqual({
deps: [
{
currentValue: '3.0.0',
datasource: 'github-tags',
packageName: 'npryce/adr-tools',
depName: 'adr-tools',
},
{
currentValue: '2.5.4',
datasource: 'github-releases',
packageName: 'argoproj/argo-cd',
depName: 'argocd',
extractVersion: '^v(?<version>\\S+)',
},
{
currentValue: '2.8.6',
datasource: 'github-tags',
packageName: 'aws/aws-cli',
depName: 'awscli',
},
],
});
});

it('can handle flutter version channel', () => {
const withChannel = extractPackageFile('flutter 3.10.0-stable');
expect(withChannel).toEqual({
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/manager/asdf/extract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export function extractPackageFile(content: string): PackageFileContent | null {
logger.trace(`asdf.extractPackageFile()`);

const regex = regEx(
/^(?<toolName>([\w_-]+)) (?<version>[^\s#]+)(?: [^\s#]+)* *(?: #(?<comment>.*))?$/gm
/^(?<toolName>([\w_-]+)) +(?<version>[^\s#]+)(?: +[^\s#]+)* *(?: #(?<comment>.*))?$/gm
);

const deps: PackageDependency[] = [];
Expand Down

0 comments on commit 745edc1

Please sign in to comment.