A code autograder for student homework submissions
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

il y a 8 ans
il y a 8 ans
il y a 8 ans
il y a 8 ans
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. require_relative 'lib/kgrader'
  2. def die(error)
  3. abort "fatal: [#{error.class}] #{error}"
  4. end
  5. def run
  6. yield KGrader::CLI.new Rake.application.original_dir
  7. rescue KGrader::KGraderError => err
  8. die err
  9. end
  10. def parse_args(num, keywords = {})
  11. args, options = KGrader::parse_args ARGV.drop(1), num, keywords
  12. args.each { |arg| task arg.to_sym {} unless arg.nil? }
  13. args + [options]
  14. rescue KGrader::KGraderError => err
  15. die err
  16. end
  17. task :default => :help do ; end
  18. task :help do
  19. puts %{usage:
  20. - rake list [<course>] [<semester>]
  21. - rake roster <course> <rosterfile> [<semester>]
  22. - rake grade <course> <assignment> [semester=<...>] [students=<...>]
  23. [due=<...>] [fetch=<yes/no>] [regrade=<yes/no>]
  24. [superscore=<yes/no>]
  25. - rake commit <course> <assignment> [semester=<...>] [students=<...>]
  26. - rake clean
  27. - rake clobber}
  28. end
  29. task :list do
  30. course, semester = parse_args 0..2
  31. run { |cli| cli.list course, semester }
  32. end
  33. task :roster do
  34. course, rosterfile, semester = parse_args 2..3
  35. run { |cli| cli.roster course, semester, rosterfile }
  36. end
  37. task :grade do
  38. course, assignment, options = parse_args 2..2,
  39. { :semester => :string, :students => :array, :due => :time,
  40. :fetch => :bool, :regrade => :bool, :superscore => :bool }
  41. semester, students = options[:semester], options[:students]
  42. run { |cli| cli.grade course, semester, assignment, students, options }
  43. end
  44. task :commit do
  45. course, assignment, options = parse_args 2..2,
  46. { :semester => :string, :students => :array }
  47. semester, students = options[:semester], options[:students]
  48. run { |cli| cli.commit course, semester, assignment, students }
  49. end
  50. task :clean do
  51. run { |cli| cli.clean }
  52. end
  53. task :clobber do
  54. run { |cli| cli.clobber }
  55. end