Description:
removed 'system' from grader, grader_id, import_problem
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r99:f439789e790b - - 3 files changed: 14 inserted, 32 deleted
@@ -15,7 +15,7 | |||||
|
15 |
|
15 | ||
|
16 | def clear_stopfile |
|
16 | def clear_stopfile |
|
17 | if FileTest.exist?(File.dirname(__FILE__) + "/stop.#{Process.pid}") |
|
17 | if FileTest.exist?(File.dirname(__FILE__) + "/stop.#{Process.pid}") |
|
18 |
- |
|
18 | + File.delete(File.dirname(__FILE__) + "/stop.#{Process.pid}") |
|
19 | end |
|
19 | end |
|
20 | end |
|
20 | end |
|
21 |
|
21 |
@@ -6,13 +6,6 | |||||
|
6 | end |
|
6 | end |
|
7 | end |
|
7 | end |
|
8 |
|
8 | ||
|
9 | - def execute(command, error_message="") |
|
||
|
10 | - if not system(command) |
|
||
|
11 | - puts "ERROR: #{error_message}" |
|
||
|
12 | - exit(127) |
|
||
|
13 | - end |
|
||
|
14 | - end |
|
||
|
15 | - |
|
||
|
16 | def save_source(submission,dir,fname) |
|
9 | def save_source(submission,dir,fname) |
|
17 | f = File.open("#{dir}/#{fname}","w") |
|
10 | f = File.open("#{dir}/#{fname}","w") |
|
18 | f.write(submission.source) |
|
11 | f.write(submission.source) |
@@ -81,18 +74,6 | |||||
|
81 | save_result(sub,read_result("#{problem_out_dir}/test-result")) |
|
74 | save_result(sub,read_result("#{problem_out_dir}/test-result")) |
|
82 | end |
|
75 | end |
|
83 |
|
76 | ||
|
84 | - def stop_grader |
|
||
|
85 | - File.open(File.dirname(__FILE__) + '/stop','w') |
|
||
|
86 | - end |
|
||
|
87 | - |
|
||
|
88 | - def check_stopfile |
|
||
|
89 | - FileTest.exist?(File.dirname(__FILE__) + '/stop') |
|
||
|
90 | - end |
|
||
|
91 | - |
|
||
|
92 | - def clear_stopfile |
|
||
|
93 | - system("rm " + File.dirname(__FILE__) + '/stop') |
|
||
|
94 | - end |
|
||
|
95 | - |
|
||
|
96 | # reading environment and options |
|
77 | # reading environment and options |
|
97 | GRADER_ENV = 'exam' |
|
78 | GRADER_ENV = 'exam' |
|
98 | puts "environment: #{GRADER_ENV}" |
|
79 | puts "environment: #{GRADER_ENV}" |
@@ -106,5 +87,3 | |||||
|
106 |
|
87 | ||
|
107 | current_dir = `pwd` |
|
88 | current_dir = `pwd` |
|
108 | grade(ARGV[0].to_i) |
|
89 | grade(ARGV[0].to_i) |
|
109 | - |
|
||
|
110 | - |
|
@@ -1,6 +1,7 | |||||
|
1 | #!/usr/bin/ruby |
|
1 | #!/usr/bin/ruby |
|
2 |
|
2 | ||
|
3 | require 'erb' |
|
3 | require 'erb' |
|
|
4 | + require 'ftools' | ||
|
4 | require 'fileutils' |
|
5 | require 'fileutils' |
|
5 | require File.join(File.dirname(__FILE__),'lib/import_helper') |
|
6 | require File.join(File.dirname(__FILE__),'lib/import_helper') |
|
6 |
|
7 | ||
@@ -32,8 +33,8 | |||||
|
32 | end |
|
33 | end |
|
33 |
|
34 | ||
|
34 | def copy_testcase(importing_test_dir,fname,dir,i) |
|
35 | def copy_testcase(importing_test_dir,fname,dir,i) |
|
35 |
- |
|
36 | + File.copy("#{importing_test_dir}/#{fname}.in", "#{input_filename(dir,i)}") |
|
36 |
- |
|
37 | + File.copy("#{importing_test_dir}/#{fname}.sol", "#{answer_filename(dir,i)}") |
|
37 | end |
|
38 | end |
|
38 |
|
39 | ||
|
39 | def process_options(options) |
|
40 | def process_options(options) |
@@ -113,9 +114,9 | |||||
|
113 | # start working |
|
114 | # start working |
|
114 | puts "creating directories" |
|
115 | puts "creating directories" |
|
115 |
|
116 | ||
|
116 |
- |
|
117 | + File.makedirs("#{problem_dir}") |
|
117 |
- |
|
118 | + File.makedirs("#{problem_dir}/script") |
|
118 |
- |
|
119 | + File.makedirs("#{problem_dir}/test_cases") |
|
119 |
|
120 | ||
|
120 | puts "copying testcases" |
|
121 | puts "copying testcases" |
|
121 |
|
122 | ||
@@ -132,7 +133,7 | |||||
|
132 |
|
133 | ||
|
133 | puts "copy #{testcase_fname} to #{testcase_num}" |
|
134 | puts "copy #{testcase_fname} to #{testcase_num}" |
|
134 |
|
135 | ||
|
135 |
- |
|
136 | + File.makedirs("#{problem_dir}/test_cases/#{testcase_num}") |
|
136 | copy_testcase("#{testcase_dir}",testcase_fname,"#{problem_dir}/test_cases/#{testcase_num}",testcase_num) |
|
137 | copy_testcase("#{testcase_dir}",testcase_fname,"#{problem_dir}/test_cases/#{testcase_num}",testcase_num) |
|
137 |
|
138 | ||
|
138 | num_testcases += 1 |
|
139 | num_testcases += 1 |
@@ -163,14 +164,14 | |||||
|
163 |
|
164 | ||
|
164 | File.chmod(0755,"#{problem_dir}/script/check") |
|
165 | File.chmod(0755,"#{problem_dir}/script/check") |
|
165 |
|
166 | ||
|
166 |
- |
|
167 | + File.copy("#{check_script_fname}", "#{problem_dir}/script/#{script_name}") |
|
167 | else |
|
168 | else |
|
168 | if File.exists?(SCRIPT_DIR + "/templates/check.#{check_script}") |
|
169 | if File.exists?(SCRIPT_DIR + "/templates/check.#{check_script}") |
|
169 | check_script_fname = SCRIPT_DIR + "/templates/check.#{check_script}" |
|
170 | check_script_fname = SCRIPT_DIR + "/templates/check.#{check_script}" |
|
170 | else |
|
171 | else |
|
171 | check_script_fname = check_script |
|
172 | check_script_fname = check_script |
|
172 | end |
|
173 | end |
|
173 |
- |
|
174 | + File.copy("#{check_script_fname}", "#{problem_dir}/script/check") |
|
174 | end |
|
175 | end |
|
175 |
|
176 | ||
|
176 | # generating test_request directory |
|
177 | # generating test_request directory |
@@ -185,8 +186,10 | |||||
|
185 | cfg_file.puts test_request_all_test_cfg.result |
|
186 | cfg_file.puts test_request_all_test_cfg.result |
|
186 | cfg_file.close |
|
187 | cfg_file.close |
|
187 |
|
188 | ||
|
188 | - system("cp #{SCRIPT_DIR}/templates/check_empty #{ev_dir}/test_request/#{problem}/script/check") |
|
189 | + File.copy("#{SCRIPT_DIR}/templates/check_empty", |
|
189 | - system("cp #{SCRIPT_DIR}/templates/answer-1.txt #{ev_dir}/test_request/#{problem}/test_cases/1") |
|
190 | + "#{ev_dir}/test_request/#{problem}/script/check") |
|
|
191 | + File.copy("#{SCRIPT_DIR}/templates/answer-1.txt", | ||
|
|
192 | + "#{ev_dir}/test_request/#{problem}/test_cases/1") | ||
|
190 |
|
193 | ||
|
191 | puts "done" |
|
194 | puts "done" |
|
192 | end |
|
195 | end |
You need to be logged in to leave comments.
Login now