Skip to content

Commit aad2222

Browse files
authored
fix(manager/bundler): Update Gemfile.lock when only Ruby upgraded (#27451)
1 parent c633938 commit aad2222

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

lib/modules/manager/bundler/artifacts.spec.ts

+21
Original file line numberDiff line numberDiff line change
@@ -946,6 +946,27 @@ describe('modules/manager/bundler/artifacts', () => {
946946
{ cmd: 'bundler lock --minor --conservative --update foo' },
947947
]);
948948
});
949+
950+
it('updates the Gemfile.lock when ruby upgraded', async () => {
951+
// See https://github.com/renovatebot/renovate/issues/15114
952+
fs.readLocalFile.mockResolvedValue('Current Gemfile.lock');
953+
const execSnapshots = mockExecSequence([{ stdout: '', stderr: '' }]);
954+
git.getRepoStatus.mockResolvedValueOnce(
955+
partial<StatusResult>({
956+
modified: ['Gemfile.lock'],
957+
}),
958+
);
959+
960+
const res = await updateArtifacts({
961+
packageFileName: 'Gemfile',
962+
updatedDeps: [{ depName: 'ruby', updateType: 'patch' }],
963+
newPackageFileContent: '{}',
964+
config,
965+
});
966+
967+
expect(res).toMatchObject([{ file: { path: 'Gemfile.lock' } }]);
968+
expect(execSnapshots).toMatchObject([{ cmd: 'bundler lock' }]);
969+
});
949970
});
950971
});
951972
});

lib/modules/manager/bundler/artifacts.ts

+7
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,13 @@ export async function updateArtifacts(
121121
commands.push(cmd);
122122
}
123123
}
124+
125+
const rubyUpgraded = updatedDeps
126+
.map((dep) => dep.depName)
127+
.includes('ruby');
128+
if (rubyUpgraded) {
129+
commands.push('bundler lock');
130+
}
124131
}
125132

126133
const bundlerHostRules = findAllAuthenticatable({

0 commit comments

Comments
 (0)