Description:
updated installation script
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r141:713a51b141eb - - 1 file changed: 43 inserted, 30 deleted

@@ -1,32 +1,44
1 1 #!/bin/sh
2 2
3 3 echo "This script will install and configure Cafe grader."
4 4
5 - echo "Installing required apt"
5 + echo "This will install Ruby 1.9.2 under rvm"
6 +
7 + echo "Installing required apts"
6 8
7 9 sudo apt-get update
8 - sudo apt-get install mysql-server mysql-client ruby1.8 ruby1.8-dev rdoc1.8 \
9 - g++ gcc libmysql-ruby1.8 irb apache2 libmysqlclient15-dev build-essential \
10 - git-core rubygems rake openssl libopenssl-ruby
10 + sudo apt-get install mysql-server mysql-client \
11 + g++ gcc apache2 libmysqlclient15-dev build-essential \
12 + git-core openssl libreadline6 libreadline6-dev \
13 + zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev \
14 + sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev \
15 + ncurses-dev automake libtool bison subversion \
16 + pkg-config curl nodejs
11 17
12 - echo "Installing rails"
18 + echo "Installing RVM"
19 + curl -L https://get.rvm.io | bash -s stable
20 + ~/.rvm/scripts/rvm
13 21
14 - sudo gem install rails --no-ri --no-rdoc --version=2.3.8
22 + echo "Installing Ruby 1.9.2 in RVM"
23 +
24 + rvm install 1.9.2
25 + rvm use 1.9.2
15 26
16 27 echo "Fetching Cafe Grader from Git repositories"
17 28
18 29 echo "Fetching web interface"
19 30
20 31 mkdir cafe_grader
21 32 cd cafe_grader
22 - git clone -q git://gitorious.org/cafe-grader/cafe-grader-web.git web
33 + git clone -q git://github.com/jittat/cafe-grader-web.git web
23 34
24 35 echo "Configuring rails app"
25 36
26 - cp web/config/environment.rb.SAMPLE web/config/environment.rb
37 + cp web/config/application.rb.SAMPLE web/config/application.rb
38 + cp web/config/initializers/cafe_grader_config.rb.SAMPLE web/config/initializers/cafe_grader_config.rb
27 39
28 40 echo "At this point we will need MySQL user and database."
29 41 echo "Have you created MySQL user and database for Cafe grader? (Y/N) "
30 42 read ch
31 43
32 44 if [ "$ch" = "n" -o "$ch" = "N" ]
@@ -64,36 +76,41
64 76 read username
65 77
66 78 echo "Please provide $username password:"
67 79 read password
68 80
69 81 echo "development:" > config/database.yml
70 - echo " adapter: mysql" >> config/database.yml
82 + echo " adapter: mysql2" >> config/database.yml
83 + echo " encoding: utf8" >> config/database.yml
84 + echo " reconnect: false" >> config/database.yml
71 85 echo " database: $database" >> config/database.yml
72 - echo " username: $username" >> config/database.yml
73 - echo " password: $password" >> config/database.yml
74 - echo " host: localhost" >> config/database.yml
75 - echo "" >> config/database.yml
76 - echo "production:" >> config/database.yml
77 - echo " adapter: mysql" >> config/database.yml
78 - echo " database: $database" >> config/database.yml
86 + echo " pool: 5" >> config/database.yml
79 87 echo " username: $username" >> config/database.yml
80 88 echo " password: $password" >> config/database.yml
81 89 echo " host: localhost" >> config/database.yml
90 + echo " socket: /var/run/mysqld/mysqld.sock" >> config/database.yml
91 + echo "" >> config/database.yml
92 + echo "production:" >> config/database.yml
93 + echo " adapter: mysql2" >> config/database.yml
94 + echo " encoding: utf8" >> config/database.yml
95 + echo " reconnect: false" >> config/database.yml
96 + echo " database: $database" >> config/database.yml
97 + echo " pool: 5" >> config/database.yml
98 + echo " username: $username" >> config/database.yml
99 + echo " password: $password" >> config/database.yml
100 + echo " host: localhost" >> config/database.yml
101 + echo " socket: /var/run/mysqld/mysqld.sock" >> config/database.yml
82 102
83 - echo "Object.instance_eval{remove_const :GRADER_ROOT_DIR}" >> config/environment.rb
84 - echo "Object.instance_eval{remove_const :GRADING_RESULT_DIR}" >> config/environment.rb
85 - echo "GRADER_ROOT_DIR = '$CAFE_PATH/judge'" >> config/environment.rb
86 - echo "GRADING_RESULT_DIR = '$CAFE_PATH/judge/result'" >> config/environment.rb
103 + echo "Object.instance_eval{remove_const :GRADER_ROOT_DIR}" >> config/initializers/cafe_grader_config.rb
104 + echo "Object.instance_eval{remove_const :GRADING_RESULT_DIR}" >> config/initializers/cafe_grader_config.rb
105 + echo "GRADER_ROOT_DIR = '$CAFE_PATH/judge'" >> config/initializers/cafe_grader_config.rb
106 + echo "GRADING_RESULT_DIR = '$CAFE_PATH/judge/result'" >> config/initializers/cafe_grader_config.rb
87 107
88 108 echo "Installing required gems"
89 109
90 - sudo rake gems:install
91 - # to remove log file owned by root
92 - sudo rm log/*
93 - sudo rmdir log
110 + bundle install
94 111
95 112 echo "Running rake tasks to initialize database"
96 113
97 114 rake db:migrate
98 115 rake db:seed
99 116
@@ -102,13 +119,13
102 119 echo "Fetching grader"
103 120
104 121 cd ..
105 122
106 123 mkdir judge
107 124 cd judge
108 - git clone -q http://git.gitorious.org/cafe-grader/cafe-grader-judge-scripts.git scripts
125 + git clone -q git://github.com/jittat/cafe-grader-judge-scripts.git scripts
109 126 mkdir raw
110 127 mkdir ev-exam
111 128 mkdir ev
112 129 mkdir result
113 130 mkdir log
114 131
@@ -122,20 +139,16
122 139 echo "GRADER_ROOT = '$CAFE_PATH/judge/scripts'" >> scripts/config/environment.rb
123 140 echo "require File.join(File.dirname(__FILE__),'../lib/boot')" >> scripts/config/environment.rb
124 141 echo "require File.dirname(__FILE__) + \"/env_#{GRADER_ENV}.rb\"" >> scripts/config/environment.rb
125 142
126 143 cd ..
127 144
128 - echo "Installing web server mongrel"
129 -
130 - sudo gem install mongrel --no-ri --no-rdoc
131 -
132 145 echo "Now you are ready to run cafe grader...."
133 146 echo
134 147 echo "Try:"
135 148 echo
136 149 echo " cd web"
137 - echo " ./script/server"
150 + echo " rails s"
138 151 echo
139 152 echo "and access web at http://localhost:3000/"
140 153 echo "The root username is 'root', its password is 'ioionrails'."
141 154
You need to be logged in to leave comments. Login now