renovate/lib/manager/travis/update.js
Rhys Arkins faa4cc6171 fix: travis metadata and formatting
Updates travis config and logic to use same variables as for other managers. This fixes the onboarding PR.

Fixes #1551
2018-03-03 20:53:54 +01:00

20 lines
605 B
JavaScript

const detectIndent = require('detect-indent');
module.exports = {
setNewValue,
};
function setNewValue(currentFileContent, upgrade) {
try {
logger.debug(`node.setNewValue: ${upgrade.newVersion}`);
const indent = detectIndent(currentFileContent).indent || ' ';
let newString = `\nnode_js:\n`;
upgrade.newVersion.forEach(version => {
newString += `${indent}- '${version}'\n`;
});
return currentFileContent.replace(/\nnode_js:(\n\s+[^\n]+)+\n/, newString);
} catch (err) {
logger.info({ err }, 'Error setting new .travis.yml node versions');
return null;
}
}