This repository has been archived by the owner on Feb 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
/
startproject.sh
executable file
·137 lines (98 loc) · 5.13 KB
/
startproject.sh
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
126
127
128
129
130
131
132
133
134
135
136
137
#!/bin/bash
set -e
DEST_DIR="$1"
BRANCH="${2:-master}"
if [[ -z "$DEST_DIR" ]];
then
>&2 echo 'You must specify a destination directory.'
exit 1
fi
if [[ -d "$DEST_DIR" ]];
then
>&2 echo "Destination directory '$DEST_DIR' already exists."
exit 1
fi
DEST_DIR_BASENAME="$(basename $DEST_DIR)"
cat <<EOF
This script will create a new ICEkit project in directory '${DEST_DIR}'.
EOF
read -p 'Press CTRL-C to abort or any other key to continue...'
echo
if [[ -z $(which wget) ]]; then
echo "'wget' is not available. Please install it and try again."
exit 1
fi
mkdir -p "$DEST_DIR"
cd "$DEST_DIR"
curl -#fLO "https://raw.githubusercontent.com/ic-labs/django-icekit/${BRANCH}/project_template/.coveragerc"
curl -#fLO "https://raw.githubusercontent.com/ic-labs/django-icekit/${BRANCH}/project_template/.dockerignore"
curl -#fLO "https://raw.githubusercontent.com/ic-labs/django-icekit/${BRANCH}/project_template/.editorconfig"
curl -#fLO "https://raw.githubusercontent.com/ic-labs/django-icekit/${BRANCH}/project_template/.env.local.sample"
curl -#fLO "https://raw.githubusercontent.com/ic-labs/django-icekit/${BRANCH}/project_template/.env.production"
curl -#fLO "https://raw.githubusercontent.com/ic-labs/django-icekit/${BRANCH}/project_template/.env.staging"
curl -#fLO "https://raw.githubusercontent.com/ic-labs/django-icekit/${BRANCH}/project_template/.gitignore"
curl -#fLO "https://raw.githubusercontent.com/ic-labs/django-icekit/${BRANCH}/project_template/.travis.yml"
curl -#fLO "https://raw.githubusercontent.com/ic-labs/django-icekit/${BRANCH}/project_template/bower.json"
curl -#fLO "https://raw.githubusercontent.com/ic-labs/django-icekit/${BRANCH}/project_template/docker-cloud.yml"
curl -#fLO "https://raw.githubusercontent.com/ic-labs/django-icekit/${BRANCH}/project_template/docker-compose.override.sample.yml"
curl -#fLO "https://raw.githubusercontent.com/ic-labs/django-icekit/${BRANCH}/project_template/docker-compose.travis.yml"
curl -#fLO "https://raw.githubusercontent.com/ic-labs/django-icekit/${BRANCH}/project_template/docker-compose.yml"
curl -#fLO "https://raw.githubusercontent.com/ic-labs/django-icekit/${BRANCH}/project_template/Dockerfile"
curl -#fLO "https://raw.githubusercontent.com/ic-labs/django-icekit/${BRANCH}/project_template/go.sh"
curl -#fLO "https://raw.githubusercontent.com/ic-labs/django-icekit/${BRANCH}/project_template/package.json"
curl -#fLO "https://raw.githubusercontent.com/ic-labs/django-icekit/${BRANCH}/project_template/project_settings.py"
curl -#fLO "https://raw.githubusercontent.com/ic-labs/django-icekit/${BRANCH}/project_template/project_settings_local.sample.py"
curl -#fLO "https://raw.githubusercontent.com/ic-labs/django-icekit/${BRANCH}/project_template/requirements-icekit.txt"
curl -#fLO "https://raw.githubusercontent.com/ic-labs/django-icekit/${BRANCH}/project_template/requirements.in"
curl -#fLO "https://raw.githubusercontent.com/ic-labs/django-icekit/${BRANCH}/project_template/requirements.txt"
curl -#fLO "https://raw.githubusercontent.com/ic-labs/django-icekit/${BRANCH}/project_template/test_initial_data.sql"
chmod +x go.sh
touch requirements.txt
# Find and replace 'project_template' with destination directory basename.
find . -type f -exec sed -e "s/project_template/$DEST_DIR_BASENAME/g" -i.deleteme {} \;
find . -type f -iname "*.deleteme" -delete
# Use release versions of ICEkit.
sed -e "s|\.\.|git+https://github.com/ic-labs/django-icekit@master#egg=django-icekit|" requirements-icekit.txt > requirements-icekit.txt.replaced
sed -e "s|:local|:master|" Dockerfile > Dockerfile.replaced
mv requirements-icekit.txt.replaced requirements-icekit.txt
mv Dockerfile.replaced Dockerfile
if [[ -n $(which git) ]]; then
echo
read -p 'Would you like to initialize a Git repository for your new project and create an initial commit? (Y/n) ' -n 1 -r
echo
if [[ "${REPLY:-y}" =~ ^[Yy]$ ]]; then
git init
git add -A
git commit -m 'Initial commit.'
fi
fi
cat <<EOF
All done! What now? First, change to the project directory:
$ cd ${DEST_DIR}
# Run with Docker
The easiest way to run an ICEkit project is with Docker. It works on OS X,
Linux, and Windows, takes care of all the project dependencies like the
database and search engine, and makes deployment easy.
If you haven't already, go install Docker:
* [OS X](https://download.docker.com/mac/stable/Docker.dmg)
* [Linux](https://docs.docker.com/engine/installation/linux/)
* [Windows](https://download.docker.com/win/stable/InstallDocker.msi)
Build a Docker image:
$ docker-compose build --pull
Run a 'django' container and all of its dependancies:
$ docker-compose run --rm --service-ports django
Create a superuser account:
# manage.py createsuperuser
Run the Django dev server:
# runserver.sh
Open the site in a browser:
http://localhost:8000
When you're done, exit the container and stop all of its dependencies:
# exit
$ docker-compose stop
Read our [Docker guide](http://docs.glamkit.com/en/latest/install/docker.html)
guide for more info on running an ICEkit project with Docker.
# Run without Docker
Read our [Manual Setup](http://docs.glamkit.com/en/latest/install/manual-install.html)
guide for more info on running an ICEkit project without Docker.
EOF