Permalink
Browse files

improve build output; all tests passing again

  • Loading branch information...
1 parent 1200fbb commit c75b14138a6aa5ba2783776840c883cb17a1cfaf @zeke zeke committed Oct 10, 2013
Showing with 40 additions and 14 deletions.
  1. +1 −1 bin/common.sh
  2. +10 −8 bin/compile
  3. +13 −5 bin/test
  4. +1 −0 test/invalid-dependency/README.md
  5. +15 −0 test/invalid-dependency/package.json
View
@@ -10,7 +10,7 @@ status() {
protip() {
echo
echo "PRO TIP: $*" | indent
- echo "See https://devcenter.heroku.com/articles/nodejs-support"
+ echo "See https://devcenter.heroku.com/articles/nodejs-support" | indent
echo
}
View
@@ -20,28 +20,30 @@ trap cat_npm_debug_log ERR
# Look in package.json's engines.node field for a semver range
semver_range=$(cat $build_dir/package.json | $bp_dir/vendor/jq -r .engines.node)
+# Resolve node version using semver.io
+semver_url=http://semver.io/node/$semver_range
+node_version=$(curl --silent $semver_url)
+
# Recommend using semver ranges in a safe manner
if [ "$semver_range" == "null" ]; then
protip "Specify a node version in package.json"
semver_range=""
elif [ "$semver_range" == "*" ]; then
- protip "Don't use semver ranges like *"
+ protip "Avoid using semver ranges like '*' in engines.node"
elif [ ${semver_range:0:1} == ">" ]; then
- protip "Don't use semver ranges starting with >"
+ protip "Avoid using semver ranges starting with '>' in engines.node"
fi
-# Resolve node version using semver.io
-semver_url=http://semver.io/node/$semver_range
-node_version=$(curl --silent $semver_url)
-
+# Output info about requested range and resolved node version
if [ "$semver_range" == "" ]; then
status "Defaulting to latest stable node: $node_version"
else
- status "Resolved node version for $semver_range is $node_version"
+ status "Requested node range: $semver_range"
+ status "Resolved node version: $node_version"
fi
# Download node from Heroku's S3 mirror of nodejs.org/dist
-status "Downloading and installing node v$node_version"
+status "Downloading and installing node"
node_url="http://s3pository.heroku.com/node/v$node_version/node-v$node_version-linux-x64.tar.gz"
curl $node_url -s -o - | tar xzf - -C $build_dir
View
@@ -21,15 +21,17 @@ testNoVersion() {
testDangerousRangeStar() {
compile "dangerous-range-star"
- assertCaptured "PRO TIP: Don't use semver ranges like *"
-
+ assertCaptured "PRO TIP: Avoid using semver ranges like '*'"
+ assertCaptured "Requested node range: *"
+ assertCaptured "Resolved node version: 0.10"
assertCapturedSuccess
}
testDangerousRangeGreaterThan() {
compile "dangerous-range-greater-than"
- assertCaptured "PRO TIP: Don't use semver ranges starting with >"
- assertCaptured "Resolved node version for >"
+ assertCaptured "PRO TIP: Avoid using semver ranges starting with '>'"
+ assertCaptured "Requested node range: >"
+ assertCaptured "Resolved node version: 0.10."
assertCapturedSuccess
}
@@ -42,7 +44,8 @@ testStableVersion() {
testUnstableVersion() {
compile "unstable-version"
- assertCaptured "Resolved node version for >0.11.0 is 0.11"
+ assertCaptured "Requested node range: >0.11.0"
+ assertCaptured "Resolved node version: 0.11."
assertCapturedSuccess
}
@@ -51,6 +54,11 @@ testUnstableVersion() {
# assertCapturedError 1 "not found among available versions"
# }
+# testInvalidVersion() {
+# compile "invalid-dependency"
+# assertCapturedError 1 "not in the npm registry"
+# }
+
testProfileCreated() {
compile "stable-node"
assertCaptured "Building runtime environment"
@@ -0,0 +1 @@
+A fake README, to keep npm from polluting stderr.
@@ -0,0 +1,15 @@
+{
+ "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"
+ },
+ "engines": {
+ "node": "~0.10.20"
+ },
+ "dependencies": {
+ "some-crazy-dep-that-doesnt-exist": "*"
+ }
+}

0 comments on commit c75b141

Please sign in to comment.