PageRenderTime 27ms CodeModel.GetById 23ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/bin/zotonic

https://code.google.com/p/zotonic/
#! | 50 lines | 46 code | 4 blank | 0 comment | 0 complexity | c8801ac03fef3cc73b7ff386eb573fc1 MD5 | raw file
 1#!/usr/bin/env bash
 2#
 3# Copyright 2011 Lloyd R. Prentice
 4#
 5# Licensed under the Apache License, Version 2.0 (the "License");
 6# you may not use this file except in compliance with the License.
 7# You may obtain a copy of the License at
 8#
 9#     http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16
17#
18# usage zotonic [command] [arguments...]
19#
20if type python &> /dev/null
21then
22    export ZOTONIC=${ZOTONIC:=`python -c "import os,sys;print os.path.realpath(\"$0/../..\")"`}
23else
24    export ZOTONIC=${ZOTONIC:=$(cd `dirname $0`/..;pwd)}
25fi 
26
27export ZOTONIC_SCRIPTS="$ZOTONIC/src/scripts"
28
29if [ ! $1 ]
30then
31    echo Usage: `basename $0` [command] 1>&2
32    echo 1>&2
33    echo Where [command] is one of: 1>&2
34    CMDS="`ls $ZOTONIC_SCRIPTS | grep zotonic- | grep -v _ | sed 's/zotonic-//g'`"
35    echo $CMDS 1>&2
36    echo 1>&2
37    echo see doc/ZotonicCommands.txt for more info 1>&2
38    echo 1>&2
39    exit 127
40elif [ ! -f "$ZOTONIC_SCRIPTS/zotonic-$1" ]; then
41    echo Command not found: $1 1>&2
42    exit 127
43else
44    . $ZOTONIC_SCRIPTS/helpers/zotonic_setup
45    $ZOTONIC_SCRIPTS/zotonic-$1 ${@:2}
46    EXIT="$?"
47    . $ZOTONIC_SCRIPTS/helpers/zotonic_teardown
48    exit $EXIT
49fi
50