Description:
- new install script - add comment in grader chain
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r254:8d92eda43960 - - 3 files changed: 27 inserted, 20 deleted

@@ -1,25 +1,10
1 #!/bin/sh
1 #!/bin/sh
2
2
3 + #installation script for cafe-grader, for ubuntu 16.04
4 +
3 echo "This script will install and configure Cafe grader."
5 echo "This script will install and configure Cafe grader."
4
6
5 - RUBY_VERSION=2.1.2
7 + RUBY_VERSION=2.3.7
6 - echo "This will install Ruby $RUBY_VERSION under RVM"
7 -
8 - echo "Installing required apts"
9 -
10 - sudo apt-get update
11 - sudo apt-get install mysql-server mysql-client \
12 - g++ gcc apache2 libmysqlclient20 build-essential \
13 - git-core openssl libreadline6 libreadline6-dev \
14 - zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev \
15 - sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev \
16 - ncurses-dev automake libtool bison subversion \
17 - pkg-config curl nodejs unzip pyflakes ruby default-jdk \
18 - libmysqld-dev mercurial python-setuptools python-dev python3-numpy
19 -
20 - echo "Installing RVM"
21 - curl -k -L https://get.rvm.io | bash -s stable
22 - source ~/.rvm/scripts/rvm
23
8
24 echo "Installing Ruby $RUBY_VERSION in RVM"
9 echo "Installing Ruby $RUBY_VERSION in RVM"
25
10
@@ -32,7 +17,7
32
17
33 mkdir cafe_grader
18 mkdir cafe_grader
34 cd cafe_grader
19 cd cafe_grader
35 - git clone -q git://github.com/jittat/cafe-grader-web.git web
20 + git clone -q git://github.com/cafe-grader-team/cafe-grader-web.git web
36
21
37 echo "Configuring rails app"
22 echo "Configuring rails app"
38
23
@@ -132,6 +117,17
132
117
133 rake assets:precompile
118 rake assets:precompile
134
119
120 + echo "setup the secret file"
121 + SECRET_A=`rake secret`
122 + SECRET_B=`rake secret`
123 + SECRET_C=`rake secret`
124 + echo "development:" > config/secrets.yml
125 + echo " secret_key_base: '$SECRET_A'" >> config/secrets.yml
126 + echo "test:" >> config/secrets.yml
127 + echo " secret_key_base: '$SECRET_B'" >> config/secrets.yml
128 + echo "production:" >> config/secrets.yml
129 + echo " secret_key_base: '$SECRET_C'" >> config/secrets.yml
130 +
135 echo "Intalling web interface complete..."
131 echo "Intalling web interface complete..."
136 echo
132 echo
137 echo "Fetching grader"
133 echo "Fetching grader"
@@ -140,7 +136,7
140
136
141 mkdir judge
137 mkdir judge
142 cd judge
138 cd judge
143 - git clone -q git://github.com/jittat/cafe-grader-judge-scripts.git scripts
139 + git clone -q git://github.com/cafe-grader-team/cafe-grader-judge-scripts.git scripts
144 mkdir raw
140 mkdir raw
145 mkdir ev-exam
141 mkdir ev-exam
146 mkdir ev
142 mkdir ev
@@ -77,8 +77,10
77 raise "engine: No test data."
77 raise "engine: No test data."
78 end
78 end
79
79
80 + # copy the source script, using lock
80 dinit = DirInit::Manager.new(problem_home)
81 dinit = DirInit::Manager.new(problem_home)
81
82
83 + # lock the directory and copy the scripts
82 dinit.setup do
84 dinit.setup do
83 copy_log = copy_script(problem_home)
85 copy_log = copy_script(problem_home)
84 save_copy_log(problem_home,copy_log)
86 save_copy_log(problem_home,copy_log)
@@ -88,6 +90,7
88
90
89 @reporter.report(submission,"#{grading_dir}/test-result")
91 @reporter.report(submission,"#{grading_dir}/test-result")
90
92
93 + # unlock the directory
91 dinit.teardown do
94 dinit.teardown do
92 copy_log = load_copy_log(problem_home)
95 copy_log = load_copy_log(problem_home)
93 clear_copy_log(problem_home)
96 clear_copy_log(problem_home)
@@ -112,6 +115,8
112 end
115 end
113 end
116 end
114
117
118 + #change directory to problem_home
119 + #call the "judge" script
115 def call_judge(problem_home,language,grading_dir,fname)
120 def call_judge(problem_home,language,grading_dir,fname)
116 ENV['PROBLEM_HOME'] = problem_home
121 ENV['PROBLEM_HOME'] = problem_home
117 ENV['RUBYOPT'] = ''
122 ENV['RUBYOPT'] = ''
@@ -129,6 +134,9
129 GRADER_ROOT + '/std-script'
134 GRADER_ROOT + '/std-script'
130 end
135 end
131
136
137 + #copy any script presented in std-script directory that is not in the problem_home
138 + #this allow a problem setter to provide their own version for each script
139 + #in case that they want to hack something
132 def copy_script(problem_home)
140 def copy_script(problem_home)
133 script_dir = "#{problem_home}/script"
141 script_dir = "#{problem_home}/script"
134 std_script_dir = get_std_script_dir
142 std_script_dir = get_std_script_dir
@@ -24,6 +24,9
24 return task
24 return task
25 end
25 end
26
26
27 + # grade a specified problem for the latest submission of each user
28 + # optionally, on all submission when options[:all_sub] is set
29 + # optionally, only submission that has error (use when the problem itself has some problem)
27 def grade_problem(problem, options={})
30 def grade_problem(problem, options={})
28 user_index = 0
31 user_index = 0
29 user_count = User.count
32 user_count = User.count
You need to be logged in to leave comments. Login now