Skip to content
Newer
Older
100755 79 lines (63 sloc) 1.49 KB
475e6a4 @jcs initial import of halfmoon (with latest php-activerecord tree)
authored
1 #!/bin/sh
2
3 prog=`basename "$0"`
4 hmdir=`dirname "$0"`
5
6 usage () {
6dbfcfe @jcs specifying create -d will keep halfmoon/.git dir
authored
7 echo "usage: $prog \"create\" [-d] <dir>"
475e6a4 @jcs initial import of halfmoon (with latest php-activerecord tree)
authored
8 exit 1
9 }
10
11 create () {
12 if [ X"$1" = X"" ]; then
13 usage
14 fi
15
6dbfcfe @jcs specifying create -d will keep halfmoon/.git dir
authored
16 DEV_COPY=0
17 if [ X"$1" = X"-d" ]; then
18 DEV_COPY=1
19 shift
20 fi
21
22 DIR=$1
23 APP_NAME=`basename $DIR`
f879367 @jcs set some defaults to the app name
authored
24
6dbfcfe @jcs specifying create -d will keep halfmoon/.git dir
authored
25 if ! [ -d $DIR ]; then
26 /bin/echo -n "creating $APP_NAME in $DIR... " && \
27 (mkdir $DIR || exit) && \
475e6a4 @jcs initial import of halfmoon (with latest php-activerecord tree)
authored
28 echo "done."
29 fi
30
6dbfcfe @jcs specifying create -d will keep halfmoon/.git dir
authored
31 if ! [ -d $DIR ]; then
0c51f12 @jcs bail if the directory couldn't be made
authored
32 echo "couldn't make directory, exiting"
33 exit 1
34 fi
35
aeb2ef4 @jcs explicitly call /bin/echo for -n
authored
36 /bin/echo -n "copying halfmoon framework... " && \
6dbfcfe @jcs specifying create -d will keep halfmoon/.git dir
authored
37 mkdir $DIR/halfmoon && \
38 cp -rp $hmdir/. $DIR/halfmoon/ && \
475e6a4 @jcs initial import of halfmoon (with latest php-activerecord tree)
authored
39 echo "done."
40
aeb2ef4 @jcs explicitly call /bin/echo for -n
authored
41 /bin/echo -n "creating skeleton directory structure... " && \
6dbfcfe @jcs specifying create -d will keep halfmoon/.git dir
authored
42 cp -rp $DIR/halfmoon/skel/. $DIR/ && \
43 mkdir $DIR/models && \
475e6a4 @jcs initial import of halfmoon (with latest php-activerecord tree)
authored
44 echo "done."
45
6dbfcfe @jcs specifying create -d will keep halfmoon/.git dir
authored
46 if [ X"$DEV_COPY" != X"1" ]; then
47 rm -rf $DIR/halfmoon/.git
48 fi
49
aeb2ef4 @jcs explicitly call /bin/echo for -n
authored
50 /bin/echo -n "creating random encryption key for session storage... "
00aca78 @jcs introduce an encrypted cookie-based session store, modeled after the …
authored
51 RANDKEY=`openssl rand 16 -hex`
f879367 @jcs set some defaults to the app name
authored
52 sed -e "s/%%COOKIE_ENCRYPTION_KEY%%/${RANDKEY}/" \
53 -e "s/%%APP_NAME%%/${APP_NAME}/g" \
6dbfcfe @jcs specifying create -d will keep halfmoon/.git dir
authored
54 $DIR/config/boot.php > $DIR/config/boot.php.tmp && \
55 mv -f $DIR/config/boot.php.tmp $DIR/config/boot.php && \
00aca78 @jcs introduce an encrypted cookie-based session store, modeled after the …
authored
56 echo "done."
57
f879367 @jcs set some defaults to the app name
authored
58 sed -e "s/%%APP_NAME%%/${APP_NAME}/g" \
6dbfcfe @jcs specifying create -d will keep halfmoon/.git dir
authored
59 $DIR/views/layouts/application.phtml > \
60 $DIR/views/layouts/application.phtml.tmp && \
61 mv -f $DIR/views/layouts/application.phtml.tmp \
62 $DIR/views/layouts/application.phtml
f879367 @jcs set some defaults to the app name
authored
63
475e6a4 @jcs initial import of halfmoon (with latest php-activerecord tree)
authored
64 echo ""
6dbfcfe @jcs specifying create -d will keep halfmoon/.git dir
authored
65 echo " $DIR:"
66 ls -lF $DIR | sed 's/^/ /'
475e6a4 @jcs initial import of halfmoon (with latest php-activerecord tree)
authored
67 echo ""
68
69 echo "welcome to halfmoon!"
70 }
71
72 case $1 in
73 "create")
6dbfcfe @jcs specifying create -d will keep halfmoon/.git dir
authored
74 create $2 $3
475e6a4 @jcs initial import of halfmoon (with latest php-activerecord tree)
authored
75 ;;
76 *)
77 usage
78 esac
Something went wrong with that request. Please try again.