尝试使用 Ruby 'canvas_cc' gem 创建 .imscc 墨盒,但遇到了我难以解决的问题。我遵循了自述文件中的基本文档,但我从 gem 中得到了一个问题。
红宝石
require 'tmpdir'
course = CanvasCc::CanvasCC::Models::Course.new
course.identifier = "cc"
course.title = "testing cc"
dir = Dir.mktmpdir
output_dir = CanvasCc::CanvasCC::CartridgeCreator.new(course).create(dir)
输出
Traceback (most recent call last):
5: from course_creation.rb:25:in `<main>'
4: from /Users/me/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/canvas_cc-0.0.43/lib/canvas_cc/canvas_cc/cartridge_creator.rb:18:in `create'
3: from /Users/me/.rbenv/versions/2.5.1/lib/ruby/2.5.0/tmpdir.rb:89:in `mktmpdir'
2: from /Users/me/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/canvas_cc-0.0.43/lib/canvas_cc/canvas_cc/cartridge_creator.rb:19:in `block in create'
1: from /Users/me/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/canvas_cc-0.0.43/lib/canvas_cc/canvas_cc/cartridge_creator.rb:45:in `write_cartridge'
/Users/me/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/canvas_cc-0.0.43/lib/canvas_cc/canvas_cc/grading_standard_writer.rb:11:in `write': undefined method `empty?' for nil:NilClass (NoMethodError)
也试过
require 'canvas_cc'
course = CanvasCc::CanvasCC::Models::Course.new
course.identifier = "cc"
course.title = "testing cc"
dir = Dir.mkdir "cartridge"
output_dir = CanvasCc::CanvasCC::CartridgeCreator.new(course).create(Dir.pwd + "/cartridge")
我在运行第二个脚本时遇到了与第一个脚本相同的错误。
我试图通过查看文档和 gem 中的代码来了解问题所在,但我似乎无法调试它。我将 Ruby 2.5.1 与 rbenv 一起使用,但我尝试了多个其他 ruby 版本,但存在相同的问题。
我的目标是用这个 gem 创建基本的通用墨盒,但我什至做不到。任何帮助将不胜感激!