feat: Add ruby-version manager (#3515)
Adds functionality to detect and update `.ruby-version` files.
This commit is contained in:
Родитель
6b1695e16d
Коммит
f5ef05d54b
|
@ -1214,6 +1214,17 @@ const options = [
|
|||
},
|
||||
mergeable: true,
|
||||
},
|
||||
{
|
||||
name: 'ruby-version',
|
||||
stage: 'package',
|
||||
type: 'object',
|
||||
default: {
|
||||
fileMatch: ['(^|/)\\.ruby-version$'],
|
||||
versionScheme: 'ruby',
|
||||
},
|
||||
mergeable: true,
|
||||
cli: false,
|
||||
},
|
||||
{
|
||||
name: 'terraform',
|
||||
description: 'Configuration object for Terraform module renovation',
|
||||
|
|
|
@ -25,6 +25,7 @@ const managerList = [
|
|||
'poetry',
|
||||
'terraform',
|
||||
'travis',
|
||||
'ruby-version',
|
||||
];
|
||||
const managers = {};
|
||||
for (const manager of managerList) {
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
const ruby = require('../../versioning/ruby');
|
||||
|
||||
module.exports = {
|
||||
extractPackageFile,
|
||||
};
|
||||
|
||||
function extractPackageFile(content) {
|
||||
logger.trace('ruby-version.extractPackageFile()');
|
||||
const dep = {
|
||||
depName: 'ruby',
|
||||
currentValue: content.trim(),
|
||||
datasource: 'rubyVersion',
|
||||
};
|
||||
if (!ruby.isValid(dep.currentValue)) {
|
||||
dep.skipReason = 'unsupported-version';
|
||||
}
|
||||
return { deps: [dep] };
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
const { extractPackageFile } = require('./extract');
|
||||
const { updateDependency } = require('./update');
|
||||
|
||||
const language = 'ruby';
|
||||
|
||||
module.exports = {
|
||||
extractPackageFile,
|
||||
language,
|
||||
updateDependency,
|
||||
};
|
|
@ -0,0 +1,8 @@
|
|||
module.exports = {
|
||||
updateDependency,
|
||||
};
|
||||
|
||||
function updateDependency(fileContent, upgrade) {
|
||||
logger.debug(`ruby-version.updateDependency(): ${upgrade.newVersions}`);
|
||||
return `${upgrade.newValue}\n`;
|
||||
}
|
|
@ -813,6 +813,14 @@
|
|||
},
|
||||
"$ref": "#"
|
||||
},
|
||||
"ruby-version": {
|
||||
"type": "object",
|
||||
"default": {
|
||||
"fileMatch": ["(^|/)\\.ruby-version$"],
|
||||
"versionScheme": "ruby"
|
||||
},
|
||||
"$ref": "#"
|
||||
},
|
||||
"terraform": {
|
||||
"description": "Configuration object for Terraform module renovation",
|
||||
"type": "object",
|
||||
|
|
|
@ -87,7 +87,7 @@ Array [
|
|||
"depName": "Configuration Error",
|
||||
"message": "packageRules:
|
||||
You have included an unsupported manager in a package rule. Your list: foo.
|
||||
Supported managers are: (ansible, bazel, buildkite, bundler, cargo, circleci, composer, docker-compose, dockerfile, github-actions, gitlabci, gomod, gradle, gradle-wrapper, kubernetes, maven, meteor, npm, nuget, nvm, pip_requirements, pip_setup, pipenv, poetry, terraform, travis).",
|
||||
Supported managers are: (ansible, bazel, buildkite, bundler, cargo, circleci, composer, docker-compose, dockerfile, github-actions, gitlabci, gomod, gradle, gradle-wrapper, kubernetes, maven, meteor, npm, nuget, nvm, pip_requirements, pip_setup, pipenv, poetry, terraform, travis, ruby-version).",
|
||||
},
|
||||
]
|
||||
`;
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`lib/manager/ruby-version/extract extractPackageFile() returns a result 1`] = `
|
||||
Array [
|
||||
Object {
|
||||
"currentValue": "8.4.0",
|
||||
"datasource": "rubyVersion",
|
||||
"depName": "ruby",
|
||||
},
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`lib/manager/ruby-version/extract extractPackageFile() skips non ranges 1`] = `
|
||||
Array [
|
||||
Object {
|
||||
"currentValue": "latestn",
|
||||
"datasource": "rubyVersion",
|
||||
"depName": "ruby",
|
||||
"skipReason": "unsupported-version",
|
||||
},
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`lib/manager/ruby-version/extract extractPackageFile() supports ranges 1`] = `
|
||||
Array [
|
||||
Object {
|
||||
"currentValue": "8.4",
|
||||
"datasource": "rubyVersion",
|
||||
"depName": "ruby",
|
||||
},
|
||||
]
|
||||
`;
|
|
@ -0,0 +1,6 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`manager/nvm/update updateDependency updates values 1`] = `
|
||||
"8.9.1
|
||||
"
|
||||
`;
|
|
@ -0,0 +1,20 @@
|
|||
const {
|
||||
extractPackageFile,
|
||||
} = require('../../../lib/manager/ruby-version/extract');
|
||||
|
||||
describe('lib/manager/ruby-version/extract', () => {
|
||||
describe('extractPackageFile()', () => {
|
||||
it('returns a result', () => {
|
||||
const res = extractPackageFile('8.4.0\n');
|
||||
expect(res.deps).toMatchSnapshot();
|
||||
});
|
||||
it('supports ranges', () => {
|
||||
const res = extractPackageFile('8.4\n');
|
||||
expect(res.deps).toMatchSnapshot();
|
||||
});
|
||||
it('skips non ranges', () => {
|
||||
const res = extractPackageFile('latestn');
|
||||
expect(res.deps).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
});
|
|
@ -0,0 +1,15 @@
|
|||
const {
|
||||
updateDependency,
|
||||
} = require('../../../lib/manager/ruby-version/update');
|
||||
|
||||
describe('manager/nvm/update', () => {
|
||||
describe('updateDependency', () => {
|
||||
it('updates values', () => {
|
||||
const upgrade = {
|
||||
newValue: '8.9.1',
|
||||
};
|
||||
const res = updateDependency('8.9.0\n', upgrade);
|
||||
expect(res).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
});
|
|
@ -74,6 +74,9 @@ Object {
|
|||
"poetry": Array [
|
||||
Object {},
|
||||
],
|
||||
"ruby-version": Array [
|
||||
Object {},
|
||||
],
|
||||
"terraform": Array [
|
||||
Object {},
|
||||
],
|
||||
|
|
|
@ -885,6 +885,8 @@ Set this to false either globally, per-language, or per-package if you want to d
|
|||
|
||||
## ruby
|
||||
|
||||
## ruby-version
|
||||
|
||||
## schedule
|
||||
|
||||
The `schedule` option allows you to define times of week or month for Renovate updates. Running Renovate around the clock may seem too "noisy" for some projects and therefore `schedule` is a good way to reduce the noise by reducing the timeframe in which Renovate will operate on your repository.
|
||||
|
|
Загрузка…
Ссылка в новой задаче