Allow use of node from packages

Change-Id: I4718d0b64f553db3453c1b80c0ea455cf1f685bc
This commit is contained in:
Monty Taylor 2014-01-17 12:10:38 -08:00
parent e368068f2e
commit 1695d65992
3 changed files with 26 additions and 10 deletions

View File

@ -19,10 +19,23 @@ rm -fr $workspace_path/.local/
rm -fr $workspace_path/.build/
# Create our working directories
mkdir -p $workspace_path/.local/
mkdir -p $workspace_path/.local/bin/
mkdir -p $workspace_path/.build/
mkdir -p ~/.cache/storyboard
if hash nodejs 2>/dev/null && ! hash node 2>/dev/null; then
ln -s `which nodejs` $workspace_path/.local/bin/node
fi
# If we have npm already, there is no need to download/compile
if hash npm 2>/dev/null; then
# Also, it needs to be new enough - that is, newer than v1 or v1.2
# or v1.2.18. This could almost certainly be improved in some way
if test "$( npm --version | awk -F'.' ' ( $1 > 1 || ( $1 == 1 && $2 > 2 ) || ( $1 == 1 && $2 == 2 && $3 >= 18 ) ) ' )" ; then
exit 0
fi
fi
# Download the source if we don't have it already.
if [ ! -f $node_archive_path ]; then
echo "Downloading Node v$node_version..."

View File

@ -5,15 +5,8 @@
VDISPLAY=99
DIMENSIONS='1280x1024x24'
XVFB=/usr/bin/Xvfb
BIN_DIR="$( cd "$( dirname "$0" )" && pwd )"
WORKSPACE="$(dirname "$BIN_DIR")"
# Add our new bin directory to the PATH
echo "Adding $WORKSPACE/.local/bin to PATH"
export PATH=$WORKSPACE/.local/bin:$PATH
echo "Adding $WORKSPACE/node_modules/.bin to PATH"
export PATH=$WORKSPACE/node_modules/.bin:$PATH
source $(dirname $0)/setenv.sh
cd $WORKSPACE;
echo "Installing build dependencies"
@ -35,4 +28,4 @@ result=$?
pkill Xvfb 2>&1 > /dev/null
set -e
exit $result
exit $result

10
bin/setenv.sh Normal file
View File

@ -0,0 +1,10 @@
#!/bin/bash
BIN_DIR="$( cd "$( dirname "$0" )" && pwd )"
WORKSPACE="$(dirname "$BIN_DIR")"
# Add our new bin directory to the PATH
echo "Adding $WORKSPACE/.local/bin to PATH"
export PATH=$WORKSPACE/.local/bin:$PATH
echo "Adding $WORKSPACE/node_modules/.bin to PATH"
export PATH=$WORKSPACE/node_modules/.bin:$PATH