结合jekyll-redirect-from和github-metadata gems抛出错误

时间:2015-12-05 02:06:52

标签: ruby gem jekyll github-pages

我正在使用Jekyll网站,该网站使用jekyll-redirect-from将旧网页网址重定向到其新版本的网址。它正常构建正常,但是当我将GitHub-metadata gem添加到我的gemfile并尝试构建我的站点时,我得到了一个相当无用的消息:

> bundle exec jekyll build --trace
Configuration file: <site folder>/_config.yml
            Source: <site folder>
       Destination: <site folder>/_site
      Generating...
d:/tools/Ruby21-x64/lib/ruby/gems/2.1.0/gems/jekyll-redirect-from-0.8.0/lib/jekyll-redirect-from/redirector.rb:67:in `join': no implicit conversion of Jekyll::GitHubMetadata::Value into String (TypeError)
        from d:/tools/Ruby21-x64/lib/ruby/gems/2.1.0/gems/jekyll-redirect-from-0.8.0/lib/jekyll-redirect-from/redirector.rb:67:in `redirect_url'
        from d:/tools/Ruby21-x64/lib/ruby/gems/2.1.0/gems/jekyll-redirect-from-0.8.0/lib/jekyll-redirect-from/redirector.rb:19:in `block (2 levels) in generate_alt_urls'
        from d:/tools/Ruby21-x64/lib/ruby/gems/2.1.0/gems/jekyll-redirect-from-0.8.0/lib/jekyll-redirect-from/redirector.rb:15:in `each'
        from d:/tools/Ruby21-x64/lib/ruby/gems/2.1.0/gems/jekyll-redirect-from-0.8.0/lib/jekyll-redirect-from/redirector.rb:15:in `block in generate_alt_urls'
        from d:/tools/Ruby21-x64/lib/ruby/gems/2.1.0/gems/jekyll-redirect-from-0.8.0/lib/jekyll-redirect-from/redirector.rb:13:in `each'
        from d:/tools/Ruby21-x64/lib/ruby/gems/2.1.0/gems/jekyll-redirect-from-0.8.0/lib/jekyll-redirect-from/redirector.rb:13:in `generate_alt_urls'
        from d:/tools/Ruby21-x64/lib/ruby/gems/2.1.0/gems/jekyll-redirect-from-0.8.0/lib/jekyll-redirect-from/redirector.rb:8:in `generate'
        from d:/tools/Ruby21-x64/lib/ruby/gems/2.1.0/gems/jekyll-2.4.0/lib/jekyll/site.rb:251:in `block in generate'
        from d:/tools/Ruby21-x64/lib/ruby/gems/2.1.0/gems/jekyll-2.4.0/lib/jekyll/site.rb:250:in `each'
        from d:/tools/Ruby21-x64/lib/ruby/gems/2.1.0/gems/jekyll-2.4.0/lib/jekyll/site.rb:250:in `generate'
        from d:/tools/Ruby21-x64/lib/ruby/gems/2.1.0/gems/jekyll-2.4.0/lib/jekyll/site.rb:45:in `process'
        from d:/tools/Ruby21-x64/lib/ruby/gems/2.1.0/gems/jekyll-2.4.0/lib/jekyll/command.rb:28:in `process_site'
        from d:/tools/Ruby21-x64/lib/ruby/gems/2.1.0/gems/jekyll-2.4.0/lib/jekyll/commands/build.rb:55:in `build'
        from d:/tools/Ruby21-x64/lib/ruby/gems/2.1.0/gems/jekyll-2.4.0/lib/jekyll/commands/build.rb:33:in `process'
        from d:/tools/Ruby21-x64/lib/ruby/gems/2.1.0/gems/jekyll-2.4.0/lib/jekyll/commands/build.rb:17:in `block (2 levels) in init_with_program'
        from d:/tools/Ruby21-x64/lib/ruby/gems/2.1.0/gems/mercenary-0.3.5/lib/mercenary/command.rb:220:in `call'
        from d:/tools/Ruby21-x64/lib/ruby/gems/2.1.0/gems/mercenary-0.3.5/lib/mercenary/command.rb:220:in `block in execute'
        from d:/tools/Ruby21-x64/lib/ruby/gems/2.1.0/gems/mercenary-0.3.5/lib/mercenary/command.rb:220:in `each'
        from d:/tools/Ruby21-x64/lib/ruby/gems/2.1.0/gems/mercenary-0.3.5/lib/mercenary/command.rb:220:in `execute'
        from d:/tools/Ruby21-x64/lib/ruby/gems/2.1.0/gems/mercenary-0.3.5/lib/mercenary/program.rb:42:in `go'
        from d:/tools/Ruby21-x64/lib/ruby/gems/2.1.0/gems/mercenary-0.3.5/lib/mercenary.rb:19:in `program'
        from d:/tools/Ruby21-x64/lib/ruby/gems/2.1.0/gems/jekyll-2.4.0/bin/jekyll:18:in `<top (required)>'
        from d:/tools/Ruby21-x64/bin/jekyll:23:in `load'
        from d:/tools/Ruby21-x64/bin/jekyll:23:in `<main>'

重要的部分是no implicit conversion of Jekyll::GitHubMetadata::Value into String (TypeError)部分。似乎某个地方的元数据宝石正在放置一个自定义对象,其中重定向gem期望有一个字符串,因此它会爆炸。

如果删除所有引用site.github.*的内容的实例,则仍会出现错误。但是,如果我删除所有redirect_from,则错误消失并成功构建。我对Ruby或其中任何一个宝石都不太了解,无法对此进行大量的故障排除。 Jekyll-redirect-from gem中的罪魁祸首是redirector.rb的罪魁祸首。

我在this line有一个repro网站(非常宽松的定义&#34;网站&#34;)。它会在Windows和新的Ubuntu VM上抛出上述错误。

问题可能是什么?是否有必须在其中一个宝石中修复的东西?

P.S。由于这个问题,我发现了一个用于GitHub的建议回购名称。谢谢。

1 个答案:

答案 0 :(得分:0)

我提交了一份错误报告,他们确认这是一个错误。我把它修好了PR