ZEST-143 - Better to have a single script that downloads the needed bit if not already done so. I am calling this QuickStart mode.
Project: http://git-wip-us.apache.org/repos/asf/zest-java/repo Commit: http://git-wip-us.apache.org/repos/asf/zest-java/commit/160face4 Tree: http://git-wip-us.apache.org/repos/asf/zest-java/tree/160face4 Diff: http://git-wip-us.apache.org/repos/asf/zest-java/diff/160face4 Branch: refs/heads/develop Commit: 160face48358fade99a05b5d3319726b12b694ea Parents: 28e2b69 Author: Niclas Hedhman <[email protected]> Authored: Fri Jun 10 13:35:34 2016 +0800 Committer: Niclas Hedhman <[email protected]> Committed: Fri Jun 10 13:35:34 2016 +0800 ---------------------------------------------------------------------- tools/shell/src/dist/bin/zest | 31 ---------------- tools/shell/src/dist/bin/zest-boot | 60 +++++++++++++++++++++++++++++++ tools/shell/src/dist/bin/zest.bat_ | 25 ------------- tools/shell/src/docs/quick-start.txt | 4 +-- 4 files changed, 62 insertions(+), 58 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/zest-java/blob/160face4/tools/shell/src/dist/bin/zest ---------------------------------------------------------------------- diff --git a/tools/shell/src/dist/bin/zest b/tools/shell/src/dist/bin/zest deleted file mode 100644 index c1918de..0000000 --- a/tools/shell/src/dist/bin/zest +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh - -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Capture current directory -CWD=`pwd` - -# Goto directory where this script was started from. -cd `dirname $0` -# Up one level -cd .. -# Get the home directory of Zest -ZESTPATH=`pwd` - -# Restore the current directory -cd $CWD - -java -Dzest.home=$ZESTPATH -jar $ZESTPATH/libs/org.apache.zest.tool.shell-@[email protected] "$@" http://git-wip-us.apache.org/repos/asf/zest-java/blob/160face4/tools/shell/src/dist/bin/zest-boot ---------------------------------------------------------------------- diff --git a/tools/shell/src/dist/bin/zest-boot b/tools/shell/src/dist/bin/zest-boot index e69de29..9db6db8 100644 --- a/tools/shell/src/dist/bin/zest-boot +++ b/tools/shell/src/dist/bin/zest-boot @@ -0,0 +1,60 @@ +#!/bin/sh +# This files copies itself to $HOME/bin, renames itself to "zest" +# and from then on pretends to be the tools.shell script. +# + +JARNAME=org.apache.zest.tool.shell-@[email protected] + +MYNAME=`basename $0` + +# check if it is executing as boot script or regular script. +if [ "$MYNAME" == "zest-boot" ] ; then + mkdir $HOME/bin >/dev/null 2>&1 + cp $0 $HOME/bin/zest + if [ -f $HOME/bin/$JARNAME ] ; then + echo "JAR file exists." + else + JAR_URL=http://repo1.maven.org/maven2/org/apache/zest/$JARNAME + + # check for wget + WGET=`which wget` + + if [ "$WGET" == "" ] ; then + + # check for curl + CURL=`which curl` + if [ "$CURL" == "" ] ; then + echo "You need either wget or curl installed to use this script." + exit 1 + else + curl --output $HOME/bin/zest $JAR_URL + fi + else + wget --output-document=$HOME/bin/zest $HOME/bin/zest $JAR_URL + fi + fi +else + # Capture current directory + CWD=`pwd` + + # Goto directory where this script was started from. + cd `dirname $0` + # Up one level + cd .. + # Get the home directory of Zest + ZESTPATH=`pwd` + + # Figure out if we are executing from within the SDK or the QuickStart + if [ -f libs/$JARNAME ] ; then + JARFILE=libs/$JARNAME + else + if [ -f bin/$JARNAME ] ; then + JARFILE=bin/$JARNAME + else + fi + fi + # Restore the current directory + cd $CWD + + java -Dzest.home=$ZESTPATH -jar $ZESTPATH/$JARFILE "$@" +fi http://git-wip-us.apache.org/repos/asf/zest-java/blob/160face4/tools/shell/src/dist/bin/zest.bat_ ---------------------------------------------------------------------- diff --git a/tools/shell/src/dist/bin/zest.bat_ b/tools/shell/src/dist/bin/zest.bat_ deleted file mode 100644 index 3d85fbf..0000000 --- a/tools/shell/src/dist/bin/zest.bat_ +++ /dev/null @@ -1,25 +0,0 @@ -REM Licensed to the Apache Software Foundation (ASF) under one or more -REM contributor license agreements. See the NOTICE file distributed with -REM this work for additional information regarding copyright ownership. -REM The ASF licenses this file to You under the Apache License, Version 2.0 -REM (the "License"); you may not use this file except in compliance with -REM the License. You may obtain a copy of the License at -REM -REM http://www.apache.org/licenses/LICENSE-2.0 -REM -REM Unless required by applicable law or agreed to in writing, software -REM distributed under the License is distributed on an "AS IS" BASIS, -REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -REM See the License for the specific language governing permissions and -REM limitations under the License. - - -REM TODO: Windows user to fix this script, please! - -REM Absolute path to this script, e.g. /home/user/bin/foo.sh -REM ZESTSCRIPT=$(readlink -f "$0") -REM Absolute path this script is in, thus /home/user/bin -REM ZESTPATH=$(dirname "$ZESTSCRIPT") - -java -Dzest.home=$ZESTPATH -jar org.apache.zest.tools.shell-@@version@@.jar "$@" - http://git-wip-us.apache.org/repos/asf/zest-java/blob/160face4/tools/shell/src/docs/quick-start.txt ---------------------------------------------------------------------- diff --git a/tools/shell/src/docs/quick-start.txt b/tools/shell/src/docs/quick-start.txt index 50efae5..644ebd9 100644 --- a/tools/shell/src/docs/quick-start.txt +++ b/tools/shell/src/docs/quick-start.txt @@ -33,7 +33,7 @@ on your PATH. TBD. === Linux / Mac OSX === -The assumption is that ==wget== is installed. +The assumption is that +wget+ is installed. [snippet,bash] ---- @@ -41,7 +41,7 @@ source=tools/shell/src/docs/use-boot.txt tag=boot-quick ---- -The boot script will place the the ==zest== script and the accompanying +The boot script will place the the +zest+ script and the accompanying jar file into the $HOME/bin directory, which should already be on your PATH. == Create a small Project ==
