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