rspec_api_documentation icon indicating copy to clipboard operation
rspec_api_documentation copied to clipboard

Support ruby 3.2, DEPRECATED File.exists?

Open sandraa-nestor opened this issue 1 year ago • 2 comments

When I try to generate api docs on ruby 3.2.0 I get an error:

../lib/rspec_api_documentation/writers/writer.rb:17:in 'clear_docs': undefined method 'exists?' for File:Class (NoMethodError)

File.exists? was deprecated in ruby 2.1.0 and has been removed in the ruby 3.2.0

sandraa-nestor avatar Nov 06 '23 08:11 sandraa-nestor

As a workaround, you can add a monkey-patch like:

class File
  class << self
    alias_method :exists?, :exist?
  end
end

nickmerwin avatar Mar 08 '24 22:03 nickmerwin

Rubocop removes the line entirely as File.rm_rf is supposed to be idempotent and not care if the file doesn't exist

pjscopeland avatar Jun 25 '24 01:06 pjscopeland