Commit 0d9b0411 authored by Hunter Loftis's avatar Hunter Loftis

Merge pull request #275 from heroku/more-robust-formatting

test and implementation for more robust output formatting
parents caf4d3c9 a1651414
...@@ -2,16 +2,19 @@ info() { ...@@ -2,16 +2,19 @@ info() {
echo " $*" echo " $*"
} }
# sed has a problem with the huge build output from npm 3 # format output on both OSX and Ubuntu, cedar-10 and cedar-14, while also splitting to a log file
# try awk? awk '{ print " " $0 }'
output() { output() {
local logfile="$1" local logfile="$1"
local c='s/^/ /' local c='s/^/ /'
if [ "${STACK:-cedar-14}" = "cedar" ]; then
tee -a "$logfile" | awk -W interactive '{ print " " $0 }'
else
case $(uname) in case $(uname) in
Darwin) tee -a "$logfile" | awk '{ print " " $0 }';; Darwin) sed -l "$c" | tee -i -a "$logfile" 2> /dev/null;;
*) tee -a "$logfile" | awk -W interactive '{ print " " $0 }';; *) stdbuf -oL -eL sed -u "$c" | tee -i -a "$logfile" 2> /dev/null;;
esac esac
fi
} }
header() { header() {
......
...@@ -2,12 +2,12 @@ test: test-cedar-14 test-cedar-10 ...@@ -2,12 +2,12 @@ test: test-cedar-14 test-cedar-10
test-cedar-14: test-cedar-14:
@echo "Running tests in docker (cedar-14)..." @echo "Running tests in docker (cedar-14)..."
@docker run -v $(shell pwd):/buildpack:ro --rm -it heroku/cedar:14 bash -c 'cp -r /buildpack /buildpack_test; cd /buildpack_test/; test/run;' @docker run -v $(shell pwd):/buildpack:ro --rm -it -e "STACK=cedar-14" heroku/cedar:14 bash -c 'cp -r /buildpack /buildpack_test; cd /buildpack_test/; test/run;'
@echo "" @echo ""
test-cedar-10: test-cedar-10:
@echo "Running tests in docker (cedar)..." @echo "Running tests in docker (cedar)..."
@docker run -v $(shell pwd):/buildpack:ro --rm -it fabiokung/cedar bash -c 'cp -r /buildpack /buildpack_test; cd /buildpack_test/; test/run;' @docker run -v $(shell pwd):/buildpack:ro --rm -it -e "STACK=cedar" fabiokung/cedar bash -c 'cp -r /buildpack /buildpack_test; cd /buildpack_test/; test/run;'
shell: shell:
@echo "Opening cedar-14 shell..." @echo "Opening cedar-14 shell..."
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment