Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom theme path expansion crashes w/Ruby 2.4 #752

Closed
friedbunny opened this issue Feb 22, 2017 · 1 comment
Closed

Custom theme path expansion crashes w/Ruby 2.4 #752

friedbunny opened this issue Feb 22, 2017 · 1 comment
Assignees

Comments

@friedbunny
Copy link
Collaborator

friedbunny commented Feb 22, 2017

Using a custom theme with jazzy v0.7.4 and Ruby v2.4.x results in a crash here:

/jazzy/lib/jazzy/config.rb:298:in `block in <class:Config>': unexpected return (LocalJumpError)
    from /jazzy/lib/jazzy/config.rb:36:in `instance_exec'
    from /jazzy/lib/jazzy/config.rb:36:in `set'
    from /jazzy/lib/jazzy/config.rb:55:in `block in attach_to_option_parser'
    from /usr/local/Cellar/ruby/2.4.0/lib/ruby/2.4.0/optparse.rb:1552:in `block in parse_in_order'
    from /usr/local/Cellar/ruby/2.4.0/lib/ruby/2.4.0/optparse.rb:1538:in `catch'
    from /usr/local/Cellar/ruby/2.4.0/lib/ruby/2.4.0/optparse.rb:1538:in `parse_in_order'
    from /usr/local/Cellar/ruby/2.4.0/lib/ruby/2.4.0/optparse.rb:1532:in `order!'
    from /usr/local/Cellar/ruby/2.4.0/lib/ruby/2.4.0/optparse.rb:1626:in `permute!'
    from /usr/local/Cellar/ruby/2.4.0/lib/ruby/2.4.0/optparse.rb:1648:in `parse!'
    from /jazzy/lib/jazzy/config.rb:383:in `parse_command_line'
    from /jazzy/lib/jazzy/config.rb:340:in `parse!'
    from /jazzy/bin/jazzy:15:in `<main>'

This is because newer versions of Ruby strictly disallow return from within a block, such as:

parse: ->(t) do
    return expand_path(t) unless t == 'apple' || t == 'fullwidth'
    Pathname(__FILE__).parent + 'themes' + t
end

/cc @1ec5

@1ec5
Copy link
Collaborator

1ec5 commented Feb 22, 2017

newer versions of Ruby strictly disallow return from within a block

Nice, this will avoid issues like #711 in the future.

@jpsim jpsim closed this as completed in #753 Mar 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants