Description:
fix import dir bug
git-svn-id: http://theory.cpe.ku.ac.th/grader/cli/trunk/scripts@14 6386c4cd-e34a-4fa8-8920-d93eb39b512e
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r2:f854d6ed3319 - - 3 files changed: 3 inserted, 3 deleted
@@ -1,6 +1,6 | |||
|
1 | 1 | |
|
2 | 2 | # Rails app directory |
|
3 | 3 | RAILS_APP_DIR = "/home/jittat/web_grader" |
|
4 | 4 | |
|
5 | 5 | # load the required environment file |
|
6 | - require "env_#{GRADER_ENV}.rb" | |
|
6 | + require File.dirname(__FILE__) + "/env_#{GRADER_ENV}.rb" |
@@ -77,25 +77,25 | |||
|
77 | 77 | source_name = "#{problem.name}.#{lang_ext}" |
|
78 | 78 | |
|
79 | 79 | save_source(sub,problem_out_dir,source_name) |
|
80 | 80 | call_judge(problem_home,language,problem_out_dir,source_name) |
|
81 | 81 | save_result(sub,read_result("#{problem_out_dir}/test-result")) |
|
82 | 82 | end |
|
83 | 83 | |
|
84 | 84 | # reading environment |
|
85 | 85 | GRADER_ENV = 'exam' |
|
86 | 86 | if ARGV.length > 1 |
|
87 | 87 | GRADER_ENV = ARGV[1] |
|
88 | 88 | end |
|
89 | - require "environment.rb" | |
|
89 | + require File.dirname(__FILE__) + "/environment.rb" | |
|
90 | 90 | |
|
91 | 91 | #main program |
|
92 | 92 | |
|
93 | 93 | talk 'Reading rails environment' |
|
94 | 94 | |
|
95 | 95 | RAILS_ENV = 'development' |
|
96 | 96 | require RAILS_APP_DIR + '/config/environment' |
|
97 | 97 | |
|
98 | 98 | current_dir = `pwd` |
|
99 | 99 | |
|
100 | 100 | talk 'Grader queue' |
|
101 | 101 | task = Task.find(:first, :order => 'created_at') |
@@ -26,25 +26,25 | |||
|
26 | 26 | if ARGV[i]=='-t' |
|
27 | 27 | options[:time_limit] = ARGV[i+1].to_i if ARGV.length>i+1 |
|
28 | 28 | i += 1 |
|
29 | 29 | end |
|
30 | 30 | if ARGV[i]=='-m' |
|
31 | 31 | options[:mem_limit] = ARGV[i+1].to_i if ARGV.length>i+1 |
|
32 | 32 | i += 1 |
|
33 | 33 | end |
|
34 | 34 | i += 1 |
|
35 | 35 | end |
|
36 | 36 | end |
|
37 | 37 | |
|
38 | - GRADER_DIR = "/home/jittat/grader/grader_ng" | |
|
38 | + GRADER_DIR = File.dirname(__FILE__) | |
|
39 | 39 | |
|
40 | 40 | # print usage |
|
41 | 41 | if ARGV.length < 3 |
|
42 | 42 | puts "using: import_task problem importing_testcase_dir number_of_testcase [options]" |
|
43 | 43 | exit(127) |
|
44 | 44 | end |
|
45 | 45 | |
|
46 | 46 | # processing arguments |
|
47 | 47 | problem = ARGV[0] |
|
48 | 48 | testcase_dir = ARGV[1] |
|
49 | 49 | num_testcases = ARGV[2].to_i |
|
50 | 50 |
You need to be logged in to leave comments.
Login now