-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup_dev_env.sh
executable file
·96 lines (88 loc) · 2.49 KB
/
setup_dev_env.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
#!/bin/bash
########################################
#
# This is a script for setting up
# a complete development environment
# of the API Leipzig.
#
# ONLY USE THIS FOR *LOCAL* DEVELOPMENT!
#
# Usage:
# - Install git, rvm with ruby 1.8.7 and bundler
# - cd to a directory where you want to create the api folder
# - Run the script with the following command
# $ bash < <(curl -s https://raw.github.com/apileipzig/dev/master/setup_dev_env.sh)
# - If you don't have curl, download it from https://github.com/apileipzig/dev and run it manually
#
########################################
echo "cloning all repositories..."
git clone [email protected]:apileipzig/frontend.git api/
cd api/
if [ ! -d api/ ]; then
git clone [email protected]:apileipzig/api.git
else
echo "folder exists! skipping cloning api..."
fi
if [ ! -d panel/ ]; then
git clone [email protected]:apileipzig/panel.git
else
echo "folder exists! skipping cloning panel..."
fi
if [ ! -d wiki/ ]; then
git clone [email protected]:apileipzig/wiki.git
else
echo "folder exists! skipping cloning wiki..."
fi
echo "invoke rvm..."
which rvm &>/dev/null
if [ $? -eq 0 ]
then
rvm ree &>/dev/null
if [ $? -eq 0 ]
then
rvm ree
else
echo "Ruby Enterprise Edition not found! Trying to install it with rvm..."
rvm install ree
rvm ree
fi
else
echo "RVM not found. Please install the Ruby Version Manager from here: http://rvm.beginrescueend.com/"
exit
fi
bundle -v &>/dev/null
if [ $? -ne 0 ]
then
echo "Bundler not found! Trying to install it..."
gem install bundler
fi
echo "bundle everything..."
cd api/
bundle --without production
cd ../panel
bundle --without production
cd ../wiki
bundle --without production
cd ..
echo "generating dev files for the api..."
cd api/
echo -e "development:\n adapter: sqlite3\n database: db/development.sqlite3\n pool: 5\n timeout: 5000\n\ntest:\n adapter: sqlite3\n database: db/test.sqlite3\n" > database.yml
bundle exec rake db:migrate
bundle exec rake db:seed
bundle exec rake permissions:init
bundle exec rake permissions:add:all [email protected]
cd ..
echo "generating dev files for the panel..."
cd panel/
echo -e "development:\n adapter: sqlite3\n database: ../api/db/development.sqlite3\n pool: 5\n timeout: 5000" > config/database.yml
cd ..
cp -R css/ panel/public/css
cp -R js/ panel/public/js
mkdir -p panel/public/images
cp -R images/* panel/public/images/
echo "generating dev files for the wiki..."
cd wiki/
cd ..
cp -R css/ wiki/public/css
cp -R js/ wiki/public/js
cp -R images/ wiki/public/images/