« Return to Thread: [gatewiki-commits] SF.net SVN: gatewiki:[1442] trunk/cow/bin/create-custom-cow-site.sh

[gatewiki-commits] SF.net SVN: gatewiki:[1442] trunk/cow/bin/create-custom-cow-site.sh

by hcunningham-2 :: Rate this Message:

Reply to Author | View in Thread

Revision: 1442
          http://gatewiki.svn.sourceforge.net/gatewiki/?rev=1442&view=rev
Author:   hcunningham
Date:     2009-07-02 20:54:39 +0000 (Thu, 02 Jul 2009)

Log Message:
-----------
added site name param and made the plugin optional (so can
create sites this way without a custom layout plugin)

Modified Paths:
--------------
    trunk/cow/bin/create-custom-cow-site.sh

Modified: trunk/cow/bin/create-custom-cow-site.sh
===================================================================
--- trunk/cow/bin/create-custom-cow-site.sh 2009-07-02 20:53:39 UTC (rev 1441)
+++ trunk/cow/bin/create-custom-cow-site.sh 2009-07-02 20:54:39 UTC (rev 1442)
@@ -18,18 +18,19 @@
 
 # parameters
 P=`basename $0`
-USAGE="${P} [-h] -p abs-path-to-plugin.zip [-s server-software-version]\n"\
+USAGE="${P} [-h] -n site-name -p abs-path-to-plugin.zip [-s server-software-version]\n"\
 "\n"\
 "-h: print help message and exit\n"\
 "-p: absolute path to this site's layout plugin - mandatory\n"\
 "-s: server software version (as a date, e.g. 29-apr-2009) - optional\n"\
+"-n: name of the new site (must be a valid directory name)\n"\
 "\n"\
 "Mode 1: if server software version not specified, create new server tree.\n"\
 "Mode 2: create an update for this site.\n"\
 "\n"\
 "Note: you have to run this script in the gatewiki directory.\n"\
 ""
-OPTIONSTRING=hp:s:
+OPTIONSTRING=hp:s:n:
 PLUGINZIP=
 SERVERVERSION=
 CREATESERVER=
@@ -48,12 +49,14 @@
     h) usage 0 ;;
     p)  PLUGINZIP="$OPTARG" ;;
     s)  SERVERVERSION="$OPTARG" ;;
+    n)  SITENAME="$OPTARG" ;;
     *) usage 1 ;;
   esac  
 done
 shift `expr $OPTIND - 1`
 [ ! -z $1 ] && usage 2
-case "${PLUGINZIP}" in
+[ -z "${SITENAME}" ] && usage 5
+[ ! -z "${PLUGINZIP}" ] && case "${PLUGINZIP}" in
   /*.zip) ;;
   *) echo the path \"${PLUGINZIP}\" should be absolute and a zip; usage 6; ;;
 esac
@@ -65,15 +68,13 @@
 esac
 
 # does the plugin exist?
-if [ ! -e ${PLUGINZIP} ]
+[ ! -z "${PLUGINZIP}" ] && if [ ! -e ${PLUGINZIP} ]
 then
   echo oops - ${PLUGINZIP} doesn\'t seem to exist....
   usage 4
 fi
 
-# the site name is derived from the plugin name
-SITENAME=`basename ${PLUGINZIP} |\
-  sed -e 's,.zip$,,' -e 's,^grails-,,' -e 's,-[0-9]\.[0-9]$,,'`
+# the site dir is derived from the site name plus the date
 SITEDIR=${SITENAME}-${PDATE}
 
 # mode 1 or mode 2?
@@ -144,8 +145,11 @@
 echo
 
 # install the plugin
-echo installing plugin...
-ant -Dgate.cow.grails.command="install-plugin ${PLUGINZIP}" grails
+if [ ! -z "${PLUGINZIP}" ]
+then
+  echo installing plugin...
+  ant -Dgate.cow.grails.command="install-plugin ${PLUGINZIP}" grails
+fi
 
 # done
 echo


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

------------------------------------------------------------------------------
_______________________________________________
gatewiki-commits mailing list
gatewiki-commits@...
https://lists.sourceforge.net/lists/listinfo/gatewiki-commits

 « Return to Thread: [gatewiki-commits] SF.net SVN: gatewiki:[1442] trunk/cow/bin/create-custom-cow-site.sh