cane
cane copied to clipboard
Ruby 3 incompatibility (call to `File.exists?`)
cane checks currently fail on Ruby 3 because of this call to File.exists?:
https://github.com/square/cane/blob/c8d6ce4e0092e5f677d3a2f409db7566e5d82136/lib/cane/file.rb#L21-L23
This now gives a NoMethodError and suggests File.exist?.
Typical Ruby to delete the method with the correct grammar, if you ask me. :(
here is what worked for me, I created bin/run_cane:
#!/usr/bin/env ruby
# Monkey patch for File.exists? to alias it to File.exist?
# https://github.com/square/cane/issues/102
if RUBY_VERSION >= '3.2.0' && !File.respond_to?(:exists?)
class File
class << self
alias_method :exists?, :exist?
end
end
end
load Gem.bin_path('cane', 'cane')
Monkey patched that one.