forked from MushroomObserver/developer-startup
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmo-dev
More file actions
executable file
·119 lines (102 loc) · 2.71 KB
/
mo-dev
File metadata and controls
executable file
·119 lines (102 loc) · 2.71 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
#!/bin/bash
dir=$1
new_rvm=
run_rake_db_seen=
if [ ! $dir ]; then
echo "Usage: mo-dev <dir>"
exit
fi
if ! [[ `dpkg -l` =~ libgmp.-dev ]]; then
echo Installing libgmp
sudo apt-get install -y libgmp3-dev
else
echo libgmp already installed
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 bundle --no-rdoc --no-ri
else
echo RVM installed
fi
source ~/.rvm/scripts/rvm
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
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
if ! [[ `gem list` =~ "bundle " ]]; then
echo "Installing bundler"
gem install bundle --no-rdoc --no-ri
else
echo "Bundler already installed"
fi
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
run_rake_db_seed=1
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
if [ $run_rake_db_seed ]; then
rake db:seed
fi
rake lang:update
if [ $new_rvm ]; then
echo "RVM installed. Run: source /home/vagrant/.rvm/scripts/rvm"
fi