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

ruby3.2 : undefined method `exists?' for File:Class (NoMethodError) #47

Open
eoli3n opened this issue Dec 30, 2023 · 2 comments
Open

ruby3.2 : undefined method `exists?' for File:Class (NoMethodError) #47

eoli3n opened this issue Dec 30, 2023 · 2 comments

Comments

@eoli3n
Copy link

eoli3n commented Dec 30, 2023

Seems to not build with ruby3.2, because exists alias for exist is removed.

/home/user/dev/eoli3n.github.io/vendor/bundle/ruby/3.2.0/gems/jekyll-gallery-generator-1.2.4/lib/jekyll-gallery-generator.rb:98:in `initialize': undefined method `exists?' for File:Class (NoMethodError)

      unless File.exists?(gallery_index)
                 ^^^^^^^^
Did you mean?  exist?

https://stackoverflow.com/a/75353113

@eoli3n
Copy link
Author

eoli3n commented Dec 31, 2023

full log

bash-5.2$ bundle exec jekyll build
Configuration file: /home/user/dev/eoli3n.github.io/_config.yml
To use retry middleware with Faraday v2.0+, install `faraday-retry` gem
            Source: /home/user/dev/eoli3n.github.io
       Destination: /home/user/dev/eoli3n.github.io/_site
 Incremental build: disabled. Enable with --incremental
      Generating...
Error generating galleries: undefined method `exists?' for File:Class
/home/user/dev/eoli3n.github.io/vendor/bundle/ruby/3.2.0/gems/jekyll-gallery-generator-1.2.4/lib/jekyll-gallery-generator.rb:158:in `initialize'
/home/user/dev/eoli3n.github.io/vendor/bundle/ruby/3.2.0/gems/jekyll-gallery-generator-1.2.4/lib/jekyll-gallery-generator.rb:286:in `new'
/home/user/dev/eoli3n.github.io/vendor/bundle/ruby/3.2.0/gems/jekyll-gallery-generator-1.2.4/lib/jekyll-gallery-generator.rb:286:in `block in generate'
/home/user/dev/eoli3n.github.io/vendor/bundle/ruby/3.2.0/gems/jekyll-gallery-generator-1.2.4/lib/jekyll-gallery-generator.rb:283:in `foreach'
/home/user/dev/eoli3n.github.io/vendor/bundle/ruby/3.2.0/gems/jekyll-gallery-generator-1.2.4/lib/jekyll-gallery-generator.rb:283:in `generate'
/home/user/dev/eoli3n.github.io/vendor/bundle/ruby/3.2.0/gems/jekyll-3.9.3/lib/jekyll/site.rb:175:in `block in generate'
/home/user/dev/eoli3n.github.io/vendor/bundle/ruby/3.2.0/gems/jekyll-3.9.3/lib/jekyll/site.rb:173:in `each'
/home/user/dev/eoli3n.github.io/vendor/bundle/ruby/3.2.0/gems/jekyll-3.9.3/lib/jekyll/site.rb:173:in `generate'
/home/user/dev/eoli3n.github.io/vendor/bundle/ruby/3.2.0/gems/jekyll-3.9.3/lib/jekyll/site.rb:70:in `process'
/home/user/dev/eoli3n.github.io/vendor/bundle/ruby/3.2.0/gems/jekyll-3.9.3/lib/jekyll/command.rb:28:in `process_site'
/home/user/dev/eoli3n.github.io/vendor/bundle/ruby/3.2.0/gems/jekyll-3.9.3/lib/jekyll/commands/build.rb:65:in `build'
/home/user/dev/eoli3n.github.io/vendor/bundle/ruby/3.2.0/gems/jekyll-3.9.3/lib/jekyll/commands/build.rb:36:in `process'
/home/user/dev/eoli3n.github.io/vendor/bundle/ruby/3.2.0/gems/jekyll-3.9.3/lib/jekyll/commands/build.rb:18:in `block (2 levels) in init_with_program'
/home/user/dev/eoli3n.github.io/vendor/bundle/ruby/3.2.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `block in execute'
/home/user/dev/eoli3n.github.io/vendor/bundle/ruby/3.2.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `each'
/home/user/dev/eoli3n.github.io/vendor/bundle/ruby/3.2.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `execute'
/home/user/dev/eoli3n.github.io/vendor/bundle/ruby/3.2.0/gems/mercenary-0.3.6/lib/mercenary/program.rb:42:in `go'
/home/user/dev/eoli3n.github.io/vendor/bundle/ruby/3.2.0/gems/mercenary-0.3.6/lib/mercenary.rb:19:in `program'
/home/user/dev/eoli3n.github.io/vendor/bundle/ruby/3.2.0/gems/jekyll-3.9.3/exe/jekyll:15:in `<top (required)>'
/home/user/dev/eoli3n.github.io/vendor/bundle/ruby/3.2.0/bin/jekyll:25:in `load'
/home/user/dev/eoli3n.github.io/vendor/bundle/ruby/3.2.0/bin/jekyll:25:in `<top (required)>'
/home/user/dev/eoli3n.github.io/vendor/bundle/ruby/3.2.0/gems/bundler-2.3.23/lib/bundler/cli/exec.rb:58:in `load'
/home/user/dev/eoli3n.github.io/vendor/bundle/ruby/3.2.0/gems/bundler-2.3.23/lib/bundler/cli/exec.rb:58:in `kernel_load'
/home/user/dev/eoli3n.github.io/vendor/bundle/ruby/3.2.0/gems/bundler-2.3.23/lib/bundler/cli/exec.rb:23:in `run'
/home/user/dev/eoli3n.github.io/vendor/bundle/ruby/3.2.0/gems/bundler-2.3.23/lib/bundler/cli.rb:486:in `exec'
/home/user/dev/eoli3n.github.io/vendor/bundle/ruby/3.2.0/gems/bundler-2.3.23/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/home/user/dev/eoli3n.github.io/vendor/bundle/ruby/3.2.0/gems/bundler-2.3.23/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
/home/user/dev/eoli3n.github.io/vendor/bundle/ruby/3.2.0/gems/bundler-2.3.23/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
/home/user/dev/eoli3n.github.io/vendor/bundle/ruby/3.2.0/gems/bundler-2.3.23/lib/bundler/cli.rb:31:in `dispatch'
/home/user/dev/eoli3n.github.io/vendor/bundle/ruby/3.2.0/gems/bundler-2.3.23/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
/home/user/dev/eoli3n.github.io/vendor/bundle/ruby/3.2.0/gems/bundler-2.3.23/lib/bundler/cli.rb:25:in `start'
/home/user/dev/eoli3n.github.io/vendor/bundle/ruby/3.2.0/gems/bundler-2.3.23/exe/bundle:48:in `block in <top (required)>'
/home/user/dev/eoli3n.github.io/vendor/bundle/ruby/3.2.0/gems/bundler-2.3.23/lib/bundler/friendly_errors.rb:120:in `with_friendly_errors'
/home/user/dev/eoli3n.github.io/vendor/bundle/ruby/3.2.0/gems/bundler-2.3.23/exe/bundle:36:in `<top (required)>'
/home/user/.gems/bin/bundle:25:in `load'
/home/user/.gems/bin/bundle:25:in `<main>'
jekyll 3.9.3 | Error:  undefined method `exists?' for File:Class
/home/user/dev/eoli3n.github.io/vendor/bundle/ruby/3.2.0/gems/jekyll-gallery-generator-1.2.4/lib/jekyll-gallery-generator.rb:98:in `initialize': undefined method `exists?' for File:Class (NoMethodError)

      unless File.exists?(gallery_index)
                 ^^^^^^^^
Did you mean?  exist?
        from /home/user/dev/eoli3n.github.io/vendor/bundle/ruby/3.2.0/gems/jekyll-gallery-generator-1.2.4/lib/jekyll-gallery-generator.rb:299:in `new'
        from /home/user/dev/eoli3n.github.io/vendor/bundle/ruby/3.2.0/gems/jekyll-gallery-generator-1.2.4/lib/jekyll-gallery-generator.rb:299:in `generate'
        from /home/user/dev/eoli3n.github.io/vendor/bundle/ruby/3.2.0/gems/jekyll-3.9.3/lib/jekyll/site.rb:175:in `block in generate'
        from /home/user/dev/eoli3n.github.io/vendor/bundle/ruby/3.2.0/gems/jekyll-3.9.3/lib/jekyll/site.rb:173:in `each'
        from /home/user/dev/eoli3n.github.io/vendor/bundle/ruby/3.2.0/gems/jekyll-3.9.3/lib/jekyll/site.rb:173:in `generate'
        from /home/user/dev/eoli3n.github.io/vendor/bundle/ruby/3.2.0/gems/jekyll-3.9.3/lib/jekyll/site.rb:70:in `process'
        from /home/user/dev/eoli3n.github.io/vendor/bundle/ruby/3.2.0/gems/jekyll-3.9.3/lib/jekyll/command.rb:28:in `process_site'
        from /home/user/dev/eoli3n.github.io/vendor/bundle/ruby/3.2.0/gems/jekyll-3.9.3/lib/jekyll/commands/build.rb:65:in `build'
        from /home/user/dev/eoli3n.github.io/vendor/bundle/ruby/3.2.0/gems/jekyll-3.9.3/lib/jekyll/commands/build.rb:36:in `process'
        from /home/user/dev/eoli3n.github.io/vendor/bundle/ruby/3.2.0/gems/jekyll-3.9.3/lib/jekyll/commands/build.rb:18:in `block (2 levels) in init_with_program'
        from /home/user/dev/eoli3n.github.io/vendor/bundle/ruby/3.2.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `block in execute'
        from /home/user/dev/eoli3n.github.io/vendor/bundle/ruby/3.2.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `each'
        from /home/user/dev/eoli3n.github.io/vendor/bundle/ruby/3.2.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `execute'
        from /home/user/dev/eoli3n.github.io/vendor/bundle/ruby/3.2.0/gems/mercenary-0.3.6/lib/mercenary/program.rb:42:in `go'
        from /home/user/dev/eoli3n.github.io/vendor/bundle/ruby/3.2.0/gems/mercenary-0.3.6/lib/mercenary.rb:19:in `program'
        from /home/user/dev/eoli3n.github.io/vendor/bundle/ruby/3.2.0/gems/jekyll-3.9.3/exe/jekyll:15:in `<top (required)>'
        from /home/user/dev/eoli3n.github.io/vendor/bundle/ruby/3.2.0/bin/jekyll:25:in `load'
        from /home/user/dev/eoli3n.github.io/vendor/bundle/ruby/3.2.0/bin/jekyll:25:in `<top (required)>'
        from /home/user/dev/eoli3n.github.io/vendor/bundle/ruby/3.2.0/gems/bundler-2.3.23/lib/bundler/cli/exec.rb:58:in `load'
        from /home/user/dev/eoli3n.github.io/vendor/bundle/ruby/3.2.0/gems/bundler-2.3.23/lib/bundler/cli/exec.rb:58:in `kernel_load'
        from /home/user/dev/eoli3n.github.io/vendor/bundle/ruby/3.2.0/gems/bundler-2.3.23/lib/bundler/cli/exec.rb:23:in `run'
        from /home/user/dev/eoli3n.github.io/vendor/bundle/ruby/3.2.0/gems/bundler-2.3.23/lib/bundler/cli.rb:486:in `exec'
        from /home/user/dev/eoli3n.github.io/vendor/bundle/ruby/3.2.0/gems/bundler-2.3.23/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
        from /home/user/dev/eoli3n.github.io/vendor/bundle/ruby/3.2.0/gems/bundler-2.3.23/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
        from /home/user/dev/eoli3n.github.io/vendor/bundle/ruby/3.2.0/gems/bundler-2.3.23/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
        from /home/user/dev/eoli3n.github.io/vendor/bundle/ruby/3.2.0/gems/bundler-2.3.23/lib/bundler/cli.rb:31:in `dispatch'
        from /home/user/dev/eoli3n.github.io/vendor/bundle/ruby/3.2.0/gems/bundler-2.3.23/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
        from /home/user/dev/eoli3n.github.io/vendor/bundle/ruby/3.2.0/gems/bundler-2.3.23/lib/bundler/cli.rb:25:in `start'
        from /home/user/dev/eoli3n.github.io/vendor/bundle/ruby/3.2.0/gems/bundler-2.3.23/exe/bundle:48:in `block in <top (required)>'
        from /home/user/dev/eoli3n.github.io/vendor/bundle/ruby/3.2.0/gems/bundler-2.3.23/lib/bundler/friendly_errors.rb:120:in `with_friendly_errors'
        from /home/user/dev/eoli3n.github.io/vendor/bundle/ruby/3.2.0/gems/bundler-2.3.23/exe/bundle:36:in `<top (required)>'
        from /home/user/.gems/bin/bundle:25:in `load'
        from /home/user/.gems/bin/bundle:25:in `<main>'

@eoli3n
Copy link
Author

eoli3n commented Dec 31, 2023

workaround until its fixed in the project, thanks to adam12 on libera.chat#ruby

$ cat << EOF > file-exists.rb
class File
  class << self
    alias_method :exists?, :exist?
  end
end
EOF

$ RUBYOPT="-r./file-exists" bundle exec jekyll build

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant