Skip to content

Commit

Permalink
Merge pull request #1071 from dmitriiabramov/master
Browse files Browse the repository at this point in the history
Remove trailing whitespace from generated config file
  • Loading branch information
aymericbeaumet committed Jun 4, 2014
2 parents 72a838c + 39d1e72 commit ef1d177
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 16 deletions.
6 changes: 2 additions & 4 deletions config.tpl.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,12 @@ module.exports = (config) ->


# list of files / patterns to load in the browser
files: [
%FILES%
files: [%FILES%
]


# list of files to exclude
exclude: [
%EXCLUDE%
exclude: [%EXCLUDE%
]


Expand Down
6 changes: 2 additions & 4 deletions config.tpl.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,12 @@ module.exports = function(config) {


// list of files / patterns to load in the browser
files: [
%FILES%
files: [%FILES%
],


// list of files to exclude
exclude: [
%EXCLUDE%
exclude: [%EXCLUDE%
],


Expand Down
6 changes: 2 additions & 4 deletions config.tpl.ls
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,12 @@ module.exports = (config) ->


# list of files / patterns to load in the browser
files: [
%FILES%
files: [%FILES%
]


# list of files to exclude
exclude: [
%EXCLUDE%
exclude: [%EXCLUDE%
]


Expand Down
8 changes: 6 additions & 2 deletions lib/init/formatters.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ var JavaScriptFormatter = function() {
};

var pad = function(str, pad) {
return str.replace(/\n/g, '\n' + pad);
return str.replace(/\n/g, '\n' + pad).replace(/\s+$/gm, '');
};

var formatQuottedList = function(list) {
Expand All @@ -46,7 +46,11 @@ var JavaScriptFormatter = function() {
files.push(quoteNonIncludedPattern(onlyServedFile));
});

return files.join(',\n ');
files = files.map(function(file) {
return '\n ' + file;
});

return files.join(',');
};

this.formatPreprocessors = function(preprocessors) {
Expand Down
4 changes: 2 additions & 2 deletions test/unit/init/formatters.spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe 'init/formatters', ->
expect(replacements.FILES).to.equal ''

replacements = formatter.formatAnswers createAnswers {files: ['*.js', 'other/file.js']}
expect(replacements.FILES).to.equal "'*.js',\n 'other/file.js'"
expect(replacements.FILES).to.equal "\n '*.js',\n 'other/file.js'"


it 'should format BROWSERS', ->
Expand All @@ -52,7 +52,7 @@ describe 'init/formatters', ->
onlyServedFiles: ['src/*.js']
}

expect(replacements.FILES).to.equal "'test-main.js',\n" +
expect(replacements.FILES).to.equal "\n 'test-main.js',\n" +
" {pattern: 'src/*.js', included: false}"


Expand Down

0 comments on commit ef1d177

Please sign in to comment.