Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 43 lines (37 sloc) 1.06 KB
#!/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