Description:
removed calls to 'pwd', other uses of back quotes
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r102:a3aedb7e3776 - - 4 files changed: 7 inserted, 5 deleted
@@ -1,5 +1,7 | |||||
|
1 | #!/usr/bin/ruby |
|
1 | #!/usr/bin/ruby |
|
2 |
|
2 | ||
|
|
3 | + require 'fileutils' | ||
|
|
4 | + | ||
|
3 | def talk(str) |
|
5 | def talk(str) |
|
4 | if TALKATIVE |
|
6 | if TALKATIVE |
|
5 | puts str |
|
7 | puts str |
@@ -85,5 +87,5 | |||||
|
85 | RAILS_ENV = 'development' |
|
87 | RAILS_ENV = 'development' |
|
86 | require RAILS_APP_DIR + '/config/environment' |
|
88 | require RAILS_APP_DIR + '/config/environment' |
|
87 |
|
89 | ||
|
88 |
- current_dir = |
|
90 | + current_dir = FileUtils.pwd |
|
89 | grade(ARGV[0].to_i) |
|
91 | grade(ARGV[0].to_i) |
@@ -31,7 +31,7 | |||||
|
31 | # takes a submission, asks room_maker to produce grading directories, |
|
31 | # takes a submission, asks room_maker to produce grading directories, |
|
32 | # calls grader scripts, and asks reporter to save the result |
|
32 | # calls grader scripts, and asks reporter to save the result |
|
33 | def grade(submission) |
|
33 | def grade(submission) |
|
34 |
- current_dir = |
|
34 | + current_dir = FileUtils.pwd |
|
35 |
|
35 | ||
|
36 | user = submission.user |
|
36 | user = submission.user |
|
37 | problem = submission.problem |
|
37 | problem = submission.problem |
@@ -66,7 +66,7 | |||||
|
66 |
|
66 | ||
|
67 | log "Making test result and sandbox directories..." |
|
67 | log "Making test result and sandbox directories..." |
|
68 |
|
68 | ||
|
69 |
- current_dir = |
|
69 | + current_dir = FileUtils.pwd |
|
70 | current_dir.strip! |
|
70 | current_dir.strip! |
|
71 |
|
71 | ||
|
72 | if ARGV.length >= 3 |
|
72 | if ARGV.length >= 3 |
@@ -99,7 +99,7 | |||||
|
99 | exit(127) |
|
99 | exit(127) |
|
100 | end |
|
100 | end |
|
101 | execute("#{problem_home}/script/compile #{language} #{source_file}", "Compilation error!") |
|
101 | execute("#{problem_home}/script/compile #{language} #{source_file}", "Compilation error!") |
|
102 |
- compile_message = |
|
102 | + compile_message = open("compiler_message").read |
|
103 | compile_message.strip! |
|
103 | compile_message.strip! |
|
104 | call_and_log("Cannot move the compiler message to #{test_result_dir}.") { |
|
104 | call_and_log("Cannot move the compiler message to #{test_result_dir}.") { |
|
105 | FileUtils.mv("compiler_message", test_result_dir) |
|
105 | FileUtils.mv("compiler_message", test_result_dir) |
@@ -111,7 +111,7 | |||||
|
111 | result_file.write run_stat.strip |
|
111 | result_file.write run_stat.strip |
|
112 | result_file.write "\n" |
|
112 | result_file.write "\n" |
|
113 | result_file.close |
|
113 | result_file.close |
|
114 |
- |
|
114 | + FileUtils.rm "run_result" |
|
115 | # `rm output.txt` --- keep the output |
|
115 | # `rm output.txt` --- keep the output |
|
116 |
|
116 | ||
|
117 | comment_file.write comment |
|
117 | comment_file.write comment |
You need to be logged in to leave comments.
Login now