forked from saasbook/rag
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgrade4
executable file
·42 lines (37 loc) · 1.06 KB
/
grade4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/env ruby
require './lib/auto_grader'
require 'optparse'
#load 'lib/graders/feature_grader.rb'
options = {}
o = nil
OptionParser.new do |opts|
o = opts
opts.banner = "Usage: #{$0} [options] input.tar.gz description.yml"
#opts.on('-a', '--app PATH', 'Path to app') {|p| options[:app] = p}
opts.on('-h', '--help', 'Display this screen') { puts opts; exit }
end.parse!
#unless options[:app] and ARGV.count == 2
unless ARGV.count == 2
puts o
exit 1
end
d = Dir::getwd
begin
ARGV.collect! {|p| File.expand_path p}
#Dir::chdir options.delete(:app)
#ENV["RAILS_ROOT"] = Dir::getwd
options[:description] = ARGV[1]
begin
g = AutoGrader.create('4', 'HW4Grader', ARGV[0], options)
g.grade!
rescue Object => e
STDERR.puts "*** FATAL: #{e.respond_to?(:message) ? e.message : "unspecified error"}"
puts e.backtrace
exit 1
end
score_max = 500
puts "Score out of #{score_max}: #{g.normalized_score(score_max)}\n"
puts "---BEGIN grader comments---\n#{'-'*80}\n#{g.comments}\n#{'-'*80}\n---END grader comments---"
ensure
Dir::chdir d
end