From 758666c3e145fdae361da20751bca1e891d6f49a Mon Sep 17 00:00:00 2001 From: Egil Moeller Date: Sun, 26 Feb 2012 13:31:47 +0100 Subject: [PATCH] Better startup & symlinking --- .gitignore | 3 +++ bin/installDeps.sh | 28 +++++++++++++++++----------- bin/run.sh | 3 +-- 3 files changed, 21 insertions(+), 13 deletions(-) diff --git a/.gitignore b/.gitignore index 6b1e54c64..64ed357b6 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,6 @@ var/dirty.db bin/convertSettings.json *~ *.patch +src/static/js/jquery.js +src/static/js/prefixfree.js +npm-debug.log diff --git a/bin/installDeps.sh b/bin/installDeps.sh index 270ec98cd..640f5b132 100755 --- a/bin/installDeps.sh +++ b/bin/installDeps.sh @@ -55,7 +55,13 @@ if [ ! -f $settings ]; then fi echo "Ensure that all dependencies are up to date..." -npm install || { +( + mkdir -p node_modules + cd node_modules + [ -e pluginomatic_etherpad-lite ] || ln -s ../src pluginomatic_etherpad-lite + cd pluginomatic_etherpad-lite + npm install +) || { rm -rf node_modules exit 1 } @@ -63,8 +69,8 @@ npm install || { echo "Ensure jQuery is downloaded and up to date..." DOWNLOAD_JQUERY="true" NEEDED_VERSION="1.7.1" -if [ -f "static/js/jquery.js" ]; then - VERSION=$(cat static/js/jquery.js | head -n 3 | grep -o "v[0-9]\.[0-9]\(\.[0-9]\)\?"); +if [ -f "src/static/js/jquery.js" ]; then + VERSION=$(cat src/static/js/jquery.js | head -n 3 | grep -o "v[0-9]\.[0-9]\(\.[0-9]\)\?"); if [ ${VERSION#v} = $NEEDED_VERSION ]; then DOWNLOAD_JQUERY="false" @@ -72,14 +78,14 @@ if [ -f "static/js/jquery.js" ]; then fi if [ $DOWNLOAD_JQUERY = "true" ]; then - curl -lo static/js/jquery.js http://code.jquery.com/jquery-$NEEDED_VERSION.js || exit 1 + curl -lo src/static/js/jquery.js http://code.jquery.com/jquery-$NEEDED_VERSION.js || exit 1 fi echo "Ensure prefixfree is downloaded and up to date..." DOWNLOAD_PREFIXFREE="true" NEEDED_VERSION="1.0.4" -if [ -f "static/js/prefixfree.js" ]; then - VERSION=$(cat static/js/prefixfree.js | grep "PrefixFree" | grep -o "[0-9].[0-9].[0-9]"); +if [ -f "src/static/js/prefixfree.js" ]; then + VERSION=$(cat src/static/js/prefixfree.js | grep "PrefixFree" | grep -o "[0-9].[0-9].[0-9]"); if [ $VERSION = $NEEDED_VERSION ]; then DOWNLOAD_PREFIXFREE="false" @@ -87,7 +93,7 @@ if [ -f "static/js/prefixfree.js" ]; then fi if [ $DOWNLOAD_PREFIXFREE = "true" ]; then - curl -lo static/js/prefixfree.js -k https://raw.github.com/LeaVerou/prefixfree/master/prefixfree.js || exit 1 + curl -lo src/static/js/prefixfree.js -k https://raw.github.com/LeaVerou/prefixfree/master/prefixfree.js || exit 1 fi #Remove all minified data to force node creating it new @@ -98,12 +104,12 @@ echo "ensure custom css/js files are created..." for f in "index" "pad" "timeslider" do - if [ ! -f "static/custom/$f.js" ]; then - cp -v "static/custom/js.template" "static/custom/$f.js" || exit 1 + if [ ! -f "src/static/custom/$f.js" ]; then + cp -v "src/static/custom/js.template" "src/static/custom/$f.js" || exit 1 fi - if [ ! -f "static/custom/$f.css" ]; then - cp -v "static/custom/css.template" "static/custom/$f.css" || exit 1 + if [ ! -f "src/static/custom/$f.css" ]; then + cp -v "src/static/custom/css.template" "src/static/custom/$f.css" || exit 1 fi done diff --git a/bin/run.sh b/bin/run.sh index 74a16395e..296b6754c 100755 --- a/bin/run.sh +++ b/bin/run.sh @@ -21,8 +21,7 @@ if [ "$(id -u)" -eq 0 ]; then fi #prepare the enviroment -#bin/installDeps.sh $* || exit 1 -npm link ./src +bin/installDeps.sh $* || exit 1 #Move to the node folder and start echo "start..."