aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEgil Moeller <egil.moller@freecode.no>2010-04-05 19:37:52 +0200
committerEgil Moeller <egil.moller@freecode.no>2010-04-05 19:37:52 +0200
commit180dbf215a65c924be4801b159db263d85c58d07 (patch)
tree610f5675e50b5373a525ec6ebe9f9d9a2a1f9378
parentceaf334e40ea01d58a5ace5417b9c6df78fe31e8 (diff)
parenta057a37ce3ec2621fbfaadaea083aef0bd5180cc (diff)
downloadetherpad-180dbf215a65c924be4801b159db263d85c58d07.tar.gz
etherpad-180dbf215a65c924be4801b159db263d85c58d07.tar.xz
etherpad-180dbf215a65c924be4801b159db263d85c58d07.zip
Merge branch 'master' of git://github.com/cjb/pad
-rwxr-xr-xetherpad/bin/rebuildjar.sh97
-rw-r--r--etherpad/src/etherpad/globals.js4
-rw-r--r--etherpad/src/etherpad/pne/pne_utils.js3
-rw-r--r--etherpad/src/main.js3
-rw-r--r--infrastructure/bin/compilecache.sh84
-rw-r--r--infrastructure/net.appjet.oui/config.scala2
6 files changed, 141 insertions, 52 deletions
diff --git a/etherpad/bin/rebuildjar.sh b/etherpad/bin/rebuildjar.sh
index fc05194..acd57d2 100755
--- a/etherpad/bin/rebuildjar.sh
+++ b/etherpad/bin/rebuildjar.sh
@@ -17,15 +17,99 @@
bin/java-version.sh
if [ -z "$JAR" ]; then
- if [ ! -z `which fastjar` ]; then
- JAR=fastjar
+ if [ ! -z $(which fastjar 2>/dev/null) ]; then
+ # http://lists.gnu.org/archive/html/fastjar-dev/2009-12/msg00000.html
+ version=`fastjar --version | grep fastjar | sed 's/.* //g'`
+ if [[ "$version" = "0.97" || "$version" = "0.98" ]]; then
+ echo "fastjar version $version can't build EtherPad. Falling back to standard jar."
+ JAR=jar
+ else
+ JAR=fastjar
+ fi
else
JAR=jar
fi
fi
+[ -z "$JAVA_HOME" ] && read -p "\$JAVA_HOME is not set, please enter the path to your Java installation: " JAVA_HOME
+if [ ! -e "$JAVA_HOME" ]; then
+ echo "The path to \$JAVA_HOME ($JAVA_HOME) does not exist, please check and try again."
+ exit 1
+else
+ export JAVA_HOME
+fi
+
+[ -z "$SCALA_HOME" ] && read -p "\$SCALA_HOME is not set, please enter the path to your Scala installation: " SCALA_HOME
+if [ ! -e "$SCALA_HOME" ]; then
+ echo "The path to \$SCALA_HOME ($SCALA_HOME) does not exist, please check and try again."
+ exit 1
+else
+ export SCALA_HOME
+fi
+
+if [ -z "$SCALA" ]; then
+ if [ `which scala 2>/dev/null 1>/dev/null` ]; then
+ SCALA=`which scala`
+ echo "Using 'scala' binary found at $SCALA. Set \$SCALA to use another one."
+ elif [ -x "$SCALA_HOME/bin/scala" ]; then
+ SCALA="$SCALA_HOME/bin/scala"
+ echo "Using 'scala' binary found at $SCALA. Set \$SCALA to use another one."
+ else
+ read -p "\$SCALA is not set and the 'scala' binary could not be found, please enter the path to the file: " SCALA
+ fi
+fi
+if [ ! -x "$SCALA" ]; then
+ echo "The path to \$SCALA ($SCALA) is not an executable file, please check and try again."
+ exit 1
+else
+ export SCALA
+fi
+
+if [ -z "$JAVA" ]; then
+ if [ `which java 2>/dev/null 1>/dev/null` ]; then
+ JAVA=`which java`
+ echo "Using 'java' binary found at $JAVA. Set \$JAVA to use another one."
+ elif [ -x "$JAVA_HOME/bin/java" ]; then
+ JAVA="$JAVA_HOME/bin/java"
+ echo "Using 'java' binary found at $JAVA. Set \$JAVA to use another one."
+ else
+ read -p "\$JAVA is not set and the 'java' binary could not be found, please enter the path to the file: " JAVA
+ fi
+fi
+if [ ! -x "$JAVA" ]; then
+ echo "The path to \$JAVA ($JAVA) is not an executeable file, please check and try again."
+ exit 1
+else
+ export JAVA
+fi
+
+[ -z "$MYSQL_CONNECTOR_JAR" ] && read -p "\$MYSQL_CONNECTOR_JAR is not set, please enter the path to the MySQL JDBC driver .jar file: " MYSQL_CONNECTOR_JAR
+if [ ! -e "$MYSQL_CONNECTOR_JAR" ]; then
+ echo "The path to \$MYSQL_CONNECTOR_JAR ($MYSQL_CONNECTOR_JAR) does not exist, please check and try again."
+ exit 1
+else
+ export MYSQL_CONNECTOR_JAR
+fi
+
+# Check for javac version. Unfortunately, javac doesn't tell you whether
+# it's Sun Java or OpenJDK, but the "java" binary that's in the same
+# directory will.
+if [ -e "$JAVA_HOME/bin/java" ]; then
+ ($JAVA_HOME/bin/java -version 2>&1) | {
+ while read file; do
+ javaver=$file
+ done
+ for word in $javaver; do
+ if [ $word != "Java" ]; then
+ echo "$JAVA_HOME/bin/java is from a non-Sun compiler, and may not be able to compile EtherPad. If you get syntax errors, you should point \$JAVA_HOME at a Sun Java JDK installation instead."
+ fi
+ break
+ done
+ }
+fi
+
function notify {
- if [ ! -z `which growlnotify` ]; then
+ if [ ! -z $(which growlnotify 2>/dev/null) ]; then
echo $0 finished | growlnotify
fi
}
@@ -33,10 +117,9 @@ trap notify EXIT
source ../infrastructure/bin/compilecache.sh
-suffix="-dev";
-if [ "$1" == "prod" ]; then
- suffix="";
- shift;
+if [ "$1" == "dev" ]; then
+ suffix="-dev";
+ shift
fi
OWD=`pwd`
diff --git a/etherpad/src/etherpad/globals.js b/etherpad/src/etherpad/globals.js
index 53a3f95..87fe428 100644
--- a/etherpad/src/etherpad/globals.js
+++ b/etherpad/src/etherpad/globals.js
@@ -23,8 +23,10 @@ var COMETPATH = "/comet";
var COLOR_PALETTE = ['#ffc7c7','#fff1c7','#e3ffc7','#c7ffd5','#c7ffff','#c7d5ff','#e3c7ff','#ffc7f1','#ff8f8f','#ffe38f','#c7ff8f','#8fffab','#8fffff','#8fabff','#c78fff','#ff8fe3','#d97979','#d9c179','#a9d979','#79d991','#79d9d9','#7991d9','#a979d9','#d979c1','#d9a9a9','#d9cda9','#c1d9a9','#a9d9b5','#a9d9d9','#a9b5d9','#c1a9d9','#d9a9cd'];
+var trueRegex = /\s*true\s*/i;
+
function isProduction() {
- return (appjet.config['etherpad.isProduction'] == "true");
+ return (trueRegex.test(appjet.config['etherpad.isProduction']));
}
function isProAccountEnabled() {
diff --git a/etherpad/src/etherpad/pne/pne_utils.js b/etherpad/src/etherpad/pne/pne_utils.js
index 3169407..bc105bd 100644
--- a/etherpad/src/etherpad/pne/pne_utils.js
+++ b/etherpad/src/etherpad/pne/pne_utils.js
@@ -72,7 +72,8 @@ function checkDbVersionUpgrade() {
var dbVersion = parseVersionString(dbVersionString);
var runningVersion = getVersionNumbers();
- var force = (appjet.config['etherpad.forceDbUpgrade'] == "true");
+ var trueRegex = /\s*true\s*/i;
+ var force = trueRegex.test(appjet.config['etherpad.forceDbUpgrade']);
if (!force && (runningVersion.major != dbVersion.major)) {
println("Error: you are attempting to update an EtherPad["+dbVersionString+
diff --git a/etherpad/src/main.js b/etherpad/src/main.js
index 2d92a1a..6faa71a 100644
--- a/etherpad/src/main.js
+++ b/etherpad/src/main.js
@@ -258,7 +258,8 @@ function checkRequestIsWellFormed() {
// checkHost()
//----------------------------------------------------------------
function checkHost() {
- if (appjet.config['etherpad.skipHostnameCheck'] == "true") {
+ var trueRegex = /\s*true\s*/i;
+ if (trueRegex.test(appjet.config['etherpad.skipHostnameCheck'])) {
return;
}
diff --git a/infrastructure/bin/compilecache.sh b/infrastructure/bin/compilecache.sh
index a2b6220..6e42a50 100644
--- a/infrastructure/bin/compilecache.sh
+++ b/infrastructure/bin/compilecache.sh
@@ -16,49 +16,51 @@
CP_CMD="cp -R -u"
if [ `uname` == "Darwin" ]; then
- CP_CMD="/bin/cp -R -n"
+ CP_CMD="/bin/cp -R -n"
+elif [ `uname` == "SunOS" ]; then
+ CP_CMD="cp -R" #Solaris cp does not have '-u'
fi
function cacheonfiles {
- NAME=$1; FILES=$2; FUNC=$3; NOCOPY=1;
- if [ -z "$4" ]; then
- NOCOPY=0
- fi
- REBUILD=0
- BPATH=buildcache/$NAME
- FILETEST=$BPATH/t
- if [ ! -f $FILETEST ]; then
- REBUILD=1
- else
- for a in $FILES; do
- if [ $FILETEST -ot $a ]; then
- echo $a has changed, rebuilding $NAME
+ NAME=$1; FILES=$2; FUNC=$3; NOCOPY=1;
+ if [ -z "$4" ]; then
+ NOCOPY=0
+ fi
+ REBUILD=0
+ BPATH=buildcache/$NAME
+ FILETEST=$BPATH/t
+ if [ ! -f $FILETEST ]; then
REBUILD=1
- fi
- done
- fi
- if [ $REBUILD -eq 1 ]; then
- if [ -d $BPATH ]; then
- rm -rf $BPATH
+ else
+ for a in $FILES; do
+ if [ $FILETEST -ot $a ]; then
+ echo $a has changed, rebuilding $NAME
+ REBUILD=1
+ fi
+ done
+ fi
+ if [ $REBUILD -eq 1 ]; then
+ if [ -d $BPATH ]; then
+ rm -rf $BPATH
+ fi
+ mkdir -p $BPATH
+ $FUNC $BPATH
+ pushd $BPATH >> /dev/null
+ touch t
+ popd >> /dev/null
+ else
+ echo using cached $NAME...
+ fi
+ if [ $NOCOPY -ne 1 ]; then
+ for a in $BPATH/*; do
+ if [ -d $a ]; then
+ $CP_CMD $a build/
+ elif [ -f $a ]; then
+ cp $a build/
+ else
+ echo unknown file type $a
+ exit 1
+ fi
+ done
fi
- mkdir -p $BPATH
- $FUNC $BPATH
- pushd $BPATH >> /dev/null
- touch t
- popd >> /dev/null
- else
- echo using cached $NAME...
- fi
- if [ $NOCOPY -ne 1 ]; then
- for a in $BPATH/*; do
- if [ -d $a ]; then
- $CP_CMD $a build/
- elif [ -f $a ]; then
- cp $a build/
- else
- echo unknown file type $a
- exit 1
- fi
- done
- fi
-}
+}
diff --git a/infrastructure/net.appjet.oui/config.scala b/infrastructure/net.appjet.oui/config.scala
index 46e73cf..6201816 100644
--- a/infrastructure/net.appjet.oui/config.scala
+++ b/infrastructure/net.appjet.oui/config.scala
@@ -41,7 +41,7 @@ object config {
null;
}
}
- def boolOrElse(name: String, default: Boolean) = values.get(name).map(_.equals("true")).getOrElse(default);
+ def boolOrElse(name: String, default: Boolean) = values.get(name).map(_.matches("(?i)\\s*true\\s*")).getOrElse(default);
def intOrElse(name: String, default: Int) = values.get(name).map(Integer.parseInt(_)).getOrElse(default);
def longOrElse(name: String, default: Long) = values.get(name).map(java.lang.Long.parseLong(_)).getOrElse(default);