updated on Thu Jan 19 20:01:47 UTC 2012
[aur-mirror.git] / codeigniter / codeigniter-create-project
blobf034b350a3cf733a20564d538ec54dbd6c75cb98
1 #!/bin/bash
3 function help() {
4 cat << EOF
5 Usage: $0 html_path app_path
6 html_path: directory, where your CodeIgniter's index.php is (e.g. ~/public_html/ci)
7 app_path: directory, where your CodeIgniter programs are (e.g. ~/programs/CI)
8 EOF
11 if [ $# -ne 2 ]; then
12 help
13 exit 1
16 WEBDIR=$1
17 APPDIR=$2
18 CI_DIR=/usr/share/pear/codeigniter
20 echo "Create web-directory ($WEBDIR)"
21 install -d $WEBDIR || exit 1
22 echo "Copy index.php to $WEBDIR"
23 install $CI_DIR/index.php $WEBDIR || exit 1
24 sed -i "s@\$application_folder.*=.*@\$application_folder = \"$APPDIR\";@" $WEBDIR/index.php || exit 1
25 sed -i "59 s@\$system_path.*=.*@\$system_path = \"$CI_DIR/system\";@" $WEBDIR/index.php || exit 1
27 echo "Create main app directory ($APPDIR)"
28 install -d $APPDIR || exit 1
29 echo "Creating directories to app directory"
30 for dir in cache config controllers core errors helpers hooks language libraries logs models third_party views; do
31 install -d $APPDIR/$dir || exit 1
32 [ -d $CI_DIR/application/$dir ] && (cp -r -n $CI_DIR/application/$dir/* $APPDIR/$dir || exit 1)
33 done
35 echo Installation done.