Skip to content

Commit

Permalink
Be more tolerant of \r\n vs \n in removing mult blank lines (#501)
Browse files Browse the repository at this point in the history
  • Loading branch information
StephenWeatherford authored Sep 21, 2018
1 parent b32c19a commit 2a286c3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions configureWorkspace/configure_dotnetcore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,10 @@ function genDockerFile(serviceNameAndRelativePath: string, platform: Platform, o
.replace(/\$assembly_name\$/g, assemblyNameNoExtension)
.replace(/\$copy_project_commands\$/g, copyProjectCommands);

// Remove multiple empty lines, as might be produced if there's no EXPOSE statement
contents = contents.replace(new RegExp(`${nodeOs.EOL}\{3\}`, 'g'), `${nodeOs.EOL}${nodeOs.EOL}`);
// Remove multiple empty lines with single empty lines, as might be produced
// if $expose_statements$ or another template variable is an empty string
contents = contents.replace(/(\r\n){3}/g, "\r\n\r\n")
.replace(/(\n){3}/g, "\n\n");

let unreplacedToken = extractRegExGroups(contents, /(\$[a-z_]+\$)/, ['']);
if (unreplacedToken[0]) {
Expand Down
2 changes: 1 addition & 1 deletion test/configure.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1070,7 +1070,7 @@ suite("Configure (Add Docker files to Workspace)", function (this: Suite): void
// Ruby

suite("Ruby", () => {
testInEmptyFolder("Ruby", async () => {
testInEmptyFolder("Ruby, empty folder", async () => {
await testConfigureDocker(
'Ruby',
{
Expand Down

0 comments on commit 2a286c3

Please sign in to comment.