Skip to content

Commit

Permalink
Merge pull request #1 from hecticjeff/newline-at-eof
Browse files Browse the repository at this point in the history
Skip blank lines in procfile
  • Loading branch information
indexzero committed Aug 22, 2012
2 parents ed963dc + c6ec2f0 commit f13a866
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/procfile.js
Expand Up @@ -43,6 +43,7 @@ procfile.parse = function (lines) {
var procs = {};

lines.split('\n').forEach(function (line) {
if (line === '') return;
var parts = line.split(':'),
details = parts[1].trim().split(' '),
name = parts[0];
Expand Down
2 changes: 2 additions & 0 deletions test/fixtures/newline.procfile
@@ -0,0 +1,2 @@
web: node myapp.js -p 80 --some-option
worker: node myworker.js --other-option
2 changes: 1 addition & 1 deletion test/helpers.js
Expand Up @@ -10,7 +10,7 @@ var fs = require('fs'),
path = require('path');

var fixtures = path.join(__dirname, 'fixtures'),
files = [path.join(fixtures, 'ruby.procfile'), path.join(fixtures, 'node.procfile')],
files = [path.join(fixtures, 'ruby.procfile'), path.join(fixtures, 'node.procfile'), path.join(fixtures, 'newline.procfile')],
procfiles = {};

var helpers = exports;
Expand Down
5 changes: 5 additions & 0 deletions test/procfile-test.js
Expand Up @@ -42,6 +42,11 @@ vows.describe('procfile').addBatch({
});

helpers.putParsed('node', procs);
},
"with newline at end of file": function() {
assert.doesNotThrow(function() {
var procs = procfile.parse(procfiles.newline);
});
}
}
}
Expand Down

0 comments on commit f13a866

Please sign in to comment.