diff --git a/lib/manager/cake/__fixtures__/build.cake b/lib/manager/cake/__fixtures__/build.cake index 4cdbf4d0496313..f3d942b91997e7 100644 --- a/lib/manager/cake/__fixtures__/build.cake +++ b/lib/manager/cake/__fixtures__/build.cake @@ -1,5 +1,6 @@ foo #addin nuget:?package=Foo.Foo&version=1.1.1 +#addin "nuget:?package=Bim.Bim&version=6.6.6" #tool nuget:https://example.com?package=Bar.Bar&version=2.2.2 #module nuget:file:///tmp/?package=Baz.Baz&version=3.3.3 // #module nuget:?package=Qux.Qux&version=4.4.4 diff --git a/lib/manager/cake/__snapshots__/index.spec.ts.snap b/lib/manager/cake/__snapshots__/index.spec.ts.snap index a6e389b1fc832f..8df0548df51e2a 100644 --- a/lib/manager/cake/__snapshots__/index.spec.ts.snap +++ b/lib/manager/cake/__snapshots__/index.spec.ts.snap @@ -8,6 +8,11 @@ Object { "datasource": "nuget", "depName": "Foo.Foo", }, + Object { + "currentValue": "6.6.6", + "datasource": "nuget", + "depName": "Bim.Bim", + }, Object { "currentValue": "2.2.2", "datasource": "nuget", diff --git a/lib/manager/cake/index.ts b/lib/manager/cake/index.ts index 60cb08b985172d..74415c75d33449 100644 --- a/lib/manager/cake/index.ts +++ b/lib/manager/cake/index.ts @@ -17,6 +17,10 @@ const lexerStates = { dependency: { match: /^#(?:addin|tool|module)\s+(?:nuget|dotnet):.*$/, }, + dependencyQuoted: { + match: /^#(?:addin|tool|module)\s+"(?:nuget|dotnet):[^"]+"\s*$/, + value: (s: string) => s.trim().slice(1, -1), + }, unknown: { match: /[^]/, lineBreaks: true }, }, }; @@ -26,6 +30,7 @@ function parseDependencyLine(line: string): PackageDependency | null { let url = line.replace(/^[^:]*:/, ''); const isEmptyHost = url.startsWith('?'); url = isEmptyHost ? `http://localhost/${url}` : url; + const { origin: registryUrl, protocol, searchParams } = new URL(url); const depName = searchParams.get('package'); @@ -54,7 +59,7 @@ export function extractPackageFile(content: string): PackageFile { let token = lexer.next(); while (token) { const { type, value } = token; - if (type === 'dependency') { + if (type === 'dependency' || type === 'dependencyQuoted') { const dep = parseDependencyLine(value); if (dep) { deps.push(dep);