forked from MushroomObserver/developer-startup
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmo-dev
executable file
·98 lines (84 loc) · 2.34 KB
/
mo-dev
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
#!/bin/bash
dir=$1
new_rvm=
if [ ! $dir ]; then
echo "Usage: mo-dev <dir>"
exit
fi
if [ ! -d /home/vagrant/.rvm ]; then
echo Installing RVM
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
curl -L https://get.rvm.io | bash -s stable
source /home/vagrant/.rvm/scripts/rvm
new_rvm=1
sudo gem install bundler
else
echo RVM installed
fi
cd $dir
if [ ! $? -eq 0 ]; then
echo "Destination directory, " $dir ", doesn't exist!"
exit
fi
if [ ! -d mushroom-observer ]; then
git clone https://github.com/MushroomObserver/mushroom-observer.git
fi
if [ -f mushroom-observer/.ruby-version ]; then
if ! [[ `which ruby` =~ `cat mushroom-observer/.ruby-version` ]]; then
echo "Installing ruby version " `cat mushroom-observer/.ruby-version`
rvm install `cat mushroom-observer/.ruby-version`
fi
fi
cd mushroom-observer
mysql -u mo -pmo mo_development -e ''
if [ ! $? -eq 0 ]; then
mysql -u root -proot < db/initialize.sql
mysql -u mo -pmo mo_development < db/vagrant/init.sql
echo Created and populated mo_development database
else
echo mo_development exists
fi
if [ ! -f config/database.yml ]; then
cp db/vagrant/database.yml config
echo Copied config/database.yml
else
echo database.yml exists
fi
for dir in images test_images;
do
for subdir in thumb 320 640 960 1280 orig;
do
if [ ! -d public/$dir/$subdir ]; then
mkdir -p public/$dir/$subdir
echo Created public/$dir/$subdir
else
echo public/$dir/$subdir exists
fi
done
done
if [ ! -f /usr/local/bin/jpegresize ]; then
sudo gcc script/jpegresize.c -ljpeg -lm -O2 -o /usr/local/bin/jpegresize
echo Created and installed jpegresize executable
else
echo jpegresize exists
fi
if [ ! -f /usr/local/bin/jpegexiforient ]; then
sudo gcc script/jpegexiforient.c -o /usr/local/bin/jpegexiforient
echo Created and installed jpegexiforient executable
else
echo jpegexiforient exists
fi
if [ ! -f /usr/local/bin/exifautotran ]; then
sudo cp script/exifautotran /usr/local/bin/exifautotran
sudo chmod 755 /usr/local/bin/exifautotran
echo Installed exifautotran script
else
echo exifautotran exists
fi
git pull
bundle install
rake db:migrate
rake lang:update
if [ $new_rvm ]; then
echo "RVM installed. Run: source /home/vagrant/.rvm/scripts/rvm"
fi