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

r88:692a33c93a20 - - 1 file changed: 3 inserted, 1 deleted

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