Skip to content

Commit

Permalink
Update Gemfile.lock when only Ruby upgraded
Browse files Browse the repository at this point in the history
Fixes renovatebot#15114 which was broken again by 77e1068.
  • Loading branch information
benlangfeld committed Feb 20, 2024
1 parent c633938 commit 2d6b82c
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
21 changes: 21 additions & 0 deletions lib/modules/manager/bundler/artifacts.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -946,6 +946,27 @@ describe('modules/manager/bundler/artifacts', () => {
{ cmd: 'bundler lock --minor --conservative --update foo' },
]);
});

it('updates the Gemfile.lock when ruby upgraded', async () => {
// See https://github.com/renovatebot/renovate/issues/15114
fs.readLocalFile.mockResolvedValue('Current Gemfile.lock');
const execSnapshots = mockExecSequence([{ stdout: '', stderr: '' }]);
git.getRepoStatus.mockResolvedValueOnce(
partial<StatusResult>({
modified: ['Gemfile.lock'],
}),
);

const res = await updateArtifacts({
packageFileName: 'Gemfile',
updatedDeps: [{ depName: 'ruby', updateType: 'patch' }],
newPackageFileContent: '{}',
config,
});

expect(res).toMatchObject([{ file: { path: 'Gemfile.lock' } }]);
expect(execSnapshots).toMatchObject([{ cmd: 'bundler lock' }]);
});
});
});
});
7 changes: 7 additions & 0 deletions lib/modules/manager/bundler/artifacts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,13 @@ export async function updateArtifacts(
commands.push(cmd);
}
}

const rubyUpgraded = updatedDeps
.map((dep) => dep.depName)
.includes('ruby');
if (rubyUpgraded) {
commands.push('bundler lock');
}
}

const bundlerHostRules = findAllAuthenticatable({
Expand Down

0 comments on commit 2d6b82c

Please sign in to comment.