From 53e1d78f54855930ab44238c09f0b7d290077f2e Mon Sep 17 00:00:00 2001 From: Julien Tanay Date: Sat, 23 Nov 2024 13:23:55 +0100 Subject: [PATCH] fix --- lib/modules/manager/bundler/extract.spec.ts | 12 ++++++------ lib/modules/manager/bundler/extract.ts | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/modules/manager/bundler/extract.spec.ts b/lib/modules/manager/bundler/extract.spec.ts index ca129d3a7cc2a1..78ae44e63f1e4b 100644 --- a/lib/modules/manager/bundler/extract.spec.ts +++ b/lib/modules/manager/bundler/extract.spec.ts @@ -31,12 +31,6 @@ const sourceBlockWithGroupsGemfile = Fixtures.get( 'Gemfile.sourceBlockWithGroups', ); -const gitRefGemfile = codeBlock` -gem 'foo', git: 'https://github.com/foo/foo', ref: 'fd184883048b922b176939f851338d0a4971a532' -gem 'bar', git: 'https://github.com/bar/bar', tag: 'v1.0.0' -gem 'baz', github: 'baz/baz', branch: 'master' -`; - describe('modules/manager/bundler/extract', () => { describe('extractPackageFile()', () => { it('returns null for empty', async () => { @@ -203,6 +197,12 @@ describe('modules/manager/bundler/extract', () => { }); it('parses git refs in Gemfile', async () => { + const gitRefGemfile = codeBlock` + gem 'foo', git: 'https://github.com/foo/foo', ref: 'fd184883048b922b176939f851338d0a4971a532' + gem 'bar', git: 'https://github.com/bar/bar', tag: 'v1.0.0' + gem 'baz', github: 'baz/baz', branch: 'master' + `; + fs.readLocalFile.mockResolvedValueOnce(gitRefGemfile); const res = await extractPackageFile(gitRefGemfile, 'Gemfile'); expect(res).toMatchObject({ diff --git a/lib/modules/manager/bundler/extract.ts b/lib/modules/manager/bundler/extract.ts index 3ee0246b6449d2..2ae134a75ca2f7 100644 --- a/lib/modules/manager/bundler/extract.ts +++ b/lib/modules/manager/bundler/extract.ts @@ -20,7 +20,7 @@ const gemGitRefsMatchRegex = regEx( `^\\s*gem\\s+(['"])(?[^'"]+)['"]((\\s*,\\s*git:\\s*['"](?[^'"]+)['"])|(\\s*,\\s*github:\\s*['"](?[^'"]+)['"]))(\\s*,\\s*branch:\\s*['"](?[^'"]+)['"])?(\\s*,\\s*ref:\\s*['"](?[^'"]+)['"])?(\\s*,\\s*tag:\\s*['"](?[^'"]+)['"])?`, ); const gemMatchRegex = regEx( - `^\\s*gem\\s+(['"])(?[^'"]+)(['"])(\\s*,\\s*(?(['"])[^'"]+['"](\\s*,\\s*['"][^'"]+['"])?))?`, + `^\\s*gem\\s+(['"])(?[^'"]+)(['"])(\\s*,\\s*(?(['"])[^'"]+['"](\\s*,\\s*['"][^'"]+['"])?))?(\\s*,\\s*source:\\s*(['"](?[^'"]+)['"]|(?[^'"]+)))?`, ); export async function extractPackageFile(