在成功升级到Ruby 2.0.0的稳定发行版之后(是的!),我决定继续使用我的Koans 启蒙道路。但是,像往常一样,在koans文件夹中运行rake
命令时,出现此错误:
rake
cd koans
/Users/jordanthornquest/.rvm/rubies/ruby-2.0.0-p0/bin/ruby path_to_enlightenment.rb
/Users/jordanthornquest/programming/ruby-koans/koans/edgecase.rb:399:in `rescue in meditate': uninitialized constant EdgeCase::Sensei::AssertionError (NameError)
from /Users/jordanthornquest/programming/ruby-koans/koans/edgecase.rb:407:in `meditate'
from /Users/jordanthornquest/programming/ruby-koans/koans/edgecase.rb:470:in `block in walk'
from /Users/jordanthornquest/programming/ruby-koans/koans/edgecase.rb:481:in `block (3 levels) in each_step'
from /Users/jordanthornquest/programming/ruby-koans/koans/edgecase.rb:479:in `each'
from /Users/jordanthornquest/programming/ruby-koans/koans/edgecase.rb:479:in `block (2 levels) in each_step'
from /Users/jordanthornquest/programming/ruby-koans/koans/edgecase.rb:478:in `each'
from /Users/jordanthornquest/programming/ruby-koans/koans/edgecase.rb:478:in `each_with_index'
from /Users/jordanthornquest/programming/ruby-koans/koans/edgecase.rb:478:in `block in each_step'
from /Users/jordanthornquest/programming/ruby-koans/koans/edgecase.rb:476:in `catch'
from /Users/jordanthornquest/programming/ruby-koans/koans/edgecase.rb:476:in `each_step'
from /Users/jordanthornquest/programming/ruby-koans/koans/edgecase.rb:469:in `walk'
from /Users/jordanthornquest/programming/ruby-koans/koans/edgecase.rb:491:in `block in <top (required)>'
rake aborted!
Command failed with status (1): [/Users/jordanthornquest/.rvm/rubies/ruby-2...]
/Users/jordanthornquest/programming/ruby-koans/Rakefile:90:in `block in <top (required)>'
/Users/jordanthornquest/.rvm/gems/ruby-2.0.0-p0/bin/ruby_noexec_wrapper:14:in `eval'
/Users/jordanthornquest/.rvm/gems/ruby-2.0.0-p0/bin/ruby_noexec_wrapper:14:in `<main>'
Tasks: TOP => default => walk_the_path
今天,我还从GitHub安装了新的Koans批处理,以确保这不是我的问题。都没有为我工作!它在1.9.3下仍然运行良好。可能值得注意的是,我还通过RVM安装了Ruby 2.0。在执行此操作之前,请确保已更新到最新的RVM。
似乎是什么问题?
最佳答案
有一个拉取请求可以解决此问题,但尚未被接受:https://github.com/neo/ruby_koans/pull/84
现在,您可以将src/edgecase.rb
的第149行编辑为:
in_ruby_version("1.9", "2.0") do
关于Ruby Koans与Ruby 2.0.0不兼容吗?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/15143040/