Closed jeff-matthews closed 5 years ago
@jeff-matthews Thanks for this. I moved things around a bit to better conform to Ruby style, and added tests. I believe things should now be working as expected. Mind giving it another try?
If things look good, if you wouldn't mind documenting the new behavior in the README, I believe this PR can be merged and I can cut a new release.
Thanks @benbalter! I pulled your changes, but I'm getting an error:
bundler: failed to load command: jekyll (/Users/jeffmatthews/.rvm/gems/ruby-2.5.3/bin/jekyll)
NoMethodError: undefined method `config' for #<Jekyll::Configuration:0x00007fda99e0fe18>
/Users/jeffmatthews/.rvm/gems/ruby-2.5.3/gems/jekyll-3.7.4/lib/jekyll/filters/url_filters.rb:55:in `sanitized_baseurl'
/Users/jeffmatthews/.rvm/gems/ruby-2.5.3/gems/jekyll-3.7.4/lib/jekyll/filters/url_filters.rb:35:in `relative_url'
/Users/jeffmatthews/git/forks/jekyll-relative-links/lib/jekyll-relative-links/generator.rb:91:in `url_for_path'
/Users/jeffmatthews/git/forks/jekyll-relative-links/lib/jekyll-relative-links/generator.rb:55:in `block in replace_relative_links!'
/Users/jeffmatthews/git/forks/jekyll-relative-links/lib/jekyll-relative-links/generator.rb:50:in `gsub'
/Users/jeffmatthews/git/forks/jekyll-relative-links/lib/jekyll-relative-links/generator.rb:50:in `replace_relative_links!'
/Users/jeffmatthews/git/forks/jekyll-relative-links/lib/jekyll-relative-links/generator.rb:42:in `block in generate'
/Users/jeffmatthews/git/forks/jekyll-relative-links/lib/jekyll-relative-links/generator.rb:37:in `each'
/Users/jeffmatthews/git/forks/jekyll-relative-links/lib/jekyll-relative-links/generator.rb:37:in `generate'
/Users/jeffmatthews/.rvm/gems/ruby-2.5.3/gems/jekyll-3.7.4/lib/jekyll/site.rb:174:in `block in generate'
/Users/jeffmatthews/.rvm/gems/ruby-2.5.3/gems/jekyll-3.7.4/lib/jekyll/site.rb:172:in `each'
/Users/jeffmatthews/.rvm/gems/ruby-2.5.3/gems/jekyll-3.7.4/lib/jekyll/site.rb:172:in `generate'
/Users/jeffmatthews/.rvm/gems/ruby-2.5.3/gems/jekyll-3.7.4/lib/jekyll/site.rb:72:in `process'
/Users/jeffmatthews/.rvm/gems/ruby-2.5.3/gems/jekyll-3.7.4/lib/jekyll/command.rb:28:in `process_site'
/Users/jeffmatthews/.rvm/gems/ruby-2.5.3/gems/jekyll-3.7.4/lib/jekyll/commands/build.rb:65:in `build'
/Users/jeffmatthews/.rvm/gems/ruby-2.5.3/gems/jekyll-3.7.4/lib/jekyll/commands/build.rb:36:in `process'
/Users/jeffmatthews/.rvm/gems/ruby-2.5.3/gems/jekyll-3.7.4/lib/jekyll/commands/build.rb:18:in `block (2 levels) in init_with_program'
/Users/jeffmatthews/.rvm/gems/ruby-2.5.3/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `block in execute'
/Users/jeffmatthews/.rvm/gems/ruby-2.5.3/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `each'
/Users/jeffmatthews/.rvm/gems/ruby-2.5.3/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `execute'
/Users/jeffmatthews/.rvm/gems/ruby-2.5.3/gems/mercenary-0.3.6/lib/mercenary/program.rb:42:in `go'
/Users/jeffmatthews/.rvm/gems/ruby-2.5.3/gems/mercenary-0.3.6/lib/mercenary.rb:19:in `program'
/Users/jeffmatthews/.rvm/gems/ruby-2.5.3/gems/jekyll-3.7.4/exe/jekyll:15:in `<top (required)>'
/Users/jeffmatthews/.rvm/gems/ruby-2.5.3/bin/jekyll:23:in `load'
/Users/jeffmatthews/.rvm/gems/ruby-2.5.3/bin/jekyll:23:in `<top (required)>'```
@jeff-matthews sorry about that. You actually found a long-standing bug, and I think a long-standing mistake in the Jekyll documentation. I'll open an issue upstream, but things should be fixed here and I can build locally outside of tests. Mind giving it another try?
@benbalter, works like a charm! Generation time in my particular project went from ~670 seconds to ~4 seconds, which is a huge improvement. I'll update the README with the new behavior and push those changes to this PR.
Congrats on getting your first pull request to Jekyll Relative Links merged! Without amazing humans like you submitting pull requests, we couldn’t run this project. You rock! :tada:
If you're interested in tackling another bug or feature, take a look at the open issues, especially those labeled help wanted
.
Thanks @jeff-matthews!
Thank you @benbalter!!!
Fixes https://github.com/benbalter/jekyll-relative-links/issues/49
I added some logic to the
generator.rb
file to exclude directories specified in a project's_config.yml
file like so:The plugin still seems to be processing all directories though because I don't see confirmation in the console that the specified directories have been excluded when it gets to the
jekyll-relative-links
stage: