forked from saasbook/rag
-
Notifications
You must be signed in to change notification settings - Fork 0
/
grade3
executable file
·41 lines (36 loc) · 1.15 KB
/
grade3
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
#!/usr/bin/env ruby
require './lib/auto_grader'
require 'optparse'
require './lib/graders/feature_grader/hw3_grader.rb'
options = {:mt => true}
o = nil
OptionParser.new do |opts|
o = opts
opts.banner = "Usage: #{$0} [options] -a /path/to/app/ 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 }
opts.on('-m', '--[no-]multithread', 'Enable multithreading') {|v| options[:mt] = v}
end.parse!
unless options[:app] and 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('3', 'HW3Grader', ARGV[0], options)
g.grade!
rescue Object => e
STDERR.puts "*** FATAL: #{e.respond_to?(:message) ? e.message : "unspecified error"}"
exit 1
end
score_max = 500
puts "Score out of #{score_max}: #{g.normalized_score(score_max)}\n"
puts "---BEGIN cucumber comments---\n#{'-'*80}\n#{g.comments}\n#{'-'*80}\n---END cucumber comments---"
ensure
Dir::chdir d
end