diff --git a/fixtures/comments.Procfile b/fixtures/comments.Procfile index af4deb0..f569854 100644 --- a/fixtures/comments.Procfile +++ b/fixtures/comments.Procfile @@ -4,7 +4,7 @@ # Procfile for development using the new threaded worker (scheduler, twitter stream and delayed job) cron: node worker.js -web: node web.js # testing inline comment +web : node web.js # testing inline comment wor-ker: node worker.js # -wor-ker2: node worker.js # -wor-ker_2: node worker.js diff --git a/procfile/parse.go b/procfile/parse.go index 5f8900b..88b9c42 100644 --- a/procfile/parse.go +++ b/procfile/parse.go @@ -34,8 +34,8 @@ func ParseFormation(formation string) (map[string]FormationEntry, error) { // ParseProcfile parses text as a procfile and returns a list of procfile entries func ParseProcfile(text string, delimiter string, strict bool) ([]ProcfileEntry, error) { var entries []ProcfileEntry - reCmd, _ := regexp.Compile(`^([a-z0-9]([-a-z0-9]*[a-z0-9])?)` + delimiter + `\s*(.+)$`) - reOldCmd, _ := regexp.Compile(`^([A-Za-z0-9_-]+)` + delimiter + `\s*(.+)$`) + reCmd, _ := regexp.Compile(`^([a-z0-9]([-a-z0-9]*[a-z0-9])?)\s*` + delimiter + `\s*(.+)$`) + reOldCmd, _ := regexp.Compile(`^([A-Za-z0-9_-]+)\s*` + delimiter + `\s*(.+)$`) reComment, _ := regexp.Compile(`^(.*)\s#.+$`) reForwardslashComment, _ := regexp.Compile(`^(.*)\s//.+$`) diff --git a/test.bats b/test.bats index 0e9846d..fc12ffc 100644 --- a/test.bats +++ b/test.bats @@ -28,6 +28,12 @@ custom release web wor-ker" + + run $PROCFILE_BIN show -P fixtures/comments.Procfile -p web + echo "output: $output" + echo "status: $status" + [[ "$status" -eq 0 ]] + assert_output "node web.js" } @test "[lax] forwardslash-comments" { @@ -183,8 +189,8 @@ flunk() { assert_equal() { if [[ "$1" != "$2" ]]; then { - echo "expected: '$1'" - echo "actual: '$2'" + echo "expected: $1" + echo "actual: $2" } | flunk fi }