2018-03-28 13:24:42 +00:00
|
|
|
const managerList = [
|
2018-12-18 10:18:27 +00:00
|
|
|
'ansible',
|
2018-03-28 13:24:42 +00:00
|
|
|
'bazel',
|
2018-04-27 17:54:44 +00:00
|
|
|
'buildkite',
|
2018-11-22 05:55:28 +00:00
|
|
|
'bundler',
|
2018-11-09 13:22:11 +00:00
|
|
|
'cargo',
|
2018-03-28 18:12:56 +00:00
|
|
|
'circleci',
|
2018-06-08 04:15:13 +00:00
|
|
|
'composer',
|
2018-03-28 13:24:42 +00:00
|
|
|
'docker-compose',
|
2018-07-21 17:40:50 +00:00
|
|
|
'dockerfile',
|
2018-07-22 04:33:11 +00:00
|
|
|
'gitlabci',
|
2018-10-01 11:50:36 +00:00
|
|
|
'gomod',
|
2019-01-08 04:04:20 +00:00
|
|
|
'gradle',
|
2018-08-04 06:04:11 +00:00
|
|
|
'kubernetes',
|
2018-03-28 13:24:42 +00:00
|
|
|
'meteor',
|
|
|
|
'npm',
|
2019-01-08 04:04:20 +00:00
|
|
|
'nuget',
|
2018-03-28 13:24:42 +00:00
|
|
|
'nvm',
|
2018-04-28 18:39:07 +00:00
|
|
|
'pip_requirements',
|
2018-11-15 17:42:01 +00:00
|
|
|
'pip_setup',
|
2018-11-23 06:58:25 +00:00
|
|
|
'pipenv',
|
2018-10-06 11:39:39 +00:00
|
|
|
'terraform',
|
2018-03-28 13:24:42 +00:00
|
|
|
'travis',
|
|
|
|
];
|
2018-05-09 06:03:59 +00:00
|
|
|
const managers = {};
|
2018-03-03 13:39:39 +00:00
|
|
|
for (const manager of managerList) {
|
|
|
|
// eslint-disable-next-line global-require,import/no-dynamic-require
|
|
|
|
managers[manager] = require(`./${manager}`);
|
|
|
|
}
|
2017-10-25 04:48:08 +00:00
|
|
|
|
2018-11-09 13:22:11 +00:00
|
|
|
const languageList = [
|
|
|
|
'docker',
|
|
|
|
'golang',
|
|
|
|
'js',
|
|
|
|
'node',
|
|
|
|
'php',
|
|
|
|
'python',
|
2018-11-22 05:55:28 +00:00
|
|
|
'ruby',
|
2018-11-09 13:22:11 +00:00
|
|
|
'rust',
|
|
|
|
];
|
2017-10-24 11:50:07 +00:00
|
|
|
|
2018-05-09 06:03:59 +00:00
|
|
|
const get = (manager, name) => managers[manager][name];
|
|
|
|
const getLanguageList = () => languageList;
|
|
|
|
const getManagerList = () => managerList;
|
2018-03-03 13:39:39 +00:00
|
|
|
|
2018-05-09 06:03:59 +00:00
|
|
|
module.exports = {
|
|
|
|
get,
|
|
|
|
getLanguageList,
|
|
|
|
getManagerList,
|
|
|
|
};
|
2017-10-25 04:48:08 +00:00
|
|
|
|
2018-05-09 06:03:59 +00:00
|
|
|
const managerFunctions = [
|
2018-11-05 06:47:44 +00:00
|
|
|
'extractAllPackageFiles',
|
2018-11-04 17:51:23 +00:00
|
|
|
'extractPackageFile',
|
2018-05-09 06:03:59 +00:00
|
|
|
'getPackageUpdates',
|
|
|
|
'supportsLockFileMaintenance',
|
2019-01-08 04:04:20 +00:00
|
|
|
'updateDependency',
|
2018-05-09 06:03:59 +00:00
|
|
|
];
|
2017-10-25 04:48:08 +00:00
|
|
|
|
2018-05-09 06:03:59 +00:00
|
|
|
for (const f of managerFunctions) {
|
|
|
|
module.exports[f] = (manager, ...params) => {
|
|
|
|
if (managers[manager][f]) {
|
|
|
|
return managers[manager][f](...params);
|
2017-10-25 04:48:08 +00:00
|
|
|
}
|
2018-05-09 06:03:59 +00:00
|
|
|
return null;
|
2017-10-25 04:48:08 +00:00
|
|
|
};
|
|
|
|
}
|
2018-06-03 12:25:05 +00:00
|
|
|
|
|
|
|
module.exports.getRangeStrategy = config => {
|
|
|
|
const { manager, rangeStrategy } = config;
|
|
|
|
if (managers[manager].getRangeStrategy) {
|
|
|
|
// Use manager's own function if it exists
|
|
|
|
return managers[manager].getRangeStrategy(config);
|
|
|
|
}
|
|
|
|
if (rangeStrategy === 'auto') {
|
|
|
|
// default to 'replace' for auto
|
|
|
|
return 'replace';
|
|
|
|
}
|
|
|
|
return config.rangeStrategy;
|
|
|
|
};
|