Description:
updated to rails 2.3.8 by removing dependence on rack 1.0.1, be quiet when fetching git repos
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r134:e76da497dd2a - - 1 file changed: 2 inserted, 3 deleted

@@ -1,142 +1,141
1 #!/bin/sh
1 #!/bin/sh
2
2
3 echo "This script will install and configure Cafe grader."
3 echo "This script will install and configure Cafe grader."
4
4
5 echo "Installing required apt"
5 echo "Installing required apt"
6
6
7 sudo apt-get update
7 sudo apt-get update
8 sudo apt-get install mysql-server mysql-client ruby1.8 ruby1.8-dev rdoc1.8 \
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 \
9 g++ gcc libmysql-ruby1.8 irb apache2 libmysqlclient15-dev build-essential \
10 git-core rubygems rake openssl libopenssl-ruby
10 git-core rubygems rake openssl libopenssl-ruby
11
11
12 echo "Installing rails"
12 echo "Installing rails"
13
13
14 sudo gem install rails --no-ri --no-rdoc
14 sudo gem install rails --no-ri --no-rdoc
15 - sudo gem install rack -v=1.0.1 --no-ri --no-rdoc
16
15
17 echo "Fetching Cafe Grader from Git repositories"
16 echo "Fetching Cafe Grader from Git repositories"
18
17
19 echo "Fetching web interface"
18 echo "Fetching web interface"
20
19
21 mkdir cafe_grader
20 mkdir cafe_grader
22 cd cafe_grader
21 cd cafe_grader
23 - git clone http://git.gitorious.org/cafe-grader/cafe-grader-web.git web
22 + git clone -q http://git.gitorious.org/cafe-grader/cafe-grader-web.git web
24
23
25 echo "Configuring rails app"
24 echo "Configuring rails app"
26
25
27 cp web/config/environment.rb.SAMPLE web/config/environment.rb
26 cp web/config/environment.rb.SAMPLE web/config/environment.rb
28
27
29 echo "At this point we will need MySQL user and database."
28 echo "At this point we will need MySQL user and database."
30 echo "Have you created MySQL user and database for Cafe grader? (Y/N) "
29 echo "Have you created MySQL user and database for Cafe grader? (Y/N) "
31 read ch
30 read ch
32
31
33 if [ "$ch" = "n" -o "$ch" = "N" ]
32 if [ "$ch" = "n" -o "$ch" = "N" ]
34 then
33 then
35 echo "Please open another terminal and create the user and database for Cafe grader."
34 echo "Please open another terminal and create the user and database for Cafe grader."
36 echo "Don't forget to grant access to that database for the user."
35 echo "Don't forget to grant access to that database for the user."
37 echo "Please have username, password, and database name ready before continue."
36 echo "Please have username, password, and database name ready before continue."
38 echo
37 echo
39 echo "The following are instructions:"
38 echo "The following are instructions:"
40 echo "1. Run mysql:"
39 echo "1. Run mysql:"
41 echo
40 echo
42 echo " mysql -u root -p"
41 echo " mysql -u root -p"
43 echo
42 echo
44 echo " if you have just installed mysql, the root password is the one that you have just entered"
43 echo " if you have just installed mysql, the root password is the one that you have just entered"
45 echo "2. Create a new database, a new user, and grant access to grader database:"
44 echo "2. Create a new database, a new user, and grant access to grader database:"
46 echo
45 echo
47 echo " create user 'USERNAME'@'localhost' identified by 'PASSWORD';"
46 echo " create user 'USERNAME'@'localhost' identified by 'PASSWORD';"
48 echo " create database \`DATABASENEME\`;"
47 echo " create database \`DATABASENEME\`;"
49 echo " grant all on \`DATABASENAME\`.* to 'USERNAME'@'localhost';"
48 echo " grant all on \`DATABASENAME\`.* to 'USERNAME'@'localhost';"
50 echo
49 echo
51 echo " Replace USERNAME, PASSWORD, and DATABASENAME accordingly."
50 echo " Replace USERNAME, PASSWORD, and DATABASENAME accordingly."
52 echo
51 echo
53 echo "Hit enter when ready..."
52 echo "Hit enter when ready..."
54 read dummy
53 read dummy
55 fi
54 fi
56
55
57 CAFE_PATH=`pwd`
56 CAFE_PATH=`pwd`
58
57
59 cd web
58 cd web
60
59
61 echo "Please provide grader database:"
60 echo "Please provide grader database:"
62 read database
61 read database
63
62
64 echo "Please provide grader username:"
63 echo "Please provide grader username:"
65 read username
64 read username
66
65
67 echo "Please provide $username password:"
66 echo "Please provide $username password:"
68 read password
67 read password
69
68
70 echo "development:" > config/database.yml
69 echo "development:" > config/database.yml
71 echo " adapter: mysql" >> config/database.yml
70 echo " adapter: mysql" >> config/database.yml
72 echo " database: $database" >> config/database.yml
71 echo " database: $database" >> config/database.yml
73 echo " username: $username" >> config/database.yml
72 echo " username: $username" >> config/database.yml
74 echo " password: $password" >> config/database.yml
73 echo " password: $password" >> config/database.yml
75 echo " host: localhost" >> config/database.yml
74 echo " host: localhost" >> config/database.yml
76 echo "" >> config/database.yml
75 echo "" >> config/database.yml
77 echo "production:" >> config/database.yml
76 echo "production:" >> config/database.yml
78 echo " adapter: mysql" >> config/database.yml
77 echo " adapter: mysql" >> config/database.yml
79 echo " database: $database" >> config/database.yml
78 echo " database: $database" >> config/database.yml
80 echo " username: $username" >> config/database.yml
79 echo " username: $username" >> config/database.yml
81 echo " password: $password" >> config/database.yml
80 echo " password: $password" >> config/database.yml
82 echo " host: localhost" >> config/database.yml
81 echo " host: localhost" >> config/database.yml
83
82
84 echo "Object.instance_eval{remove_const :GRADER_ROOT_DIR}" >> config/environment.rb
83 echo "Object.instance_eval{remove_const :GRADER_ROOT_DIR}" >> config/environment.rb
85 echo "Object.instance_eval{remove_const :GRADING_RESULT_DIR}" >> config/environment.rb
84 echo "Object.instance_eval{remove_const :GRADING_RESULT_DIR}" >> config/environment.rb
86 echo "GRADER_ROOT_DIR = '$CAFE_PATH/judge'" >> config/environment.rb
85 echo "GRADER_ROOT_DIR = '$CAFE_PATH/judge'" >> config/environment.rb
87 echo "GRADING_RESULT_DIR = '$CAFE_PATH/judge/result'" >> config/environment.rb
86 echo "GRADING_RESULT_DIR = '$CAFE_PATH/judge/result'" >> config/environment.rb
88
87
89 echo "Installing required gems"
88 echo "Installing required gems"
90
89
91 sudo rake gems:install
90 sudo rake gems:install
92 # to remove log file owned by root
91 # to remove log file owned by root
93 sudo rm log/*
92 sudo rm log/*
94 sudo rmdir log
93 sudo rmdir log
95
94
96 echo "Running rake tasks to initialize database"
95 echo "Running rake tasks to initialize database"
97
96
98 rake db:migrate
97 rake db:migrate
99 rake db:seed
98 rake db:seed
100
99
101 echo "Intalling web interface complete..."
100 echo "Intalling web interface complete..."
102 echo
101 echo
103 echo "Fetching grader"
102 echo "Fetching grader"
104
103
105 cd ..
104 cd ..
106
105
107 mkdir judge
106 mkdir judge
108 cd judge
107 cd judge
109 - git clone http://git.gitorious.org/cafe-grader/cafe-grader-judge-scripts.git scripts
108 + git clone -q http://git.gitorious.org/cafe-grader/cafe-grader-judge-scripts.git scripts
110 mkdir raw
109 mkdir raw
111 mkdir ev-exam
110 mkdir ev-exam
112 mkdir ev
111 mkdir ev
113 mkdir result
112 mkdir result
114 mkdir log
113 mkdir log
115
114
116 echo "Configuring grader"
115 echo "Configuring grader"
117
116
118 cp scripts/config/env_exam.rb.SAMPLE scripts/config/env_exam.rb
117 cp scripts/config/env_exam.rb.SAMPLE scripts/config/env_exam.rb
119 cp scripts/config/env_grading.rb.SAMPLE scripts/config/env_grading.rb
118 cp scripts/config/env_grading.rb.SAMPLE scripts/config/env_grading.rb
120
119
121 # create new environment.rb file
120 # create new environment.rb file
122 echo "RAILS_ROOT = '$CAFE_PATH/web'" > scripts/config/environment.rb
121 echo "RAILS_ROOT = '$CAFE_PATH/web'" > scripts/config/environment.rb
123 echo "GRADER_ROOT = '$CAFE_PATH/judge/scripts'" >> scripts/config/environment.rb
122 echo "GRADER_ROOT = '$CAFE_PATH/judge/scripts'" >> scripts/config/environment.rb
124 echo "require File.join(File.dirname(__FILE__),'../lib/boot')" >> scripts/config/environment.rb
123 echo "require File.join(File.dirname(__FILE__),'../lib/boot')" >> scripts/config/environment.rb
125 echo "require File.dirname(__FILE__) + \"/env_#{GRADER_ENV}.rb\"" >> scripts/config/environment.rb
124 echo "require File.dirname(__FILE__) + \"/env_#{GRADER_ENV}.rb\"" >> scripts/config/environment.rb
126
125
127 cd ..
126 cd ..
128
127
129 echo "Installing web server mongrel"
128 echo "Installing web server mongrel"
130
129
131 sudo gem install mongrel --no-ri --no-rdoc
130 sudo gem install mongrel --no-ri --no-rdoc
132
131
133 echo "Now you are ready to run cafe grader...."
132 echo "Now you are ready to run cafe grader...."
134 echo
133 echo
135 echo "Try:"
134 echo "Try:"
136 echo
135 echo
137 echo " cd web"
136 echo " cd web"
138 echo " ./script/server"
137 echo " ./script/server"
139 echo
138 echo
140 echo "and access web at http://localhost:3000/"
139 echo "and access web at http://localhost:3000/"
141 echo "The root username is 'root', its password is 'ioionrails'."
140 echo "The root username is 'root', its password is 'ioionrails'."
142
141
You need to be logged in to leave comments. Login now