mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 22:43:33 +08:00
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:
@ -424,7 +424,7 @@ class Plugin::Instance
|
||||
end
|
||||
|
||||
def delete_extra_automatic_assets(good_paths)
|
||||
return unless Dir.exists? auto_generated_path
|
||||
return unless Dir.exist? auto_generated_path
|
||||
|
||||
filenames = good_paths.map { |f| File.basename(f) }
|
||||
# nuke old files
|
||||
@ -701,7 +701,7 @@ class Plugin::Instance
|
||||
end
|
||||
|
||||
public_data = File.dirname(path) + "/public"
|
||||
if Dir.exists?(public_data)
|
||||
if Dir.exist?(public_data)
|
||||
target = Rails.root.to_s + "/public/plugins/"
|
||||
|
||||
Discourse::Utils.execute_command('mkdir', '-p', target)
|
||||
@ -839,7 +839,7 @@ class Plugin::Instance
|
||||
end
|
||||
|
||||
def js_asset_exists?
|
||||
File.exists?(js_file_path)
|
||||
File.exist?(js_file_path)
|
||||
end
|
||||
|
||||
# Receives an array with two elements:
|
||||
@ -1085,7 +1085,7 @@ class Plugin::Instance
|
||||
end
|
||||
|
||||
def write_asset(path, contents)
|
||||
unless File.exists?(path)
|
||||
unless File.exist?(path)
|
||||
ensure_directory(path)
|
||||
File.open(path, "w") { |f| f.write(contents) }
|
||||
end
|
||||
|
Reference in New Issue
Block a user