DEV: Fix methods removed in Ruby 3.2 (#15459)

* File.exists? is deprecated and removed in Ruby 3.2 in favor of
File.exist?
* Dir.exists? is deprecated and removed in Ruby 3.2 in favor of
Dir.exist?
This commit is contained in:
Peter Zhu
2022-01-05 12:45:08 -05:00
committed by GitHub
parent 692ba188bf
commit c5fd8c42db
75 changed files with 140 additions and 140 deletions

View File

@ -7,7 +7,7 @@ module BackupRestore
root_directory ||= File.join(Rails.root, "public", "backups")
base_directory = File.join(root_directory, current_db)
FileUtils.mkdir_p(base_directory) unless Dir.exists?(base_directory)
FileUtils.mkdir_p(base_directory) unless Dir.exist?(base_directory)
base_directory
end
@ -25,13 +25,13 @@ module BackupRestore
def file(filename, include_download_source: false)
path = path_from_filename(filename)
create_file_from_path(path, include_download_source) if File.exists?(path)
create_file_from_path(path, include_download_source) if File.exist?(path)
end
def delete_file(filename)
path = path_from_filename(filename)
if File.exists?(path)
if File.exist?(path)
File.delete(path)
reset_cache
end