bunch of fixes to make this script working also under cygwin
(this is useful mostly to run automated ui testing on windows) git-svn-id: http://google-refine.googlecode.com/svn/trunk@471 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
parent
4a06c49a9a
commit
2e1c8e688c
115
gridworks
115
gridworks
@ -87,14 +87,14 @@ load_configs() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
check_macosx() {
|
check_macosx() {
|
||||||
if [ "$SYSTEM" != 'Darwin' ]; then
|
if $DARWIN ; then
|
||||||
error "This action can only run on MacOSX"
|
error "This action can only run on MacOSX"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
check_downloaders() {
|
check_downloaders() {
|
||||||
CURL="`which curl`"
|
CURL="`which curl 2> /dev/null`"
|
||||||
WGET="`which wget`"
|
WGET="`which wget 2> /dev/null`"
|
||||||
|
|
||||||
if [ -z "$CURL" -a -z "$WGET" ]; then
|
if [ -z "$CURL" -a -z "$WGET" ]; then
|
||||||
error "We need either 'curl' or 'wget' present in PATH to download external dependencies."
|
error "We need either 'curl' or 'wget' present in PATH to download external dependencies."
|
||||||
@ -102,7 +102,7 @@ check_downloaders() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
check_unzip() {
|
check_unzip() {
|
||||||
UNZIP="`which unzip`"
|
UNZIP="`which unzip 2> /dev/null`"
|
||||||
|
|
||||||
if [ -z "$UNZIP" ]; then
|
if [ -z "$UNZIP" ]; then
|
||||||
error "We need 'unzip' present in PATH to expand external dependencies."
|
error "We need 'unzip' present in PATH to expand external dependencies."
|
||||||
@ -110,9 +110,9 @@ check_unzip() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
check_python() {
|
check_python() {
|
||||||
PYTHON="`which python`"
|
PYTHON="`which python 2> /dev/null`"
|
||||||
if [ -z "$PYTHON" ]; then
|
if [ -z "$PYTHON" ]; then
|
||||||
error "This action requires you to have 'python' installed. You can download it for free at http://www.python.org/"
|
error "This action requires you to have 'python' installed and present in your PATH. You can download it for free at http://www.python.org/"
|
||||||
fi
|
fi
|
||||||
PYTHON_VERSION="`python --version 2>&1 | cut -f 2 -d ' ' | cut -f 1,2 -d .`"
|
PYTHON_VERSION="`python --version 2>&1 | cut -f 2 -d ' ' | cut -f 1,2 -d .`"
|
||||||
if [ "$PYTHON_VERSION" != "2.5" -a "$PYTHON_VERSION" != "2.6" ]; then
|
if [ "$PYTHON_VERSION" != "2.5" -a "$PYTHON_VERSION" != "2.6" ]; then
|
||||||
@ -191,7 +191,7 @@ load_data() {
|
|||||||
FILE=$1
|
FILE=$1
|
||||||
NAME=$2
|
NAME=$2
|
||||||
URL="http://${GRIDWORKS_HOST}:${GRIDWORKS_PORT}/command/create-project-from-upload"
|
URL="http://${GRIDWORKS_HOST}:${GRIDWORKS_PORT}/command/create-project-from-upload"
|
||||||
CURL="`which curl`"
|
CURL="`which curl 2> /dev/null`"
|
||||||
|
|
||||||
if [ -z "$CURL" ]; then
|
if [ -z "$CURL" ]; then
|
||||||
error "We need 'curl' present in PATH to upload data to gridworks."
|
error "We need 'curl' present in PATH to upload data to gridworks."
|
||||||
@ -222,11 +222,13 @@ tools_prepare() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ant_prepare() {
|
ant_prepare() {
|
||||||
|
tools_prepare
|
||||||
|
|
||||||
ANT_URL="http://www.apache.org/dist/ant/binaries/apache-ant-1.8.0-bin.tar.gz"
|
ANT_URL="http://www.apache.org/dist/ant/binaries/apache-ant-1.8.0-bin.tar.gz"
|
||||||
ANT_FILE=`echo $ANT_URL | sed 's|.*/||'`
|
ANT_FILE=`echo $ANT_URL | sed 's|.*/||'`
|
||||||
ANT_DIR="apache-ant-1.8.0"
|
ANT_DIR="apache-ant-1.8.0"
|
||||||
|
|
||||||
ANT=`which ant`
|
ANT="`which ant 2> /dev/null`"
|
||||||
if [ -z "$ANT" ]; then
|
if [ -z "$ANT" ]; then
|
||||||
if [ -z "$ANT_HOME" ]; then
|
if [ -z "$ANT_HOME" ]; then
|
||||||
cd $GRIDWORKS_TOOLS_DIR
|
cd $GRIDWORKS_TOOLS_DIR
|
||||||
@ -237,6 +239,9 @@ ant_prepare() {
|
|||||||
tar xzf $ANT_FILE -C . || error "Error while expanding $ANT_FILE"
|
tar xzf $ANT_FILE -C . || error "Error while expanding $ANT_FILE"
|
||||||
fi
|
fi
|
||||||
export ANT_HOME="`pwd`/$ANT_DIR"
|
export ANT_HOME="`pwd`/$ANT_DIR"
|
||||||
|
if $CYGWIN ; then
|
||||||
|
export ANT_HOME=`cygpath --unix "$ANT_HOME"`
|
||||||
|
fi
|
||||||
cd ..
|
cd ..
|
||||||
fi
|
fi
|
||||||
ANT="$ANT_HOME/bin/ant"
|
ANT="$ANT_HOME/bin/ant"
|
||||||
@ -272,26 +277,41 @@ virtualenv_prepare() {
|
|||||||
|
|
||||||
tool_download $VIRTUALENV_URL $VIRTUALENV_FILE $VIRTUALENV_DIR
|
tool_download $VIRTUALENV_URL $VIRTUALENV_FILE $VIRTUALENV_DIR
|
||||||
|
|
||||||
if [ ! -d "$GRIDWORKS_TOOLS_DIR/python" ]; then
|
PYTHON_LOCAL="$GRIDWORKS_TOOLS_DIR/python"
|
||||||
$PYTHON $GRIDWORKS_TOOLS_DIR/$VIRTUALENV_DIR/virtualenv.py $GRIDWORKS_TOOLS_DIR/python
|
if $CYGWIN ; then
|
||||||
|
PYTHON_LOCAL="${PYTHON_LOCAL}_win"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
PYTHON_HOME="`pwd`/$GRIDWORKS_TOOLS_DIR/python"
|
if [ ! -d "$PYTHON_LOCAL" ]; then
|
||||||
PYTHON="$PYTHON_HOME/bin/python"
|
$PYTHON $GRIDWORKS_TOOLS_DIR/$VIRTUALENV_DIR/virtualenv.py $PYTHON_LOCAL
|
||||||
PYTHON_INSTALL="$PYTHON_HOME/bin/easy_install"
|
fi
|
||||||
|
|
||||||
|
PYTHON_HOME="`pwd`/$PYTHON_LOCAL"
|
||||||
|
|
||||||
|
if $CYGWIN ; then
|
||||||
|
PYTHON="$PYTHON_HOME/Scripts/python.exe"
|
||||||
|
PYTHON_INSTALL="$PYTHON_HOME/Scripts/easy_install.exe"
|
||||||
|
else
|
||||||
|
PYTHON="$PYTHON_HOME/bin/python"
|
||||||
|
PYTHON_INSTALL="$PYTHON_HOME/bin/easy_install"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
windmill_prepare() {
|
windmill_prepare() {
|
||||||
WINDMILL="`which windmill`"
|
WINDMILL="`which windmill 2> /dev/null`"
|
||||||
if [ -z "$WINDMILL" ]; then
|
if [ -z "$WINDMILL" ]; then
|
||||||
check_python
|
check_python
|
||||||
tools_prepare
|
tools_prepare
|
||||||
|
virtualenv_prepare
|
||||||
|
|
||||||
WINDMILL="$GRIDWORKS_TOOLS_DIR/windmill"
|
if $CYGWIN ; then
|
||||||
|
WINDMILL="$PYTHON_HOME/Scripts/windmill.exe"
|
||||||
|
else
|
||||||
|
WINDMILL="$PYTHON_HOME/bin/windmill"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ ! -f "$WINDMILL" ]; then
|
if [ ! -f "$WINDMILL" ]; then
|
||||||
virtualenv_prepare
|
|
||||||
$PYTHON_INSTALL windmill
|
$PYTHON_INSTALL windmill
|
||||||
ln -s $PYTHON_HOME/bin/windmill $GRIDWORKS_TOOLS_DIR/windmill
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -334,7 +354,7 @@ ant() {
|
|||||||
|
|
||||||
#export ANT_OPTS="-Xmx1024M"
|
#export ANT_OPTS="-Xmx1024M"
|
||||||
|
|
||||||
$ANT -f build.xml $ANT_PARAMS -Dbuild.dir="$GRIDWORKS_BUILD_DIR" -Ddist.dir="$GRIDWORKS_DIST_DIR" -Dversion="$VERSION" -Dnum_version="$NUM_VERSION" -Drevision="$REVISION" $1 || error "Error while running ant task '$1'"
|
"$ANT" -f build.xml $ANT_PARAMS -Dbuild.dir="$GRIDWORKS_BUILD_DIR" -Ddist.dir="$GRIDWORKS_DIST_DIR" -Dversion="$VERSION" -Dnum_version="$NUM_VERSION" -Drevision="$REVISION" $1 || error "Error while running ant task '$1'"
|
||||||
}
|
}
|
||||||
|
|
||||||
# ----------------------------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------------------------
|
||||||
@ -462,6 +482,10 @@ ui_test() {
|
|||||||
|
|
||||||
echo "Waiting for Gridworks to load..."
|
echo "Waiting for Gridworks to load..."
|
||||||
sleep 5
|
sleep 5
|
||||||
|
check_running
|
||||||
|
if [ ! -z "$NOT_RUNNING" ]; then
|
||||||
|
sleep 10
|
||||||
|
fi
|
||||||
echo "... proceed with the tests."
|
echo "... proceed with the tests."
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
@ -490,7 +514,7 @@ server_test() {
|
|||||||
echo ""
|
echo ""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
CLASSPATH="$GRIDWORKS_BUILD_DIR/classes:$GRIDWORKS_WEBAPP/WEB-INF/classes:$GRIDWORKS_TEST_DIR/java/classes:$GRIDWORKS_TEST_DIR/java/lib/*:$GRIDWORKS_LIB_DIR/*:$GRIDWORKS_WEBAPP/WEB-INF/lib/*"
|
CLASSPATH="$GRIDWORKS_BUILD_DIR/classes${SEP}$GRIDWORKS_WEBAPP/WEB-INF/classes${SEP}$GRIDWORKS_TEST_DIR/java/classes${SEP}$GRIDWORKS_TEST_DIR/java/lib/*${SEP}$GRIDWORKS_LIB_DIR/*${SEP}$GRIDWORKS_WEBAPP/WEB-INF/lib/*"
|
||||||
|
|
||||||
if [ -z "$1" ]; then
|
if [ -z "$1" ]; then
|
||||||
cd $GRIDWORKS_TEST_DIR/java/classes
|
cd $GRIDWORKS_TEST_DIR/java/classes
|
||||||
@ -529,7 +553,7 @@ run() {
|
|||||||
add_option "-Dgridworks.autoreloading=true"
|
add_option "-Dgridworks.autoreloading=true"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$SYSTEM" = 'Darwin' ]; then
|
if $DARWIN ; then
|
||||||
add_option "-Xdock:name=Gridworks -Xdock:icon=src/graphics/icon/gridworks.icns"
|
add_option "-Xdock:name=Gridworks -Xdock:icon=src/graphics/icon/gridworks.icns"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -537,12 +561,12 @@ run() {
|
|||||||
add_option "-Dgridworks.data_dir=$GRIDWORKS_DATA_DIR"
|
add_option "-Dgridworks.data_dir=$GRIDWORKS_DATA_DIR"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
CLASSPATH="$GRIDWORKS_BUILD_DIR/classes:$GRIDWORKS_LIB_DIR/*"
|
CLASSPATH="$GRIDWORKS_BUILD_DIR/classes${SEP}$GRIDWORKS_LIB_DIR/*"
|
||||||
|
|
||||||
RUN_CMD="$JAVA -cp $CLASSPATH $OPTS com.metaweb.gridworks.Gridworks"
|
RUN_CMD="$JAVA -cp $CLASSPATH $OPTS com.metaweb.gridworks.Gridworks"
|
||||||
|
|
||||||
#echo "$RUN_CMD"
|
#echo "$RUN_CMD"
|
||||||
#echo ""
|
#cd tooecho ""
|
||||||
|
|
||||||
echo "Starting Gridworks at 'http://${GRIDWORKS_HOST}:${GRIDWORKS_PORT}/'"
|
echo "Starting Gridworks at 'http://${GRIDWORKS_HOST}:${GRIDWORKS_PORT}/'"
|
||||||
echo ""
|
echo ""
|
||||||
@ -550,7 +574,7 @@ run() {
|
|||||||
if [ -z "$FORK" ]; then
|
if [ -z "$FORK" ]; then
|
||||||
exec $RUN_CMD
|
exec $RUN_CMD
|
||||||
else
|
else
|
||||||
sh -c "$RUN_CMD" &
|
$RUN_CMD &
|
||||||
GRIDWORKS_PID="$!"
|
GRIDWORKS_PID="$!"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -561,7 +585,7 @@ execute() {
|
|||||||
echo ""
|
echo ""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
CLASSPATH="$GRIDWORKS_BUILD_DIR/classes:$GRIDWORKS_LIB_DIR/*"
|
CLASSPATH="$GRIDWORKS_BUILD_DIR/classes${SEP}$GRIDWORKS_LIB_DIR/*"
|
||||||
|
|
||||||
RUN_CMD="$JAVA -cp $CLASSPATH $OPTS $*"
|
RUN_CMD="$JAVA -cp $CLASSPATH $OPTS $*"
|
||||||
|
|
||||||
@ -617,29 +641,44 @@ cd `dirname $0`
|
|||||||
|
|
||||||
OPTS=""
|
OPTS=""
|
||||||
|
|
||||||
|
# ---- OS-specific support --------------------------------------
|
||||||
|
|
||||||
SYSTEM=`uname`
|
SYSTEM=`uname`
|
||||||
|
|
||||||
|
CYGWIN=false
|
||||||
|
DARWIN=false
|
||||||
|
case "$SYSTEM" in
|
||||||
|
CYGWIN*) CYGWIN=true ;;
|
||||||
|
Darwin*) DARWIN=true ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
SEP=":"
|
||||||
|
if $CYGWIN ; then
|
||||||
|
SEP=";"
|
||||||
|
fi
|
||||||
|
|
||||||
# ----- Load configurations -------------------------------------
|
# ----- Load configurations -------------------------------------
|
||||||
|
|
||||||
load_configs gridworks.ini
|
load_configs gridworks.ini
|
||||||
|
|
||||||
# ----- Make sure there is an appropriate java environment is available -------------
|
# ----- Make sure there is an appropriate java environment is available -------------
|
||||||
|
|
||||||
if [ "$SYSTEM" = 'Darwin' ] && [ -z "$JAVA_HOME" ]; then
|
if $DARWIN ; then
|
||||||
# Mac OS X defaults to Java 5. So update JAVA_HOME unless the user manually set it.
|
if [ -z "$JAVA_HOME" ]; then
|
||||||
export JAVA_HOME="/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home"
|
# Mac OS X defaults to Java 5. So update JAVA_HOME unless the user manually set it.
|
||||||
JAVA="$JAVA_HOME/bin/java"
|
export JAVA_HOME="/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home"
|
||||||
else
|
fi
|
||||||
JAVA=`which java`
|
fi
|
||||||
if [ -z "$JAVA" ]; then
|
|
||||||
if [ "$JAVA_HOME" ]; then
|
JAVA="`which java 2> /dev/null`"
|
||||||
JAVA="$JAVA_HOME/bin/java"
|
if [ -z "$JAVA" ]; then
|
||||||
if [ ! -f "$JAVA" ] ; then
|
if [ "$JAVA_HOME" ]; then
|
||||||
error "Could not find the 'java' executable at '$JAVA', are you sure your JAVA_HOME environment variable is pointing to a proper java installation?"
|
JAVA="$JAVA_HOME/bin/java"
|
||||||
fi
|
if [ ! -f "$JAVA" ] ; then
|
||||||
else
|
error "Could not find the 'java' executable at '$JAVA', are you sure your JAVA_HOME environment variable is pointing to a proper java installation?"
|
||||||
error "The 'java' command should be in your path or the 'JAVA_HOME' environment variable should be set"
|
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
error "The 'java' command should be in your path or the 'JAVA_HOME' environment variable should be set"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user