#!/bin/bash # # 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. # # # A (supposedly ) friendly commandline interface to the common gump tasks # ############################################################################# # Documentation ############################################################################# # Documentation for the different commands. function usage { case $1 in run) echo " Run Gumpy. Usage: $0 run [gump.py-args ...] See http://wiki.apache.org/gump/GumpCommandLineOptions for more information about the options Gumpy accepts. The one mandatory argument is the "project expression" detailing what to run. You will usually want "all" here. " ;; debug) echo " Run Gumpy in debug mode. Usage: $0 debug [gump.py-args ...] This is the same as executing the 'run' command with a '--debug' parameter. " ;; test) echo " Run Gumpy its unit tests. Usage: $0 test " ;; integration-test) echo " Run Gumpy its integration tests. Usage: $0 integration-test [gump.py-args ...] " ;; site) echo " Use Apache Forrest to build the documentation. Usage: $0 site " ;; site-publish) echo " Use svn and ssh to publish the site. Usage: $0 site-publish " ;; get-metadata) echo " Use CVS to check out or update the metadata. Usage: $0 get-metadata [CVSROOT] " ;; validate) echo " Run the DTD validation tools on the metadata. Usage: $0 validate " ;; experimental-tests) echo " Run the experimental new unit tests using testrunner.py. Usage: $0 experimental-tests " ;; *) echo " Utility commandline interface for Gump. Usage: $0 command [opts ...] Available commands are: run -- run Gumpy test -- run Gumpy its unit tests get-metadata -- Check out or update metadata from CVS validate -- validate the metadata help -- print this information site -- use Apache Forrest to build the documentation site-publish -- use SVN and SSH to publish the site to the website Run $0 help [command] for more information about a particular command. " ;; esac } ############################################################################# # Utility methods ############################################################################# # Print an error message and then exit. function error { echo "$0: $1" # usage exit 1 } # Load the environment variables script if it exists function load_env { local host=`hostname -s` local envfile="`pwd`/cron/local-env-$host.sh" if [[ -f $envfile ]]; then . $envfile fi } # Print a friendly error message if some dependency is missing. # # Arguments: # - name of the command # - url to download the package that provides it function check_env { local cmd=`bin/PrintPath $1`; if [[ -z "$cmd" ]]; then error "Cannot find $1. Please retrieve it from $2 and install it." fi } # Print a friendly error message if an environment variable is not set. # # Arguments: # - name of the variable # - description of what the variable should be set to function check_env_var { local host=`hostname -s` local envfile="`pwd`/cron/local-env-$host.sh" local dereferenced=${!1} if [[ -z "$dereferenced" ]]; then error "The variable $1 has not been set. It should be set to $2. You can either set this before invoking gump, or set it in a file named $envfile.sh " fi } # Print a friendly error message i a python library is not available. # # Arguments: # - the library to import # - url to download location of the library function check_env_pylib { cat > pycmd.tmp.py <