Better startup & symlinking

pull/528/head
Egil Moeller 2012-02-26 13:31:47 +01:00
parent 1239ce7f28
commit 758666c3e1
3 changed files with 21 additions and 13 deletions

3
.gitignore vendored
View File

@ -10,3 +10,6 @@ var/dirty.db
bin/convertSettings.json bin/convertSettings.json
*~ *~
*.patch *.patch
src/static/js/jquery.js
src/static/js/prefixfree.js
npm-debug.log

View File

@ -55,7 +55,13 @@ if [ ! -f $settings ]; then
fi fi
echo "Ensure that all dependencies are up to date..." 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 rm -rf node_modules
exit 1 exit 1
} }
@ -63,8 +69,8 @@ npm install || {
echo "Ensure jQuery is downloaded and up to date..." echo "Ensure jQuery is downloaded and up to date..."
DOWNLOAD_JQUERY="true" DOWNLOAD_JQUERY="true"
NEEDED_VERSION="1.7.1" NEEDED_VERSION="1.7.1"
if [ -f "static/js/jquery.js" ]; then if [ -f "src/static/js/jquery.js" ]; then
VERSION=$(cat static/js/jquery.js | head -n 3 | grep -o "v[0-9]\.[0-9]\(\.[0-9]\)\?"); 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 if [ ${VERSION#v} = $NEEDED_VERSION ]; then
DOWNLOAD_JQUERY="false" DOWNLOAD_JQUERY="false"
@ -72,14 +78,14 @@ if [ -f "static/js/jquery.js" ]; then
fi fi
if [ $DOWNLOAD_JQUERY = "true" ]; then 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 fi
echo "Ensure prefixfree is downloaded and up to date..." echo "Ensure prefixfree is downloaded and up to date..."
DOWNLOAD_PREFIXFREE="true" DOWNLOAD_PREFIXFREE="true"
NEEDED_VERSION="1.0.4" NEEDED_VERSION="1.0.4"
if [ -f "static/js/prefixfree.js" ]; then if [ -f "src/static/js/prefixfree.js" ]; then
VERSION=$(cat static/js/prefixfree.js | grep "PrefixFree" | grep -o "[0-9].[0-9].[0-9]"); VERSION=$(cat src/static/js/prefixfree.js | grep "PrefixFree" | grep -o "[0-9].[0-9].[0-9]");
if [ $VERSION = $NEEDED_VERSION ]; then if [ $VERSION = $NEEDED_VERSION ]; then
DOWNLOAD_PREFIXFREE="false" DOWNLOAD_PREFIXFREE="false"
@ -87,7 +93,7 @@ if [ -f "static/js/prefixfree.js" ]; then
fi fi
if [ $DOWNLOAD_PREFIXFREE = "true" ]; then 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 fi
#Remove all minified data to force node creating it new #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" for f in "index" "pad" "timeslider"
do do
if [ ! -f "static/custom/$f.js" ]; then if [ ! -f "src/static/custom/$f.js" ]; then
cp -v "static/custom/js.template" "static/custom/$f.js" || exit 1 cp -v "src/static/custom/js.template" "src/static/custom/$f.js" || exit 1
fi fi
if [ ! -f "static/custom/$f.css" ]; then if [ ! -f "src/static/custom/$f.css" ]; then
cp -v "static/custom/css.template" "static/custom/$f.css" || exit 1 cp -v "src/static/custom/css.template" "src/static/custom/$f.css" || exit 1
fi fi
done done

View File

@ -21,8 +21,7 @@ if [ "$(id -u)" -eq 0 ]; then
fi fi
#prepare the enviroment #prepare the enviroment
#bin/installDeps.sh $* || exit 1 bin/installDeps.sh $* || exit 1
npm link ./src
#Move to the node folder and start #Move to the node folder and start
echo "start..." echo "start..."