Permalink
Browse files

options options options

  • Loading branch information...
1 parent 461550b commit 70ce9fd4b5573d4517bb9b95b1fae2c9565f3d9a @jneen committed Jan 12, 2011
Showing with 14 additions and 7 deletions.
  1. +4 −5 bin/balls
  2. +10 −2 lib/balls.sh
View
@@ -2,8 +2,6 @@
BALLS_LIB=$(dirname $0)/../lib
BALLS_LIB=$(readlink -f "$BALLS_LIB") # expand the ../
-. $BALLS_LIB/balls.sh
-
mode=$1; shift
while getopts 'e:C:' opt; do
@@ -27,10 +25,11 @@ while getopts 'e:C:' opt; do
esac
done
-[ -z "$BALLS_ENV" ] && BALLS_ENV=development
-[ -z "$BALLS_CONF" ] && BALLS_CONF=./config/$BALLS_ENV.sh
-
+[[ -z "$BALLS_ENV" ]] && BALLS_ENV=development
+[[ -z "$BALLS_CONF" ]] && BALLS_CONF=./config/$BALLS_ENV.sh
. "$BALLS_CONF"
+. $BALLS_LIB/balls.sh
+
case $mode in
server)
View
@@ -1,13 +1,21 @@
#!/bin/bash
+[[ -z "$BALLS_LIB" ]] && BALLS_LIB=.
+
+[[ -z "$BALLS_CONF" ]] && BALLS_CONF=./config.sh
+[[ -z "$BALLS_ROOT" ]] && BALLS_ROOT=$(readlink -f "$(dirname $BALLS_CONF)/../")
[[ -z "$BALLS_LIB" ]] && BALLS_LIB=$(dirname $0)
-[[ -z "$TMP_DIR" ]] && TMP_DIR=/tmp/balls
-[[ -d "$TMP_DIR" ]] && mkdir "$TMP_DIR"
+[[ -z "$BALLS_TMP" ]] && BALLS_TMP=/tmp/balls
+[[ -d "$BALLS_TMP" ]] || mkdir "$BALLS_TMP"
[[ -z "$BALLS_PORT" ]] && BALLS_PORT=3000
+[[ -z "$BALLS_VIEWS" ]] && BALLS_VIEWS=$BALLS_ROOT/views
+[[ -z "$BALLS_ACTIONS" ]] && BALLS_ACTIONS=$BALLS_ROOT/actions
+
. $BALLS_LIB/util.sh
. $BALLS_LIB/http.sh
. $BALLS_LIB/router.sh
. $BALLS_LIB/server.sh
+. $BALLS_ACTIONS/*.sh

0 comments on commit 70ce9fd

Please sign in to comment.