Commit 10422d15 authored by Hunter Loftis's avatar Hunter Loftis

test and implementation for warnings on old versions of npm. moves warnings to tail

parent d6391d66
......@@ -13,18 +13,6 @@ info() {
echo " $*"
}
build_failed() {
head "Build failed"
}
protip() {
tip=$1
url=$2
echo
echo "PRO TIP: $tip" | indent
echo "See ${url:-https://devcenter.heroku.com/articles/nodejs-support}" | indent
}
file_contents() {
if test -f $1; then
echo "$(cat $1)"
......
......@@ -13,6 +13,7 @@ env_dir=$3
bp_dir=$(cd $(dirname $0); cd ..; pwd)
heroku_dir=$build_dir/.heroku
mkdir -p $heroku_dir/node
warnings=$(mktemp)
# Load some convenience functions like status(), echo(), and indent()
source $bp_dir/bin/common.sh
......@@ -21,6 +22,10 @@ source $bp_dir/bin/common.sh
unset GIT_DIR
# Provide hook to deal with errors
build_failed() {
head "Build failed"
cat $warnings | indent
}
trap build_failed ERR
# Load config vars into environment; start with defaults
......@@ -205,3 +210,6 @@ fi
# Show the final dependency tree
info "Build successful!"
(npm ls --depth=0 || true) 2>/dev/null | indent
# Show any relevant warnings
cat $warnings | indent
......@@ -48,6 +48,12 @@ testUnstableVersion() {
assertCapturedSuccess
}
testOldNpm() {
compile "old-npm"
assertCaptured "PRO TIP: This version of npm has several known issues."
assertCapturedSuccess
}
testInfoEmpty() {
compile "info-empty"
assertCaptured "Node engine: unspecified"
......
protip() {
tip=$1
url=$2
echo "PRO TIP: $tip" >> $warnings
echo "${url:-https://devcenter.heroku.com/articles/nodejs-support}" >> $warnings
}
if [ "$node_engine" == "" ]; then
protip "Specify a node version in package.json" "https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version"
elif [ "$node_engine" == "*" ]; then
......@@ -15,3 +22,9 @@ fi
if [ "$start_method" == "" ]; then
protip "Include a Procfile, package.json start script, or server.js file to start your app" "https://devcenter.heroku.com/articles/nodejs-support#runtime-behavior"
fi
if [ "$npm_engine" != "" ]; then
if [ "${npm_engine:0:1}" -lt "2" ]; then
protip "This version of npm has several known issues. You should consider upgrading to the latest release."
fi
fi
{
"name": "node-buildpack-test-app",
"version": "0.0.1",
"description": "node buildpack integration test app",
"repository" : {
"type" : "git",
"url" : "http://github.com/example/example.git"
},
"dependencies": {
"hashish": "*"
},
"engines": {
"node": "0.10.x",
"npm": "1.2"
},
"scripts": {
"start": "node server.js"
}
}
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