A code autograder for student homework submissions
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
625 B

  1. require 'yaml'
  2. module KGrader
  3. class Filesystem
  4. def initialize(root)
  5. @root = root
  6. end
  7. def course(name)
  8. File.join @root, 'spec', name
  9. end
  10. def course_config(name)
  11. File.join course(name), '_config.yml'
  12. end
  13. def courses
  14. Dir[File.join @root, 'spec', '*', ''].each { |fn| File.basename fn }
  15. end
  16. def desk
  17. File.join @root, 'desk'
  18. end
  19. def jail
  20. File.join @root, 'jail'
  21. end
  22. def load(path)
  23. case File.extname path
  24. when '.yml', '.yaml'
  25. YAML.load File.read(path)
  26. when '.csv'
  27. # TODO
  28. end
  29. end
  30. end
  31. end