sunspot icon indicating copy to clipboard operation
sunspot copied to clipboard

NoMethodError on Ruby 3.2 for `File.exists?`

Open p8 opened this issue 2 years ago • 6 comments

Ruby 3.2 removed the deprecated File.exists? and now Sunspot raises the following error on Ruby 3.2:

NoMethodError: undefined method `exists?' for File:Class

#1016 fixes this by replacing File.exists? with File.exist?. I would love to see that PR merged. 🙇 Thanks!

p8 avatar Jan 12 '23 15:01 p8

Same here:

NoMethodError: undefined method exists?' for File:Class /Users/snip/.gems/gems/sunspot_solr-2.6.0/lib/sunspot/solr/server.rb:174:in install_solr_home' /Users/snip/.gems/gems/sunspot_solr-2.6.0/lib/sunspot/solr/server.rb:40:in bootstrap' /Users/snip/.gems/gems/sunspot_solr-2.6.0/lib/sunspot/solr/server.rb:55:in start' /Users/snip/.gems/gems/sunspot_solr-2.6.0/lib/sunspot/solr/tasks.rb:10:in block (3 levels) in <top (required)>' /Users/snip/.rbenv/versions/3.2.2/bin/bundle:25:in load' /Users/snip/.rbenv/versions/3.2.2/bin/bundle:25:in `

' Tasks: TOP => sunspot:solr:start

fmorton avatar May 01 '23 14:05 fmorton

We should probably release a new version of sunspot that integrates these changes as anyone downloading from Ruby Gems will have their app break on 3.2.0 https://rubygems.org/gems/sunspot_rails

maximus242 avatar Jul 12 '23 16:07 maximus242

The fix is merged in https://github.com/sunspot/sunspot/pull/1034

maybe @serggl could release a new Version?

rocket-turtle avatar Aug 23 '23 15:08 rocket-turtle

Same problem here. locally I make the change but it will block a production release. Is it possible for you to make a new version with the changes?

Anyone ?

Thanks

FredHasselot avatar Oct 05 '23 15:10 FredHasselot

Here is what I did to get by. If you are using rails, I just put it in a file in the initializers directory:

class File def self.exists?(filename) File.exist?(filename) end end

Frank

On Oct 5, 2023, at 11:35 AM, Fred @.***> wrote:

Same problem here. locally I make the change but it will block a production release. Is it possible for you to make a new version with the changes?

Anyone ?

Thanks

— Reply to this email directly, view it on GitHub https://github.com/sunspot/sunspot/issues/1024#issuecomment-1749148922, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABEM2XY3CPECKCVOM3U2L3X53HU5AVCNFSM6AAAAAATZM3TI6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONBZGE2DQOJSGI. You are receiving this because you commented.

fmorton avatar Oct 05 '23 15:10 fmorton

Cool, it looks better. Thanks. It will be okay temporarily for this issue.

The automated tests of github action do not pass. I was trying to run Solr in the CI like I do locally before running the Rspec tests. (it works locally) but that's another question...

FredHasselot avatar Oct 05 '23 16:10 FredHasselot

@p8 that should be fixed in the v2.7.0

https://my.diffend.io/gems/sunspot_solr/2.6.0/2.7.0

rocket-turtle avatar Jun 11 '24 09:06 rocket-turtle

Thanks @rocket-turtle !

p8 avatar Jun 14 '24 11:06 p8