-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsetupci
More file actions
executable file
·125 lines (91 loc) · 2.79 KB
/
setupci
File metadata and controls
executable file
·125 lines (91 loc) · 2.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#!/bin/bash
# get script dir
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# read config file
source ./setupci.cfg
# check for a provided directory
if test -z "$1"; then
echo "Please provide a directory name"
exit
fi
# create directory if it doesn't exist
if [ ! -d $1 ]; then
mkdir $1
fi
# move to directory
cd $1
# download codeigniter
curl -C - -L http://codeigniter.com/download.php -o ci.zip
# extract codeigniter
unzip ci.zip
mv CodeIgniter*/* .
rm -rf CodeIgniter* ci.zip
# kill the user guide and index.php
rm -rf user_guide index.php
# find and remove all the index.html files
find . -name 'index.html' -exec rm -f {} \;
# find and remove all the .htaccess files
find . -name '.htaccess' -exec rm -f {} \;
# make an httpdocs folder and assets folder
mkdir -p httpdocs/-/css httpdocs/-/js httpdocs/-/img
touch httpdocs/-/css/style.css httpdocs/-/js/core.js
# move over files
mv license.txt httpdocs/.
cp $DIR/templates/index.php $DIR/templates/.htaccess httpdocs/.
cp $DIR/templates/config.php $DIR/templates/routes.php application/config/.
cp $DIR/templates/pages.php application/controllers/.
# set permissions on cache and log folder
chmod 755 application/cache application/logs
# clear out welcome project
rm application/controllers/welcome.php application/views/welcome_message.php
# check if we should skip sparks
if [ "$2" != "--no-sparks" ]; then
# add sparks
php -r "$(curl -fsSL http://getsparks.org/go-sparks)"
fi
# check if we should skip git
if [ "$3" != "--no-git" ]; then
# copy over .gitignore
cp $DIR/templates/.gitignore .
# create a local git repo
git init
git add * .gitignore
git commit -m "Initial commit."
# check if we should skip remote sync
if [ "$4" != "--no-gitremote" ]; then
# check if the repo exists and is writable
EXISTS=$(git ls-remote $REPO_URL:$1.git 2>&1)
if [ "$EXISTS" == "" ]; then
git remote add origin $REPO_URL:$1.git
git push origin master
git checkout origin/master
git branch -f master origin/master
git checkout master
fi
fi
# check if we should set up git flow
if [ "$5" != "--no-gitflow" ]; then
# add git flow
git flow init -d
fi
fi
# get a md5sum of the date command
MD5=`date | openssl md5`
# provide instructions
echo ""
echo ""
echo ""
echo "========================================================================"
echo "Remaining steps:"
echo " 1. In 'application/config/config.php' add the base_url and an"
echo " encryption_key value ($MD5)"
echo ""
echo " 2. In 'application/config/database.php' add database credentials"
echo ""
if [ "$2" != "--no-sparks" ]; then
echo " 3. Change the line in 'application/core/MY_Loader.php' Line 50, to:"
echo ""
echo " define('SPARKPATH', '../sparks/');"
fi
echo "========================================================================"
echo ""