Last active
December 4, 2019 22:26
-
-
Save iamnewton/b28bf10822bf7fef8dee83bd568e534b to your computer and use it in GitHub Desktop.
Revisions
-
iamnewton revised this gist
Dec 4, 2019 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -12,9 +12,9 @@ const readFile = () => { // read line by line and modify a line and rewrite it back readInterface.on('line', function(line) { if (line.includes('projectVersion')) { this.output.write('sonar.projectVersion=2020.1.0\n'); } else { this.output.write(`${line}\n`); } }); }; -
iamnewton created this gist
Dec 4, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,20 @@ const fs = require('fs'); const readline = require('readline'); const readFile = () => { // create readline interface and output to a new file; can't figure out how to write to same file const readInterface = readline.createInterface({ input: fs.createReadStream(findup('sonar-project.properties')), output: fs.createWriteStream('sonar-project.properties.temp'), console: false }); // read line by line and modify a line and rewrite it back readInterface.on('line', function(line) { if (line.includes('projectVersion')) { this.output.write('sonar.projectVersion=2020.1.0\n'); } else { this.output.write(`${line}\n`); } }); };