untra / polyglot

:abc: Multilingual and i18n support tool for Jekyll Blogs
https://polyglot.untra.io
MIT License
417 stars 60 forks source link

Crash when using jekyll doctor #184

Closed hacketiwack closed 1 year ago

hacketiwack commented 1 year ago

Current situation When using the command jekyll doctor on a Jekyll instance with the polyglot plugin, the process crashes and the following error is displayed:

Configuration file: <redacted>/_config.yml
jekyll 4.3.2 | Error:  undefined method `each' for nil:NilClass
/opt/homebrew/lib/ruby/gems/3.2.0/gems/jekyll-polyglot-1.6.0/lib/jekyll/polyglot/patches/jekyll/site.rb:171:in `document_url_regex': undefined method `each' for nil:NilClass (NoMethodError)

      @languages.each do |lang|
                ^^^^^
        from /opt/homebrew/lib/ruby/gems/3.2.0/gems/jekyll-polyglot-1.6.0/lib/jekyll/polyglot/patches/jekyll/site.rb:127:in `coordinate_documents'
        from /opt/homebrew/lib/ruby/gems/3.2.0/gems/jekyll-polyglot-1.6.0/lib/jekyll/polyglot/hooks/coordinate.rb:20:in `block in hook_coordinate'
        from /opt/homebrew/lib/ruby/gems/3.2.0/gems/jekyll-polyglot-1.6.0/lib/jekyll/polyglot/hooks/coordinate.rb:19:in `each'
        from /opt/homebrew/lib/ruby/gems/3.2.0/gems/jekyll-polyglot-1.6.0/lib/jekyll/polyglot/hooks/coordinate.rb:19:in `hook_coordinate'
        from /opt/homebrew/lib/ruby/gems/3.2.0/gems/jekyll-polyglot-1.6.0/lib/jekyll/polyglot/hooks/coordinate.rb:4:in `block in <top (required)>'
        from /opt/homebrew/lib/ruby/gems/3.2.0/gems/jekyll-4.3.2/lib/jekyll/hooks.rb:103:in `block in trigger'
        from /opt/homebrew/lib/ruby/gems/3.2.0/gems/jekyll-4.3.2/lib/jekyll/hooks.rb:102:in `each'
        from /opt/homebrew/lib/ruby/gems/3.2.0/gems/jekyll-4.3.2/lib/jekyll/hooks.rb:102:in `trigger'
        from /opt/homebrew/lib/ruby/gems/3.2.0/gems/jekyll-4.3.2/lib/jekyll/site.rb:183:in `read'
        from /opt/homebrew/lib/ruby/gems/3.2.0/gems/jekyll-4.3.2/lib/jekyll/commands/doctor.rb:25:in `process'
        from /opt/homebrew/lib/ruby/gems/3.2.0/gems/jekyll-4.3.2/lib/jekyll/commands/doctor.rb:17:in `block (2 levels) in init_with_program'
        from /opt/homebrew/lib/ruby/gems/3.2.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `block in execute'
        from /opt/homebrew/lib/ruby/gems/3.2.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `each'
        from /opt/homebrew/lib/ruby/gems/3.2.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `execute'
        from /opt/homebrew/lib/ruby/gems/3.2.0/gems/mercenary-0.4.0/lib/mercenary/program.rb:44:in `go'
        from /opt/homebrew/lib/ruby/gems/3.2.0/gems/mercenary-0.4.0/lib/mercenary.rb:21:in `program'
        from /opt/homebrew/lib/ruby/gems/3.2.0/gems/jekyll-4.3.2/exe/jekyll:15:in `<top (required)>'
        from /opt/homebrew/lib/ruby/gems/3.2.0/bin/jekyll:25:in `load'
        from /opt/homebrew/lib/ruby/gems/3.2.0/bin/jekyll:25:in `<top (required)>'
        from /opt/homebrew/lib/ruby/gems/3.2.0/gems/bundler-2.4.21/lib/bundler/cli/exec.rb:58:in `load'
        from /opt/homebrew/lib/ruby/gems/3.2.0/gems/bundler-2.4.21/lib/bundler/cli/exec.rb:58:in `kernel_load'
        from /opt/homebrew/lib/ruby/gems/3.2.0/gems/bundler-2.4.21/lib/bundler/cli/exec.rb:23:in `run'
        from /opt/homebrew/lib/ruby/gems/3.2.0/gems/bundler-2.4.21/lib/bundler/cli.rb:492:in `exec'
        from /opt/homebrew/lib/ruby/gems/3.2.0/gems/bundler-2.4.21/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
        from /opt/homebrew/lib/ruby/gems/3.2.0/gems/bundler-2.4.21/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
        from /opt/homebrew/lib/ruby/gems/3.2.0/gems/bundler-2.4.21/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
        from /opt/homebrew/lib/ruby/gems/3.2.0/gems/bundler-2.4.21/lib/bundler/cli.rb:34:in `dispatch'
        from /opt/homebrew/lib/ruby/gems/3.2.0/gems/bundler-2.4.21/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
        from /opt/homebrew/lib/ruby/gems/3.2.0/gems/bundler-2.4.21/lib/bundler/cli.rb:28:in `start'
        from /opt/homebrew/lib/ruby/gems/3.2.0/gems/bundler-2.4.21/exe/bundle:37:in `block in <top (required)>'
        from /opt/homebrew/lib/ruby/gems/3.2.0/gems/bundler-2.4.21/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors'
        from /opt/homebrew/lib/ruby/gems/3.2.0/gems/bundler-2.4.21/exe/bundle:29:in `<top (required)>'
        from /opt/homebrew/opt/ruby/bin/bundle:25:in `load'
        from /opt/homebrew/opt/ruby/bin/bundle:25:in `<main>'
untra commented 1 year ago

This bug should be addressed in jekyll-polyglot 1.7.0 . Please let me know if this is still a problem 👍

hacketiwack commented 1 year ago

I just tested it right now. From my point of view, the issue has been fixed. Thanks a lot.