Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Djiit committed Nov 22, 2024
1 parent 8daac75 commit 7260b0b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
8 changes: 5 additions & 3 deletions lib/modules/manager/bundler/artifacts.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -574,8 +574,10 @@ describe('modules/manager/bundler/artifacts', () => {
bundlerHostRules.findAllAuthenticatable.mockReturnValue([
{
hostType: 'bundler',
matchHost: 'gems-private.com',
resolvedHost: 'gems-private.com',
matchHost:
'doctolib-580698825394.d.codeartifact.eu-west-1.amazonaws.com',
resolvedHost:
'doctolib-580698825394.d.codeartifact.eu-west-1.amazonaws.com',
username: 'some-user',
password: 'some-password',
},
Expand Down Expand Up @@ -622,7 +624,7 @@ describe('modules/manager/bundler/artifacts', () => {
' && ' +
'ruby --version' +
' && ' +
'bundler config set --local gems-private.com some-user:some-password' +
'bundler config set --local doctolib-580698825394.d.codeartifact.eu-west-1.amazonaws.com some-user:some-password' +
' && ' +
'bundler lock --update foo bar' +
'"',
Expand Down
12 changes: 6 additions & 6 deletions lib/modules/manager/bundler/extract.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down Expand Up @@ -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({
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/manager/bundler/extract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const gemGitRefsMatchRegex = regEx(
`^\\s*gem\\s+(['"])(?<depName>[^'"]+)['"]((\\s*,\\s*git:\\s*['"](?<gitUrl>[^'"]+)['"])|(\\s*,\\s*github:\\s*['"](?<repoName>[^'"]+)['"]))(\\s*,\\s*branch:\\s*['"](?<branchName>[^'"]+)['"])?(\\s*,\\s*ref:\\s*['"](?<refName>[^'"]+)['"])?(\\s*,\\s*tag:\\s*['"](?<tagName>[^'"]+)['"])?`,
);
const gemMatchRegex = regEx(
`^\\s*gem\\s+(['"])(?<depName>[^'"]+)(['"])(\\s*,\\s*(?<currentValue>(['"])[^'"]+['"](\\s*,\\s*['"][^'"]+['"])?))?`,
`^\\s*gem\\s+(['"])(?<depName>[^'"]+)(['"])(\\s*,\\s*(?<currentValue>(['"])[^'"]+['"](\\s*,\\s*['"][^'"]+['"])?))?(\\s*,\\s*source:\\s*(['"](?<registryUrl>[^'"]+)['"]|(?<sourceName>[^'"]+)))?`,
);

export async function extractPackageFile(
Expand Down

0 comments on commit 7260b0b

Please sign in to comment.