aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslomo <steve.harrison@gmx.net>2011-04-07 16:00:38 +0200
committerslomo <steve.harrison@gmx.net>2011-04-07 16:00:38 +0200
commit403fc3857079a27600629494aba50da9da1c9953 (patch)
tree5ff9a81a36222e717497ae3c3b5040663834c4f8
parent00f03a2ffec6823ea33cee90e03fb2f9c91113cb (diff)
downloadosm-xapi-403fc3857079a27600629494aba50da9da1c9953.tar.gz
osm-xapi-403fc3857079a27600629494aba50da9da1c9953.tar.xz
osm-xapi-403fc3857079a27600629494aba50da9da1c9953.zip
rewrote bootstrap.sh
-rw-r--r--.gitignore2
-rwxr-xr-xbootstrap.sh72
2 files changed, 32 insertions, 42 deletions
diff --git a/.gitignore b/.gitignore
index c093b4d..7c70a89 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,4 @@
-usr/
+nodejs
# Temp Files #
##############
diff --git a/bootstrap.sh b/bootstrap.sh
index fd458b7..bca7c9d 100755
--- a/bootstrap.sh
+++ b/bootstrap.sh
@@ -1,55 +1,45 @@
-#! /bin/sh
+#! /bin/bash
###########################
# start config
-PREFIX=`pwd`/usr/
-NODE_VERSION=0.3.5
-
-# use full for development
-DEV_TOOLS="node-dev jslint"
+# location of nvm script
+NVM_PATH=nvm/nvm.sh
+# location where node.js will be installed
+export NVM_DIR=$PWD/nodejs
+NODE_VERSION=v0.4.0
+PROJECT_PATH=src/nodejs
# end config
###########################
-export PATH=${PREFIX}/bin:${PATH}
-
-## Download Helper
-# $1 - url
-# $2 - destdir
-download() {
- mkdir -p ${PREFIX}/src
-
- if [ ! -f ${2} ]; then
- echo "!! saving source to $1"
- curl ${1} | tar -x -z -C ${PREFIX}/src
- fi
-}
-
-if [ ! -f ${PREFIX}/bin/node ]; then
- # fetch and compile nodejs
- download http://nodejs.org/dist/node-v${NODE_VERSION}.tar.gz ${PREFIX}/src/node-v${NODE_VERSION}
-
- cd ${PREFIX}/src/node-v${NODE_VERSION}
- ./configure --prefix=${PREFIX}
- make install
- cd ${PREFIX}/..
-else
- echo "!! node already installed"
+# create directory
+mkdir -p $NVM_DIR
+echo $NVM_DIR
+
+# source nvm
+. $NVM_PATH
+nvm sync
+
+# install node if requested
+echo "This will build and install node.js $NODE_VERSION into '$NVM_DIR'."
+read -p "Do you like to proceed? <y/N> " prompt
+if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]
+ then
+ nvm install $NODE_VERSION
+ nvm use $NODE_VERSION
fi
-if [ ! -f ${PREFIX}/bin/npm ];then
- # fetch and compile npm
- curl http://npmjs.org/install.sh | sh
-else
- echo "!! npm already installed"
+# install npm if requested
+read -p "Do you like to install npm? <Y/n> " prompt
+if [[ $prompt == "n" || $prompt == "N" || $prompt == "no" || $prompt == "No" ]]
+ then
+ exit 0;
+ else
+ curl http://npmjs.org/install.sh | sh
fi
-# load development code and compile dependencies
-npm link src/nodejs/
-
-for TOOL in $DEV_TOOLS; do
- npm install $TOOL
-done;
+echo "Download all dependencies for project in $PROJECT_PATH"
+npm link $PROJECT_PATH