-
Notifications
You must be signed in to change notification settings - Fork 11
/
mo-dev
executable file
·98 lines (82 loc) · 2.21 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_db=
if [ ! $dir ]; then
echo "Usage: mo-dev <dir> <repo>"
exit
fi
cd $dir
if [ ! $? -eq 0 ]; then
echo "Destination directory, " $dir ", doesn't exist!"
exit
fi
if [ ! -d mushroom-observer/app ]; then
rm -rf mushroom-observer # must be clean or git clone fails!
git clone https://github.com/MushroomObserver/mushroom-observer.git
fi
cd mushroom-observer
if [ -f .ruby-version ]; then
if ! [[ `ruby --version` =~ `cat .ruby-version` ]]; then
echo "Installing ruby version " `cat .ruby-version`
rvm install `cat .ruby-version`
fi
fi
echo "Ensure we have the latest bundler"
gem install bundler
if [ ! -f config/database.yml ]; then
cp db/vagrant/database.yml config
echo Copied config/database.yml
else
echo database.yml exists
fi
if [ ! -f config/gmaps_api_key.yml ]; then
cp config/gmaps_api_key.yml-template config/gmaps_api_key.yml
echo Copied config/gmaps_api_key.yml
else
echo gmaps_api_key.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/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
if [ ! -f /usr/bin/exiftool ]; then
sudo apt-get install -y libimage-exiftool-perl
echo Installed exiftool
else
echo exiftool exists
fi
git pull
bundle install
mysql -u mo -pmo mo_development -e ''
if [ ! $? -eq 0 ]; then
mysql -u root -proot < db/initialize.sql
bin/rails db:environment:set RAILS_ENV=development
rails db:schema:load
rails db:fixtures:load
echo Created and populated mo_development database
else
rails db:migrate
echo Ran migrations on the mo_development database
fi
rails lang:update