yegor256 / jekyll-plantuml

PlantUML plugin for Jekyll: helps you embed UML diagrams into static pages
https://rubygems.org/gems/jekyll-plantuml
MIT License
47 stars 15 forks source link

render is broken: undefined method "exists" in jekyll-plantuml-svg.rb when running on Ruby 3.2.2 #21

Closed TomConner closed 1 year ago

TomConner commented 1 year ago

Problem:

With a site on jekyll 4.3.2 with the jekyll-plantuml plugin, on ruby 3.2.2, during bundle exec jekyll build or serve I get

_plugins/jekyll-plantuml-svg.rb:53:in `render': undefined method `exists?' for File:Class (NoMethodError)

      if !File.exists?(uml) or !File.exists?(svg)
              ^^^^^^^^
Did you mean?  exist?

In Ruby 2.7.8 (doc), the exists method was available but marked deprecated. In Ruby 3 (doc), exists is gone but exist seems equivalent.

Suggestion:

Replace exists with exist throughout jekyll-plantuml.

Checklist: ✅ - You have all pre-requisites listed in README.md installed ✅ - You are sure that you are not reporting a duplicate (search all issues) ✅ - You say "is broken" or "doesn't work" in the title ✅ - You tell us what you are trying to do ✅ - You explain the results you are getting ✅ - You suggest an alternative result you would like to see

TomConner commented 1 year ago

The log shown in the report above was from a local file not from this repo. But the issue is still valid. I reproduced the issue using the stock 1.3.4 jekyll-plantuml plugin

/ruby/3.2.2/gems/jekyll-plantuml-1.3.4/lib/jekyll-plantuml.rb:36:in `render': undefined method `exists?' for File:Class (NoMethodError)

      if !File.exists?(File.join(site.dest, "uml/#{name}.svg"))
              ^^^^^^^^
Did you mean?  exist?

and verified that #22 fixes it.

yegor256 commented 1 year ago

@rultor release, tag is 1.4.0

rultor commented 1 year ago

@rultor release, tag is 1.4.0

@yegor256 OK, I will release it now. Please check the progress here

rultor commented 1 year ago

@rultor release, tag is 1.4.0

@yegor256 Done! FYI, the full log is here (took me 1min)

yegor256 commented 1 year ago

@TomConner please, try version 1.4.1, should work fine

TomConner commented 1 year ago

Yes 1.4.1 works great. Thanks!