Commit bb5f09e8 authored by zeke's avatar zeke

remove some comments, add some comments

parent 51a28bdb
...@@ -8,13 +8,10 @@ set -e ...@@ -8,13 +8,10 @@ set -e
download_and_install_node() { download_and_install_node() {
version="$1" version="$1"
status "Downloading and installing node v$version"
status "Downloading node $version"
node_url="http://s3pository.heroku.com/node/v$version/node-v$version-linux-x64.tar.gz" node_url="http://s3pository.heroku.com/node/v$version/node-v$version-linux-x64.tar.gz"
curl $node_url -s -o - | tar xzf - -C $build_dir curl $node_url -s -o - | tar xzf - -C $build_dir
mv $build_dir/node-v$version-linux-x64 $build_dir/node mv $build_dir/node-v$version-linux-x64 $build_dir/node
status "Adding node and npm to \$PATH"
chmod +x $build_dir/node/bin/* chmod +x $build_dir/node/bin/*
PATH=$PATH:$build_dir/node/bin PATH=$PATH:$build_dir/node/bin
} }
...@@ -44,18 +41,15 @@ error() { ...@@ -44,18 +41,15 @@ error() {
exit 1 exit 1
} }
function status() { status() {
echo "-----> $*" echo "-----> $*"
} }
function mktmpdir() {
dir=$(mktemp -t node-$1-XXXX)
rm -rf $dir
mkdir -p $dir
echo $dir
}
function indent() { # sed -l basically makes sed replace and buffer through stdin to stdout
# so you get updates while the command runs and dont wait for the end
# e.g. npm install | indent
indent() {
c='s/^/ /' c='s/^/ /'
case $(uname) in case $(uname) in
Darwin) sed -l "$c";; Darwin) sed -l "$c";;
...@@ -64,7 +58,5 @@ function indent() { ...@@ -64,7 +58,5 @@ function indent() {
} }
function cat_npm_debug_log() { function cat_npm_debug_log() {
if [ -f $BUILD_DIR/npm-debug.log ]; then [ -f $build_dir/npm-debug.log ] && cat $build_dir/npm-debug.log
cat $BUILD_DIR/npm-debug.log
fi
} }
...@@ -8,9 +8,10 @@ stable_version="0.10.18" ...@@ -8,9 +8,10 @@ stable_version="0.10.18"
source $bp_dir/bin/common.sh source $bp_dir/bin/common.sh
# Output debug info on exit # Output debug info on exit
# trap cat_npm_debug_log EXIT trap cat_npm_debug_log EXIT
status "Downloading node version $stable_version" # Bootstrap the build process with latest stable version of node
# We'll use it to parse package.json and do semver detection
download_and_install_node $stable_version download_and_install_node $stable_version
# Is a node version specified in package.json? # Is a node version specified in package.json?
...@@ -20,21 +21,21 @@ determine_requested_version() { ...@@ -20,21 +21,21 @@ determine_requested_version() {
} }
requested_version=$(determine_requested_version) requested_version=$(determine_requested_version)
# Give a warning if no node engine is specified # Give a warning if engines.node is unspecified
if ! test $requested_version; then if ! test $requested_version; then
node_version=$stable_version node_version=$stable_version
echo echo
echo "WARNING: No node version specified in package.json, see:" | indent echo "WARNING: No node version specified in package.json, see:" | indent
echo "https://devcenter.heroku.com/articles/nodejs-support#versions" | indent echo "https://devcenter.heroku.com/articles/nodejs-support#versions" | indent
echo echo
status "Using latest stable node version $stable_version" status "Defaulting to node v$stable_version (latest stable)"
else else
# Does the already-downloaded stable version of node satisfy the requested version? # Does the already-downloaded stable version of node satisfy the requested version?
default_satisfies=$(node $bp_dir/vendor/semver/bin/semver -v "${stable_version}" -r "${requested_version}" || echo "") default_satisfies=$(node $bp_dir/vendor/semver/bin/semver -v "${stable_version}" -r "${requested_version}" || echo "")
if test $default_satisfies; then if test $default_satisfies; then
status "Using latest stable node version $stable_version" status "Using node v$stable_version"
node_version=$stable_version node_version=$stable_version
else else
# Find all available versions from nodejs.org/dist # Find all available versions from nodejs.org/dist
...@@ -50,7 +51,6 @@ else ...@@ -50,7 +51,6 @@ else
node_version=$(echo $evaluated_versions | tail -n 1) node_version=$(echo $evaluated_versions | tail -n 1)
if test $node_version; then if test $node_version; then
status "Using node version $node_version"
download_and_install_node $node_version download_and_install_node $node_version
else else
error "Requested node version ${requested_version} not found among available versions on nodejs.org/dist" error "Requested node version ${requested_version} not found among available versions on nodejs.org/dist"
......
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