2015-01-23 16:29:43 +01:00
#!/bin/bash
2010-02-07 06:25:44 +01:00
2010-02-08 00:15:50 +01:00
##########################################################
2012-10-19 01:40:31 +02:00
# OpenRefine Control System #
2010-02-08 00:15:50 +01:00
##########################################################
2010-04-05 09:15:16 +02:00
# -------------- utility functions ----------------------
2010-03-30 23:24:04 +02:00
2010-02-09 21:21:10 +01:00
fail () {
cat <<EOF
2010-02-07 06:25:44 +01:00
ERROR: $1
2010-02-09 21:21:10 +01:00
Type '$0 -h' for usage information.
2010-02-07 06:25:44 +01:00
EOF
2010-02-09 21:21:10 +01:00
exit 1
}
error() {
2015-01-23 16:29:43 +01:00
echo "Error: $1"
2010-02-08 00:15:50 +01:00
exit 1
2010-02-07 06:25:44 +01:00
}
2010-04-07 10:28:53 +02:00
warn() {
2015-01-23 16:29:43 +01:00
echo "Warning: $1"
2010-04-07 10:28:53 +02:00
exit 0
}
2010-02-07 06:25:44 +01:00
usage() {
2010-02-08 00:15:50 +01:00
cat <<EOF
2010-02-07 06:25:44 +01:00
Usage: $0 [options] <action>
where [options] include:
-h print this message and exit
2012-10-19 01:40:31 +02:00
-p <port> the port that OpenRefine will listen to
2010-02-07 06:25:44 +01:00
default: 3333
2012-10-19 01:40:31 +02:00
-i <interface> the host interface OpenRefine should bind to
2010-02-08 00:15:50 +01:00
default: 127.0.0.1
-w <path> path to the webapp
2010-06-05 03:29:55 +02:00
default: main/webapp
2010-03-03 03:53:07 +01:00
-d <path> path to the data directory
default: OS dependent
2010-03-30 23:24:04 +02:00
-m <memory> max memory heap size to use
default: 1024M
2013-03-18 22:47:50 +01:00
-k <google api key> a server API key for calling Google APIs
2010-04-23 10:25:52 +02:00
-v <level> verbosity level [from low to high: error,warn,info,debug,trace]
default: info
2011-11-01 22:47:34 +01:00
2012-10-19 01:40:31 +02:00
-x <name=value> additional configuration parameters to pass to OpenRefine
2011-11-01 22:47:34 +01:00
default: [none]
2010-04-23 10:25:52 +02:00
2010-03-03 03:53:07 +01:00
--debug enable JVM debugging (on port 8000)
2010-02-08 00:15:50 +01:00
2010-03-30 23:24:04 +02:00
--jmx enable JMX monitoring (for jconsole and jvisualvm)
2010-02-07 06:25:44 +01:00
and <action> is one of
2012-10-19 01:40:31 +02:00
build ............................... Build OpenRefine
run ................................. Run OpenRefine [default]
2010-03-09 09:08:35 +01:00
2012-10-19 01:40:31 +02:00
test ................................ Run all OpenRefine tests
2010-06-25 08:52:12 +02:00
server_test ......................... Run only the server tests
ui_test ............................. Run only the UI tests
2018-01-03 18:37:16 +01:00
extensions_test ..................... Run only the extensions tests
2010-05-05 01:41:57 +02:00
2012-10-19 01:40:31 +02:00
broker .............................. Run OpenRefine Broker
2010-02-09 21:21:10 +01:00
2012-10-19 01:40:31 +02:00
broker_appengine_run <id> <ver> ..... Run OpenRefine Broker for Google App Engine in local server
broker_appengine_upload <id> <ver> .. Upload OpenRefine to Google App Engine
2010-06-25 08:52:12 +02:00
2012-10-19 01:40:31 +02:00
findbugs ............................ Run Findbugs against OpenRefine
pmd ................................. Run PMD against OpenRefine
cpd ................................. Run Copy/Paste Detection against OpenRefine
jslint .............................. Run JSlint against OpenRefine
2010-06-09 00:27:59 +02:00
2010-06-25 08:52:12 +02:00
whitespace <extension> .............. Normalize whitespace in files with the given extension
2010-06-09 00:27:59 +02:00
2010-06-25 08:52:12 +02:00
mac_dist <version> .................. Make MacOSX binary distribution
windows_dist <version> .............. Make Windows binary distribution
linux_dist <version> ................ Make Linux binary distribution
dist <version> ...................... Make all distributions
2010-03-04 09:46:33 +01:00
2010-06-25 08:52:12 +02:00
clean ............................... Clean compiled classes
distclean ........................... Remove all generated files
2010-02-08 00:15:50 +01:00
2010-02-07 06:25:44 +01:00
EOF
2010-02-09 21:21:10 +01:00
exit 1
2010-02-07 06:25:44 +01:00
}
2010-03-30 23:24:04 +02:00
2010-02-08 00:15:50 +01:00
add_option() {
2019-01-11 21:14:20 +01:00
if [ ! -z "$*" ] ; then
OPTS+=("$@")
fi
2010-02-07 06:25:44 +01:00
}
2010-03-30 23:24:04 +02:00
load_configs() {
2010-12-24 21:05:57 +01:00
TEMP_CONFIG=$(mktemp -t refine.XXXXXXX)
2012-01-27 23:18:09 +01:00
if [ "${TEMP_CONFIG}" = "" ] ; then
2010-12-24 21:05:57 +01:00
error "Could not create temporary file to load configurations"
fi
cat $1 | egrep "^[A-Z]" | sed 's/^\(.*\)$/export \1/' > ${TEMP_CONFIG}
. ${TEMP_CONFIG}
rm ${TEMP_CONFIG}
2010-03-30 23:24:04 +02:00
}
2010-12-24 21:05:57 +01:00
2010-02-09 21:21:10 +01:00
check_macosx() {
2010-09-16 20:16:46 +02:00
if [ "$OS" != "macosx" ] ; then
2010-02-09 21:21:10 +01:00
error "This action can only run on MacOSX"
fi
}
2010-04-05 09:15:16 +02:00
2010-04-07 10:28:53 +02:00
check_downloaders() {
2010-04-14 03:37:56 +02:00
CURL="`which curl 2> /dev/null`"
WGET="`which wget 2> /dev/null`"
2010-04-07 10:28:53 +02:00
2010-09-16 23:53:38 +02:00
if [ -z "$CURL" ] && [ -z "$WGET" ] ; then
2010-04-07 10:28:53 +02:00
error "We need either 'curl' or 'wget' present in PATH to download external dependencies."
fi
}
2010-04-07 19:31:25 +02:00
check_unzip() {
2010-04-14 03:37:56 +02:00
UNZIP="`which unzip 2> /dev/null`"
2010-04-07 19:31:25 +02:00
2010-09-16 20:16:46 +02:00
if [ -z "$UNZIP" ] ; then
2010-04-07 19:31:25 +02:00
error "We need 'unzip' present in PATH to expand external dependencies."
fi
}
2010-04-07 10:28:53 +02:00
check_python() {
2010-04-14 03:37:56 +02:00
PYTHON="`which python 2> /dev/null`"
2010-09-16 20:16:46 +02:00
if [ -z "$PYTHON" ] ; then
2010-04-14 03:37:56 +02:00
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/"
2010-04-07 10:28:53 +02:00
fi
2010-10-18 08:14:53 +02:00
PYTHON_VERSION="`$PYTHON --version 2>&1 | cut -f 2 -d ' ' | cut -f 1,2 -d .`"
2012-03-29 07:26:20 +02:00
if [ "$PYTHON_VERSION" != "2.6" ] && [ "$PYTHON_VERSION" != "2.7" ]; then
error "This action requires Python version 2.6.x. or 2.7.x. You can download it for free at http://www.python.org/"
2010-04-07 10:28:53 +02:00
fi
}
2010-06-01 08:56:58 +02:00
check_pywin32() {
PYWIN32="`$PYTHON -c 'import win32api' 2>&1`"
2010-09-16 20:16:46 +02:00
if [ ! -z "$PYWIN32" ] ; then
2010-06-01 08:56:58 +02:00
error "This action requires you to have 'pywin32' windows extensions for Python installed on your machine. You can download it for free at http://sourceforge.net/projects/pywin32/"
fi
}
2010-04-07 10:28:53 +02:00
check_running() {
check_downloaders
2010-09-22 23:47:35 +02:00
URL="http://${REFINE_HOST}:${REFINE_PORT}/"
2012-10-19 01:40:31 +02:00
CHECK_STR="<title>OpenRefine</title>"
2010-12-24 23:21:40 +01:00
2010-09-16 20:16:46 +02:00
if [ "$CURL" ] ; then
2013-03-04 00:19:31 +01:00
curl -s -S -f $URL > /dev/null 2>&1
2020-01-08 13:34:49 +01:00
CURL_RETURN=$?
if [ $CURL_RETURN -eq "7" ] || [ $CURL_RETURN -eq "22" ] ; then
2011-11-16 01:32:02 +01:00
NOT_RUNNING="1"
fi
2010-09-16 20:16:46 +02:00
elif [ "$WGET" ] ; then
2011-11-16 01:32:02 +01:00
wget -O - $URL > /dev/null 2>&1
if [ "$?" = "4" ] ; then
NOT_RUNNING="1"
fi
2010-04-07 10:28:53 +02:00
fi
2010-12-24 23:21:40 +01:00
if [ -z "${NOT_RUNNING}" ] ; then
if [ "$CURL" ] ; then
RUNNING=`curl -s $URL | grep "$CHECK_STR"`
elif [ "$WGET" ] ; then
RUNNING=`wget -q -O - $URL | grep "$CHECK_STR"`
fi
if [ -z "${RUNNING}" ] ; then
2012-10-19 01:40:31 +02:00
error "Something is already running on $URL but doesn't seem to be OpenRefine. Maybe a proxy issue?"
2010-12-24 23:21:40 +01:00
fi
else
RUNNING=""
fi
2010-04-07 10:28:53 +02:00
}
2010-04-05 09:15:16 +02:00
get_version() {
2010-04-08 20:23:14 +02:00
VERSION="$1"
2010-02-09 21:21:10 +01:00
2010-09-16 20:16:46 +02:00
if [ -z "$VERSION" ] ; then
2010-04-05 09:15:16 +02:00
fail "Must specify a version number"
2010-02-08 00:15:50 +01:00
fi
2010-09-16 20:16:46 +02:00
2013-07-30 00:30:23 +02:00
NUM_VERSION=`echo $VERSION | sed -E 's/-.*//g'`
2010-02-08 00:15:50 +01:00
2010-09-16 23:53:38 +02:00
if [ "${NUM_VERSION}" = "" ] ; then
2010-09-16 20:16:46 +02:00
fail "${VERSION} is not a valid version number"
2010-05-13 00:57:31 +02:00
fi
2010-09-16 23:53:38 +02:00
if [ "`echo "${NUM_VERSION}" | egrep '^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$'`" = "${NUM_VERSION}" ] ; then
2010-09-16 20:16:46 +02:00
FULL_VERSION="${NUM_VERSION}"
2010-09-16 23:53:38 +02:00
elif [ "`echo "${NUM_VERSION}" | egrep '^[0-9]+\.[0-9]+\.[0-9]+$'`" = "${NUM_VERSION}" ] ; then
2010-09-16 20:16:46 +02:00
FULL_VERSION="${NUM_VERSION}.0"
2010-09-16 23:53:38 +02:00
elif [ "`echo "${NUM_VERSION}" | egrep ''^[0-9]+\.[0-9]+$''`" = "${NUM_VERSION}" ] ; then
2010-09-16 20:16:46 +02:00
FULL_VERSION="${NUM_VERSION}.0.0"
2010-09-16 23:53:38 +02:00
elif [ "`echo "${NUM_VERSION}" | egrep '^[0-9]+$'`" = "${NUM_VERSION}" ] ; then
2010-09-16 20:16:46 +02:00
FULL_VERSION="${NUM_VERSION}.0.0.0"
else
fail "${VERSION} is not a valid version number"
fi
2010-04-05 09:15:16 +02:00
}
get_revision() {
2010-09-16 20:16:46 +02:00
if [ -d ".svn" ] ; then
2010-04-05 09:15:16 +02:00
INFO=`svn info`
2013-08-15 21:34:19 +02:00
REVISION=`echo $INFO | sed s/^$VERSION-//`
2010-09-16 20:16:46 +02:00
elif [ -d ".git" ] ; then
2013-03-25 18:25:50 +01:00
INFO=`git describe`
2013-08-15 22:50:26 +02:00
REVISION=`echo $INFO`
REVISION=${REVISION:4}
2010-04-05 09:15:16 +02:00
else
error "cannot obtain revision, exiting!"
2010-02-08 00:15:50 +01:00
fi
2010-02-09 21:21:10 +01:00
}
2010-04-05 09:15:16 +02:00
download() {
URL=$1
DEST=$2
2010-04-07 10:28:53 +02:00
check_downloaders
2010-04-05 09:15:16 +02:00
2010-09-16 20:16:46 +02:00
if [ "$CURL" ] ; then
2010-04-07 10:28:53 +02:00
curl -L -o $DEST $URL || exit "Error while downloading $URL"
2010-09-16 20:16:46 +02:00
elif [ "$WGET" ] ; then
2010-04-07 10:28:53 +02:00
wget -O $DEST $URL || error "Error while downloading $URL"
2010-04-05 09:15:16 +02:00
fi
}
2010-04-07 01:28:52 +02:00
tool_download() {
URL=$1
FILE=$2
DIR=$3
2010-09-22 23:47:35 +02:00
cd $REFINE_TOOLS_DIR
2010-09-16 20:16:46 +02:00
if [ ! -f "$FILE" ] ; then
2010-04-07 23:45:39 +02:00
download $URL $FILE
2010-04-07 19:40:55 +02:00
fi
2010-09-16 20:16:46 +02:00
if [ ! -d "$DIR" ] ; then
if [ -z "`echo $FILE | sed 's@.*.tar.gz$@@' | sed 's@.*.tgz$@@'`" ] ; then
2010-04-07 23:45:39 +02:00
tar xzf $FILE || error "Error while expanding $FILE"
fi
2010-09-16 20:16:46 +02:00
if [ -z "`echo $FILE | sed 's@.*.zip$@@'`" ] ; then
2010-04-07 23:45:39 +02:00
check_unzip
$UNZIP -q $FILE || error "Error while expanding $FILE"
fi
2010-04-07 19:31:25 +02:00
fi
2010-04-07 01:28:52 +02:00
cd ..
}
2010-04-07 10:28:53 +02:00
load_data() {
FILE=$1
NAME=$2
2010-09-22 23:47:35 +02:00
URL="http://${REFINE_HOST}:${REFINE_PORT}/command/core/create-project-from-upload"
2010-04-14 03:37:56 +02:00
CURL="`which curl 2> /dev/null`"
2010-04-07 10:28:53 +02:00
2010-09-16 20:16:46 +02:00
if [ -z "$CURL" ] ; then
2012-10-19 01:40:31 +02:00
error "We need 'curl' present in PATH to upload data to OpenRefine."
2010-04-07 10:28:53 +02:00
else
2012-10-19 01:40:31 +02:00
curl -s -F "project-file=@$FILE" -F "project-name=$NAME" $URL > /dev/null || error "Error while uploading $FILE to OpenRefine"
2010-04-07 10:28:53 +02:00
echo "Loaded $FILE as $NAME"
fi
}
2013-03-25 18:24:30 +01:00
display() {
FILE=$1
if [ "$OS" = "macosx" ] ; then
open $FILE
elif [ "$OS" = "linux" ] ; then
gnome-open $FILE
else
notepad $FILE
fi
}
2010-04-05 09:15:16 +02:00
# ----------------------------------------------------------------------------------------------
build_prepare() {
2010-09-22 23:47:35 +02:00
if [ ! -d $REFINE_BUILD_DIR ] ; then
mkdir $REFINE_BUILD_DIR || error "Error while making directory $REFINE_BUILD_DIR"
2010-04-05 09:15:16 +02:00
fi
2010-02-09 21:21:10 +01:00
}
dist_prepare() {
2010-09-22 23:47:35 +02:00
if [ ! -d $REFINE_DIST_DIR ] ; then
mkdir $REFINE_DIST_DIR || error "Error while making directory $REFINE_DIST_DIR"
2010-02-09 21:21:10 +01:00
fi
}
2010-04-05 09:15:16 +02:00
tools_prepare() {
2010-09-22 23:47:35 +02:00
if [ ! -d $REFINE_TOOLS_DIR ] ; then
mkdir $REFINE_TOOLS_DIR || error "Error while making directory $REFINE_TOOLS_DIR"
2010-04-05 09:15:16 +02:00
fi
}
2018-09-16 16:34:47 +02:00
mvn_prepare() {
2010-04-14 03:37:56 +02:00
tools_prepare
2020-01-16 07:10:24 +01:00
MVN_VERSION="3.6.3"
MVN_URL="https://www-us.apache.org/dist/maven/maven-3/${MVN_VERSION}/binaries/apache-maven-${MVN_VERSION}-bin.tar.gz"
2018-09-16 16:34:47 +02:00
MVN_FILE=`echo $MVN_URL | sed 's|.*/||'`
MVN_DIR="apache-maven-${MVN_VERSION}"
MVN="`which mvn 2> /dev/null`"
if [ -z "$MVN" ] ; then
if [ -z "$MVN_HOME" ] ; then
2010-09-22 23:47:35 +02:00
cd $REFINE_TOOLS_DIR
2018-09-16 16:34:47 +02:00
if [ ! -f "$MVN_FILE" ] ; then
2020-01-16 18:03:57 +01:00
echo "\nCould not find Maven locally, starting download for Maven ..."
2018-09-16 16:34:47 +02:00
download $MVN_URL $MVN_FILE
2010-04-07 23:45:39 +02:00
fi
2018-09-16 16:34:47 +02:00
if [ ! -d "$MVN_DIR" ] ; then
tar xzf $MVN_FILE -C . || error "Error while expanding $MVN_FILE"
2010-04-07 23:45:39 +02:00
fi
2018-09-16 16:34:47 +02:00
export MVN_HOME="`pwd`/$MVN_DIR"
2010-09-16 20:16:46 +02:00
if [ "$OS" = "windows" ] ; then
2018-09-16 16:34:47 +02:00
export MVN_HOME=`cygpath --unix "$MVN_HOME"`
2010-04-14 03:37:56 +02:00
fi
2010-04-05 09:15:16 +02:00
cd ..
fi
2018-09-16 16:34:47 +02:00
MVN="$MVN_HOME/bin/mvn"
2010-04-05 09:15:16 +02:00
fi
}
2010-06-09 00:27:59 +02:00
appengine_prepare() {
2010-09-16 20:16:46 +02:00
if [ -z "$APPENGINE_HOME" ] ; then
2010-06-09 00:27:59 +02:00
error "You have to have the APPENGINE_HOME environment variable set and pointing to the local installation of the Google AppEngine SDK."
2010-09-16 20:16:46 +02:00
elif [ ! -f "$APPENGINE_HOME/bin/appcfg.sh" ] ; then
2010-06-09 00:27:59 +02:00
error "Environment variable APPENGINE_HOME is set to '$APPENGINE_HOME' which doesn't point to a valid Google App Engine SDK."
fi
APPENGINE="$APPENGINE_HOME/bin/appcfg.sh"
APPENGINE_LOCAL="$APPENGINE_HOME/bin/dev_appserver.sh"
ANT_PARAMS="$ANT_PARAMS -Dappengine.sdk.dir=$APPENGINE_HOME"
}
2010-04-05 09:15:16 +02:00
2010-04-07 23:45:39 +02:00
virtualenv_prepare() {
check_python
2013-03-25 18:24:30 +01:00
VIRTUALENV_DIR="virtualenv-1.9.1"
2012-03-29 07:26:20 +02:00
VIRTUALENV_FILE="${VIRTUALENV_DIR}.tar.gz"
VIRTUALENV_URL="http://pypi.python.org/packages/source/v/virtualenv/${VIRTUALENV_FILE}"
2010-04-07 23:45:39 +02:00
tool_download $VIRTUALENV_URL $VIRTUALENV_FILE $VIRTUALENV_DIR
2010-09-22 23:47:35 +02:00
PYTHON_LOCAL="$REFINE_TOOLS_DIR/python"
2010-09-16 20:16:46 +02:00
if [ "$OS" = "windows" ] ; then
2010-04-14 03:37:56 +02:00
PYTHON_LOCAL="${PYTHON_LOCAL}_win"
2010-04-07 23:45:39 +02:00
fi
2010-09-16 20:16:46 +02:00
if [ ! -d "$PYTHON_LOCAL" ] ; then
2010-09-22 23:47:35 +02:00
$PYTHON $REFINE_TOOLS_DIR/$VIRTUALENV_DIR/virtualenv.py $PYTHON_LOCAL
2010-04-14 03:37:56 +02:00
fi
PYTHON_HOME="`pwd`/$PYTHON_LOCAL"
2010-09-16 20:16:46 +02:00
if [ "$OS" = "windows" ] ; then
2010-04-14 03:37:56 +02:00
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
2010-04-07 23:45:39 +02:00
}
2010-04-05 09:15:16 +02:00
# ----------------------------------------------------------------------------------------------
2010-03-30 23:24:04 +02:00
2018-09-16 16:34:47 +02:00
mvn() {
mvn_prepare
2010-04-07 00:41:33 +02:00
2018-09-16 16:34:47 +02:00
"$MVN" $MVN_PARAMS -Dversion="$VERSION" -Dfull_version="$FULL_VERSION" $1 || error "Error while running maven task '$1'"
2010-03-30 23:24:04 +02:00
}
2010-04-05 09:15:16 +02:00
# ----------------------------------------------------------------------------------------------
2010-03-30 23:24:04 +02:00
dist() {
2010-02-25 00:52:20 +01:00
get_version $1
2018-10-22 10:26:55 +02:00
mvn_prepare
"$MVN" versions:set -DnewVersion="$VERSION"
mvn package
2010-02-10 08:30:16 +01:00
}
2018-10-22 10:26:55 +02:00
# Kept just in case someone wants to follow this workflow on a mac,
# but no longer needed as "mvn package" does it directly on both mac and linux.
2010-03-31 04:11:53 +02:00
mac_dist() {
2010-02-09 21:21:10 +01:00
check_macosx
dist_prepare
2010-02-25 00:52:20 +01:00
get_version $1
2010-03-30 23:24:04 +02:00
get_revision
2010-04-07 20:51:16 +02:00
2013-03-26 22:05:17 +01:00
appbundler_prepare
2010-02-09 21:21:10 +01:00
2013-03-26 22:05:17 +01:00
ANT_PARAMS="-Dappbundler.dir=${REFINE_TOOLS_DIR}/${APPBUNDLER_DIR}"
2010-04-07 10:28:53 +02:00
ant mac
2010-02-09 21:21:10 +01:00
2010-09-22 23:47:35 +02:00
mkdir -p "$REFINE_BUILD_DIR/mac/.background"
cp graphics/dmg_background/dmg_background.png "$REFINE_BUILD_DIR/mac/.background/dmg_background.png"
2010-02-09 21:21:10 +01:00
2018-07-17 01:36:59 +02:00
SIZE=350
2010-02-09 21:21:10 +01:00
2010-09-22 23:47:35 +02:00
if [ -f "$REFINE_BUILD_DIR/temp_refine.dmg" ] ; then
rm "$REFINE_BUILD_DIR/temp_refine.dmg"
2010-04-07 02:12:40 +02:00
fi
2013-07-29 23:59:00 +02:00
2013-07-30 20:41:01 +02:00
# Sign the bundle with a self-signed cert so OS X doesn't frustrate users by making app invisible
2015-04-30 05:26:40 +02:00
codesign --deep -s "OpenRefine Code Signing" "$REFINE_BUILD_DIR/mac/OpenRefine.app"
2013-07-30 20:41:01 +02:00
spctl --assess --type execute --verbose=4 "$REFINE_BUILD_DIR/mac/OpenRefine.app"
2013-07-29 23:59:00 +02:00
2012-10-19 01:40:31 +02:00
TITLE="OpenRefine $VERSION"
2010-02-09 21:21:10 +01:00
echo "Building MacOSX DMG for $TITLE"
2010-09-22 23:47:35 +02:00
hdiutil create -srcfolder "$REFINE_BUILD_DIR/mac" -volname "$TITLE" -fs HFS+ -fsargs "-c c=64,a=16,e=16" -format UDRW -size ${SIZE}m "$REFINE_BUILD_DIR/temp_refine.dmg" || error "can't create empty DMG"
2013-07-30 20:41:01 +02:00
DEVICE=`hdiutil attach -readwrite -noverify -noautoopen "$REFINE_BUILD_DIR/temp_refine.dmg" | egrep '^/dev/' | sed -e "s/^\/dev\///g" -e 1q | awk '{print $1}'`
echo $DEVICE
2010-09-22 23:47:35 +02:00
hdiutil attach "$REFINE_BUILD_DIR/temp_refine.dmg" || error "Can't attach temp DMG"
2010-02-08 00:15:50 +01:00
2010-02-09 21:21:10 +01:00
echo '
tell application "Finder"
tell disk "'$TITLE'"
open
set current view of container window to icon view
set toolbar visible of container window to false
set statusbar visible of container window to false
2010-02-25 00:28:24 +01:00
set the bounds of container window to {200, 100, 760, 460}
2010-02-09 21:21:10 +01:00
set theViewOptions to the icon view options of container window
set arrangement of theViewOptions to not arranged
set icon size of theViewOptions to 100
2010-08-21 00:24:02 +02:00
set background picture of theViewOptions to file ".background:dmg_background.png"
2010-02-09 21:21:10 +01:00
make new alias file at container window to POSIX file "/Applications" with properties {name:"Applications"}
2012-10-19 01:40:31 +02:00
set position of item "OpenRefine" of container window to {170, 175}
2010-02-25 00:28:24 +01:00
set position of item "Applications" of container window to {380, 175}
2010-02-09 21:21:10 +01:00
close
open
update without registering applications
2013-03-26 04:31:59 +01:00
delay 5
2010-02-09 21:21:10 +01:00
eject
end tell
end tell
2010-04-07 10:28:53 +02:00
' | osascript || error "Error running applescript"
2010-02-09 21:21:10 +01:00
sync
sync
2013-07-30 20:41:01 +02:00
sleep 3
2010-04-07 20:40:50 +02:00
hdiutil detach $DEVICE
2010-04-07 02:18:26 +02:00
2013-07-29 23:59:00 +02:00
if [ -f "$REFINE_DIST_DIR/openrefine-mac-$VERSION.dmg" ] ; then
rm "$REFINE_DIST_DIR/openrefine-mac-$VERSION.dmg"
2010-04-07 02:18:26 +02:00
fi
2013-07-29 23:59:00 +02:00
hdiutil convert "$REFINE_BUILD_DIR/temp_refine.dmg" -format UDZO -imagekey zlib-level=9 -o "$REFINE_DIST_DIR/openrefine-mac-$VERSION.dmg" || error "Error compressing DMG"
hdiutil internet-enable -yes "$REFINE_DIST_DIR/openrefine-mac-$VERSION.dmg" || error "Error internet-enabling DMG"
2010-04-07 02:18:26 +02:00
2013-07-29 23:59:00 +02:00
rm -f "$REFINE_BUILD_DIR/temp_refine.dmg"
2010-02-07 06:25:44 +01:00
}
2010-03-09 09:08:35 +01:00
test() {
2018-09-16 16:34:47 +02:00
mvn_prepare
$MVN test
2010-04-07 02:12:40 +02:00
}
ui_test() {
2010-04-08 00:56:46 +02:00
INTERACTIVE=$1
2010-04-07 02:12:40 +02:00
windmill_prepare
2010-10-12 00:20:58 +02:00
2013-03-25 21:05:48 +01:00
REFINE_DATA_DIR="${TMPDIR:=/tmp}/openrefine-tests"
2010-04-07 10:28:53 +02:00
2010-09-22 23:47:35 +02:00
add_option "-Drefine.headless=true"
2010-04-07 10:28:53 +02:00
run fork
2012-10-19 01:40:31 +02:00
echo "Waiting for OpenRefine to load..."
2010-04-07 10:28:53 +02:00
sleep 5
2010-04-14 03:37:56 +02:00
check_running
2010-12-24 23:21:40 +01:00
if [ -z "$RUNNING" ] ; then
2010-04-14 03:37:56 +02:00
sleep 10
fi
2010-04-07 10:28:53 +02:00
echo "... proceed with the tests."
echo ""
2010-09-22 23:47:35 +02:00
load_data "$REFINE_TEST_DIR/data/food.csv" "Food"
2010-04-07 10:28:53 +02:00
sleep 3
echo ""
2010-05-31 19:56:07 +02:00
echo "Starting Windmill..."
2010-09-16 20:16:46 +02:00
if [ -z "$INTERACTIVE" ] ; then
2010-09-22 23:47:35 +02:00
"$WINDMILL" firefox firebug loglevel=WARN http://${REFINE_HOST}:${REFINE_PORT}/ jsdir=$REFINE_TEST_DIR/client/src exit
2010-04-08 00:56:46 +02:00
else
2010-09-22 23:47:35 +02:00
"$WINDMILL" firefox firebug loglevel=WARN http://${REFINE_HOST}:${REFINE_PORT}/
2010-04-08 00:56:46 +02:00
fi
2010-04-07 10:28:53 +02:00
echo ""
2012-10-19 01:40:31 +02:00
echo "Killing OpenRefine"
2010-09-22 23:47:35 +02:00
/bin/kill -9 $REFINE_PID
2010-04-07 10:28:53 +02:00
echo "Cleaning up"
2019-01-11 21:14:20 +01:00
rm -rf "$REFINE_DATA_DIR"
2010-04-07 02:12:40 +02:00
}
server_test() {
2018-09-16 16:34:47 +02:00
mvn_prepare
$MVN test -f main
2010-03-09 09:08:35 +01:00
}
2018-01-03 18:37:16 +01:00
extensions_test() {
2018-09-16 16:34:47 +02:00
mvn_prepare
$MVN test -f extensions
2018-01-03 18:37:16 +01:00
}
2010-06-25 08:52:12 +02:00
run() {
FORK=$1
2010-06-09 00:27:59 +02:00
2010-06-25 08:52:12 +02:00
check_running
2010-06-09 00:27:59 +02:00
2010-12-24 23:21:40 +01:00
if [ "$RUNNING" ] ; then
2012-10-19 01:40:31 +02:00
warn "OpenRefine is already running."
2010-06-09 00:27:59 +02:00
fi
2010-04-07 10:28:53 +02:00
2010-09-22 23:47:35 +02:00
if [ ! -d $REFINE_CLASSES_DIR ] ; then
2013-03-25 21:05:48 +01:00
IS_JAR=`ls $REFINE_LIB_DIR | grep openrefine`
2010-09-16 20:16:46 +02:00
if [ -z "$IS_JAR" ] ; then
2018-09-16 16:34:47 +02:00
mvn_prepare
$MVN process-resources
$MVN compile test-compile
2010-03-30 23:24:04 +02:00
echo ""
fi
2010-02-08 00:15:50 +01:00
fi
2018-09-16 16:34:47 +02:00
2010-09-22 23:47:35 +02:00
if [ -d $REFINE_CLASSES_DIR ] ; then
2019-01-11 21:14:20 +01:00
add_option "-Drefine.autoreload=true" "-Dbutterfly.autoreload=true"
2010-04-03 03:28:54 +02:00
fi
2010-03-03 03:53:07 +01:00
2010-09-16 20:16:46 +02:00
if [ "$OS" = "macosx" ] ; then
2013-03-25 21:05:48 +01:00
add_option '-Xdock:icon=graphics/icon/openrefine.icns'
2010-03-03 03:53:07 +01:00
fi
2010-09-22 23:47:35 +02:00
if [ "$REFINE_DATA_DIR" ] ; then
add_option "-Drefine.data_dir=$REFINE_DATA_DIR"
2010-03-03 03:53:07 +01:00
fi
2010-06-25 08:52:12 +02:00
2010-09-22 23:47:35 +02:00
if [ "$REFINE_WEBAPP" ] ; then
add_option "-Drefine.webapp=$REFINE_WEBAPP"
2010-06-25 08:52:12 +02:00
fi
2010-09-22 23:47:35 +02:00
if [ "$REFINE_PORT" ] ; then
add_option "-Drefine.port=$REFINE_PORT"
2010-06-25 08:52:12 +02:00
fi
2010-09-22 23:47:35 +02:00
if [ "$REFINE_HOST" ] ; then
add_option "-Drefine.host=$REFINE_HOST"
2010-06-25 08:52:12 +02:00
fi
2013-03-18 22:47:50 +01:00
if [ "$REFINE_GOOGLE_API_KEY" ] ; then
add_option "-Drefine.google_api_key=$REFINE_GOOGLE_API_KEY"
fi
2017-06-22 12:27:55 +02:00
if [ "$REFINE_AUTOSAVE_PERIOD" ] ; then
add_option "-Drefine.autosave=$REFINE_AUTOSAVE_PERIOD"
fi
2018-09-11 16:41:31 +02:00
CLASSPATH="$REFINE_CLASSES_DIR${SEP}$REFINE_LIB_DIR/*"
2010-02-08 00:15:50 +01:00
2019-01-11 21:14:20 +01:00
RUN_CMD=("$JAVA" -cp "$CLASSPATH" "${OPTS[@]}" "com.google.refine.Refine")
2010-04-07 10:28:53 +02:00
2012-10-19 01:40:31 +02:00
echo "Starting OpenRefine at 'http://${REFINE_HOST}:${REFINE_PORT}/'"
2010-02-08 00:15:50 +01:00
echo ""
2010-09-16 20:16:46 +02:00
if [ -z "$FORK" ] ; then
2019-01-11 21:14:20 +01:00
exec "${RUN_CMD[@]}"
2010-04-07 10:28:53 +02:00
else
2019-01-11 21:14:20 +01:00
"${RUN_CMD[@]}" &
2010-09-22 23:47:35 +02:00
REFINE_PID="$!"
2010-04-07 10:28:53 +02:00
fi
2010-02-08 00:15:50 +01:00
}
2010-06-25 08:52:12 +02:00
broker_build() {
build_prepare
get_revision
2018-09-16 16:34:47 +02:00
# TODO migrate to Maven
$MVN prepare_broker
2010-06-25 08:52:12 +02:00
}
broker_run() {
FORK=$1
2010-09-16 20:16:46 +02:00
if [ ! -d "broker/core/WEB-INF/lib" ] ; then
2010-06-25 08:52:12 +02:00
broker_build
echo ""
fi
2010-09-22 23:47:35 +02:00
if [ -d $REFINE_CLASSES_DIR ] ; then
2019-01-11 21:14:20 +01:00
add_option "-Drefine.autoreload=true" "-Dbutterfly.autoreload=true"
2010-09-22 23:47:35 +02:00
add_option "-Drefine.development=true"
2010-06-25 08:52:12 +02:00
fi
2013-03-18 22:47:50 +01:00
2010-09-22 23:47:35 +02:00
add_option "-Drefine.webapp=broker/core"
add_option "-Drefine.headless=true"
2010-06-25 08:52:12 +02:00
2010-09-22 23:47:35 +02:00
add_option "-Drefine.port=$REFINE_PORT"
add_option "-Drefine.host=0.0.0.0"
2010-06-25 08:52:12 +02:00
2018-09-16 16:34:47 +02:00
LIB_PATHS=`cat server/classpath.txt`
CLASSPATH="$REFINE_CLASSES_DIR${SEP}$LIB_PATHS"
2010-06-25 08:52:12 +02:00
2010-09-22 19:46:39 +02:00
RUN_CMD="$JAVA -cp $CLASSPATH $OPTS com.google.refine.Refine"
2010-06-25 08:52:12 +02:00
#echo "$RUN_CMD"
#echo ""
2012-10-19 01:40:31 +02:00
echo "Starting OpenRefine Broker at 'http://${REFINE_HOST}:${REFINE_PORT}/'"
2010-06-25 08:52:12 +02:00
echo ""
2010-09-16 20:16:46 +02:00
if [ -z "$FORK" ] ; then
2010-06-25 08:52:12 +02:00
exec $RUN_CMD
else
$RUN_CMD &
2010-09-22 23:47:35 +02:00
REFINE_PID="$!"
2010-06-25 08:52:12 +02:00
fi
}
broker_appengine_build() {
appengine_prepare
get_revision
2018-09-16 16:34:47 +02:00
MVN_PARAMS="-Dappengine.sdk.dir=${APPENGINE_HOME}"
2010-06-25 08:52:12 +02:00
2010-09-16 20:16:46 +02:00
if [ "$1" ] ; then
2018-09-16 16:34:47 +02:00
MVN_PARAMS="$MVN_PARAMS -Dappengine.app_id=$1"
2010-06-25 08:52:12 +02:00
fi
2010-09-16 20:16:46 +02:00
if [ "$2" ] ; then
2018-09-16 16:34:47 +02:00
MVN_PARAMS="$MVN_PARAMS -Dappengine.version=$2"
2010-06-25 08:52:12 +02:00
fi
2018-09-16 16:34:47 +02:00
# TODO migrate this to Maven
$MVN prepare_broker_appengine
2010-06-25 08:52:12 +02:00
}
broker_appengine_upload() {
broker_appengine_build $1 $2
2010-09-22 23:47:35 +02:00
"$APPENGINE" update "$REFINE_BUILD_DIR/broker/appengine"
2010-06-25 08:52:12 +02:00
}
broker_appengine_run() {
broker_appengine_build $1 $2
2010-09-22 23:47:35 +02:00
"$APPENGINE_LOCAL" "$REFINE_BUILD_DIR/broker/appengine"
2010-06-25 08:52:12 +02:00
}
2010-04-05 09:15:16 +02:00
findbugs() {
findbugs_prepare
2018-09-16 16:34:47 +02:00
MVN_PARAMS="-Dfindbugs.dir=${REFINE_TOOLS_DIR}/${FINDBUGS_DIR}"
2010-04-05 09:15:16 +02:00
ant findbugs
2010-04-09 02:14:11 +02:00
2013-03-25 18:24:30 +01:00
display "$REFINE_BUILD_DIR/reports/findbugs.html"
2010-04-05 09:15:16 +02:00
}
2010-04-07 19:31:25 +02:00
pmd() {
pmd_prepare
2010-09-22 23:47:35 +02:00
ANT_PARAMS="-Dpmd.dir=${REFINE_TOOLS_DIR}/${PMD_DIR}"
2010-04-07 19:31:25 +02:00
ant pmd
2010-04-09 02:14:11 +02:00
2013-03-25 18:24:30 +01:00
display "$REFINE_BUILD_DIR/reports/pmd.html"
2010-04-07 19:31:25 +02:00
}
cpd() {
pmd_prepare
2010-09-22 23:47:35 +02:00
ANT_PARAMS="-Dpmd.dir=${REFINE_TOOLS_DIR}/${PMD_DIR}"
2010-04-07 19:31:25 +02:00
ant cpd
2010-04-09 02:14:11 +02:00
2013-03-25 18:24:30 +01:00
display "$REFINE_BUILD_DIR/reports/cpd.txt"
2010-04-07 19:31:25 +02:00
}
2010-04-07 21:05:04 +02:00
jslint() {
jslint_prepare
2010-09-22 23:47:35 +02:00
ANT_PARAMS="-Djslint.dir=${REFINE_TOOLS_DIR}/${JSLINT_DIR}"
2010-04-07 21:05:04 +02:00
ant jslint
2010-04-09 02:14:11 +02:00
2013-03-25 18:24:30 +01:00
display "$REFINE_BUILD_DIR/reports/jslint.txt"
2010-04-07 21:05:04 +02:00
}
2010-05-05 01:41:57 +02:00
whitespace() {
[ $# -gt 0 ] || usage
for i in `find . -name *.$1`; do
# expand tabs to spaces
expand -t 4 < $i > $i.1
# convert DOS to UNIX newlines
tr -d '\r' < $i.1 > $i.2
rm $i $i.1
mv $i.2 $i
done
}
2017-11-01 20:23:30 +01:00
checkJavaMajorVersion() {
2017-11-09 05:16:57 +01:00
java_ver=$("$JAVA" -version 2>&1 | grep version | cut -d ' ' -f 3 | tr -d \")
2017-11-01 20:23:30 +01:00
# Java 6, 7, 8 starts with 1.x
if [ ${java_ver:0:2} == "1." ] ; then
major=`echo ${java_ver} | sed -E 's/1\.([0-9])[0-9_.]{2,6}/\1/g'`
else
# Java 9+ starts with x using semver versioning
major=`echo ${java_ver} | sed -E 's/([0-9]+)(-ea|(\.[0-9]+)*)/\1/g'`
fi
2019-07-26 16:29:57 +02:00
if (( ${major} < 8 )); then
error "OpenRefine requires Java version 8 or later. If you have multiple versions of Java installed, please set the environment variable JAVA_HOME to the correct version."
2017-11-01 20:23:30 +01:00
fi
2019-07-26 16:29:57 +02:00
if (( ${major} > 12 )); then
echo "WARNING: OpenRefine is not tested and not recommended for use with Java versions greater than 12."
2018-05-17 17:12:59 +02:00
fi
2017-11-01 20:23:30 +01:00
}
2010-03-30 23:24:04 +02:00
# -------------------------- script -----------------------------
2010-02-08 00:15:50 +01:00
# ----- Normalize the current directory -------------------------
cd `dirname $0`
2010-03-30 23:24:04 +02:00
# ----- Default values ------------------------------------------
2019-01-11 21:14:20 +01:00
OPTS=()
2010-03-30 23:24:04 +02:00
2010-04-14 03:37:56 +02:00
# ---- OS-specific support --------------------------------------
2010-03-30 23:24:04 +02:00
SYSTEM=`uname`
2010-04-14 03:37:56 +02:00
case "$SYSTEM" in
2010-09-16 20:16:46 +02:00
CYGWIN*) OS="windows" ;;
Darwin*) OS="macosx" ;;
Linux*) OS="linux" ;;
2011-11-16 01:32:02 +01:00
*) OS="other" ;;
2010-04-14 03:37:56 +02:00
esac
SEP=":"
2010-09-16 20:16:46 +02:00
if [ "$OS" = "windows" ] ; then
2010-04-14 03:37:56 +02:00
SEP=";"
fi
2010-03-30 23:24:04 +02:00
# ----- Load configurations -------------------------------------
2010-09-22 23:47:35 +02:00
load_configs refine.ini
2010-03-30 23:24:04 +02:00
# ----- Make sure there is an appropriate java environment is available -------------
2010-04-12 06:24:17 +02:00
2010-09-16 20:16:46 +02:00
if [ "$OS" = "macosx" ] ; then
if [ -z "$JAVA_HOME" ] ; then
2013-03-26 22:05:17 +01:00
# We need want recent Java because we're bundling JRE - may want to warn and force developer to set JAVA_HOME
# The /usr/libexec/java_home utility may be tied to the Java prefs app, so could go away when Apple removes it
export JAVA_HOME=$(/usr/libexec/java_home)
2010-04-14 03:37:56 +02:00
fi
fi
2010-12-24 23:21:40 +01:00
if [ "$JAVA_HOME" ] ; then
2010-12-24 22:17:21 +01:00
JAVA="$JAVA_HOME/bin/java"
else
2011-06-12 00:53:54 +02:00
JAVA="`which java 2> /dev/null`"
2010-12-24 22:17:21 +01:00
fi
if [ ! -x "$JAVA" ] ; 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?"
2010-02-08 00:15:50 +01:00
fi
2010-04-14 00:14:02 +02:00
2017-11-01 20:23:30 +01:00
checkJavaMajorVersion
2010-02-08 20:48:28 +01:00
2010-02-08 00:15:50 +01:00
# ----- Parse the command line args ------------------------------------------
2010-02-07 06:25:44 +01:00
while [ $# -ne 0 ] ; do
2010-02-08 00:15:50 +01:00
case "$1" in
2010-03-17 02:51:29 +01:00
-h) usage;;
2010-09-22 23:47:35 +02:00
-p) shift; REFINE_PORT="$1"; shift; continue;;
-i) shift; REFINE_HOST="$1"; shift; continue;;
-w) shift; REFINE_WEBAPP="$1"; shift; continue;;
-d) shift; REFINE_DATA_DIR="$1"; shift; continue;;
-m) shift; REFINE_MEMORY="$1"; shift; continue;;
2013-03-18 22:47:50 +01:00
-k) shift; REFINE_GOOGLE_API_KEY="$1"; shift; continue;;
2010-09-22 23:47:35 +02:00
-v) shift; REFINE_VERBOSITY="$1"; shift; continue;;
2011-11-01 22:47:34 +01:00
-x) shift; REFINE_EXTRA_OPTS="$1"; shift; continue;;
2019-01-11 21:14:20 +01:00
--debug) shift; add_option '-Xdebug' '-Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n'; continue;;
2010-03-03 03:53:07 +01:00
--jmx) shift; add_option '-Dcom.sun.management.jmxremote'; continue;;
2010-02-08 00:15:50 +01:00
-*) fail "Invalid option: $1";;
*) break;;
2010-02-07 06:25:44 +01:00
esac
done
2010-09-16 20:16:46 +02:00
if [ $# -ne 0 ] ; then
2010-04-08 22:45:02 +02:00
ACTION=$1; shift
fi
2010-02-08 00:15:50 +01:00
2010-09-16 20:16:46 +02:00
if [ -z "$ACTION" ] ; then
2010-03-31 04:11:53 +02:00
ACTION="run"
fi
2010-02-07 06:25:44 +01:00
# ----- Verify and Set Required Environment Variables -------------------------
2010-09-16 20:16:46 +02:00
if [ -z "$JAVA_OPTIONS" ] ; then
2010-03-30 23:24:04 +02:00
JAVA_OPTIONS=""
2010-02-07 06:25:44 +01:00
fi
2019-01-11 21:14:20 +01:00
add_option "${JAVA_OPTIONS[@]}"
2010-02-07 06:25:44 +01:00
2010-09-22 23:47:35 +02:00
if [ -z "$REFINE_MEMORY" ] ; then
REFINE_MEMORY="1024M"
2010-03-30 23:24:04 +02:00
fi
2017-06-22 12:27:55 +02:00
if [ -z "$REFINE_MIN_MEMORY" ] ; then
REFINE_MIN_MEMORY="256M"
fi
2019-01-11 21:14:20 +01:00
add_option "-Xms$REFINE_MIN_MEMORY" "-Xmx$REFINE_MEMORY" "-Drefine.memory=$REFINE_MEMORY"
2010-03-30 23:24:04 +02:00
2017-11-10 21:44:05 +01:00
freeRam=UNKNOWN
if [ "$OS" = "macosx" ] ; then
freeRam=$(top -l 1 | grep PhysMem | awk '{print $6}' | tr -d M)
elif [ "$OS" = "linux" ] ; then
freeRam=$(free -m | grep -oP '\d+' | head -n 1)
fi
echo You have "$freeRam"M of free memory.
2017-11-17 14:56:30 +01:00
echo Your current configuration is set to use $REFINE_MEMORY of memory.
2017-11-10 21:44:05 +01:00
echo OpenRefine can run better when given more memory. Read our FAQ on how to allocate more memory here:
echo https://github.com/OpenRefine/OpenRefine/wiki/FAQ:-Allocate-More-Memory
2014-11-07 14:14:54 +01:00
if [ -z "$REFINE_MAX_FORM_CONTENT_SIZE" ] ; then
REFINE_MAX_FORM_CONTENT_SIZE="1048576"
fi
add_option "-Drefine.max_form_content_size=$REFINE_MAX_FORM_CONTENT_SIZE"
2010-09-22 23:47:35 +02:00
if [ -z "$REFINE_PORT" ] ; then
REFINE_PORT="3333"
2010-02-07 06:25:44 +01:00
fi
2010-09-22 23:47:35 +02:00
if [ -z "$REFINE_HOST" ] ; then
REFINE_HOST="127.0.0.1"
2010-02-08 00:15:50 +01:00
fi
2010-02-07 06:25:44 +01:00
2010-09-22 23:47:35 +02:00
if [ -z "$REFINE_WEBAPP" ] ; then
REFINE_WEBAPP="main/webapp"
2010-02-07 06:25:44 +01:00
fi
2010-02-08 00:15:50 +01:00
2010-09-22 23:47:35 +02:00
if [ -z "$REFINE_TEST_DIR" ] ; then
REFINE_TEST_DIR="main/tests"
2010-03-09 09:08:35 +01:00
fi
2010-09-22 23:47:35 +02:00
if [ -z "$REFINE_CLASSES_DIR" ] ; then
REFINE_CLASSES_DIR="server/classes"
2010-02-08 00:15:50 +01:00
fi
2010-09-22 23:47:35 +02:00
if [ -z "$REFINE_LIB_DIR" ] ; then
2018-09-16 16:34:47 +02:00
REFINE_LIB_DIR="server/target/lib"
2010-05-29 01:19:08 +02:00
fi
2010-09-22 23:47:35 +02:00
if [ -z "$REFINE_BUILD_DIR" ] ; then
REFINE_BUILD_DIR="build"
2010-02-08 00:15:50 +01:00
fi
2010-09-22 23:47:35 +02:00
if [ -z "$REFINE_TOOLS_DIR" ] ; then
REFINE_TOOLS_DIR="tools"
2010-04-05 09:15:16 +02:00
fi
2010-09-22 23:47:35 +02:00
if [ -z "$REFINE_DIST_DIR" ] ; then
REFINE_DIST_DIR="dist"
2010-02-09 21:21:10 +01:00
fi
2010-02-08 00:15:50 +01:00
2010-09-22 23:47:35 +02:00
if [ -z "$REFINE_VERBOSITY" ] ; then
REFINE_VERBOSITY="info"
2010-04-23 10:25:52 +02:00
fi
2010-09-22 23:47:35 +02:00
add_option "-Drefine.verbosity=$REFINE_VERBOSITY"
2010-04-23 10:25:52 +02:00
2011-11-01 22:47:34 +01:00
if [ ! -z "$REFINE_EXTRA_OPTS" ] ; then
add_option "-D$REFINE_EXTRA_OPTS"
fi
2012-09-20 19:17:18 +02:00
if [ -z "$JYTHONPATH" ] ; then
JYTHONPATH="$REFINE_WEBAPP/WEB-INF/lib/jython"
else
JYTHONPATH="$REFINE_WEBAPP/WEB-INF/lib/jython${SEP}$JYTHONPATH"
fi
add_option "-Dpython.path=$JYTHONPATH"
add_option "-Dpython.cachedir=$HOME/.local/share/google/refine/cachedir"
2020-03-12 11:41:04 +01:00
if [ ! -z "$GDATA_CLIENT_ID" ] ; then
if [ ! -z "$GDATA_CLIENT_SECRET" ] ; then
add_option "-Dext.gdata.clientid=$GDATA_CLIENT_ID" "-Dext.gdata.clientsecret=$GDATA_CLIENT_SECRET"
fi
fi
2010-02-08 00:15:50 +01:00
# ----- Respond to the action given --------------------------------------------
2010-02-07 06:25:44 +01:00
case "$ACTION" in
2018-10-27 07:38:08 +02:00
build) build_prepare; mvn process-resources; mvn compile\ test-compile;;
2018-09-16 16:34:47 +02:00
clean) mvn clean;;
2010-05-05 01:41:57 +02:00
whitespace) whitespace $1;;
2018-09-16 16:34:47 +02:00
distclean) mvn distclean;;
2010-04-05 09:15:16 +02:00
test) test $1;;
2010-04-07 23:45:39 +02:00
tests) test $1;;
2010-04-07 02:12:40 +02:00
ui_test) ui_test $1;;
2010-04-07 23:45:39 +02:00
ui_tests) ui_test $1;;
2010-04-07 02:12:40 +02:00
server_test) server_test $1;;
2010-04-07 23:45:39 +02:00
server_tests) server_test $1;;
2018-01-03 18:37:16 +01:00
extensions_test) extensions_test $1;;
extensions_tests) extensions_test $1;;
2010-04-05 09:15:16 +02:00
findbugs) findbugs;;
2010-04-07 19:31:25 +02:00
pmd) pmd;;
cpd) cpd;;
2010-04-07 21:05:04 +02:00
jslint) jslint;;
2010-04-05 09:15:16 +02:00
run) run;;
2010-06-25 08:52:12 +02:00
broker) broker_run;;
broker_appengine_run) broker_appengine_run $1 $2;;
broker_appengine_upload) broker_appengine_upload $1 $2;;
2010-04-05 09:15:16 +02:00
mac_dist) mac_dist $1;;
windows_dist) windows_dist $1;;
linux_dist) linux_dist $1;;
dist) dist $1;;
*) usage; ;;
2010-02-07 06:25:44 +01:00
esac
2010-12-24 21:05:57 +01:00
# ----------- end of file --------------------