Ruby 3.2 compatibility - close #163

This commit is contained in:
josh committed 2022-08-05 16:40:48 -04:00
1 parent 8f0f320a07
commit 132d22e886
13 files changed
+131 -131

No files matched your search

+1 -1
View File
@@ -237,7 +237,7 @@ module Rscons
cache = Cache.instance
cache.targets(true).each do |target|
cache.remove_target(target)
next unless File.exists?(target)
next unless File.exist?(target)
puts "Removing #{target}" if verbose
FileUtils.rm_f(target)
end
+4 -4
View File
@@ -14,14 +14,14 @@ module Rscons
# Run the builder to produce a build target.
def run(options)
target_is_dir = (@sources.length > 1) ||
Dir.exists?(@sources.first) ||
Dir.exists?(@target)
Dir.exist?(@sources.first) ||
Dir.exist?(@target)
outdir = target_is_dir ? @target : File.dirname(@target)
# Collect the list of files to copy over.
file_map = {}
if target_is_dir
@sources.each do |src|
if Dir.exists? src
if Dir.exist? src
Dir.glob("#{src}/**/*", File::FNM_DOTMATCH).select do |f|
File.file?(f)
end.each do |subfile|
@@ -50,7 +50,7 @@ module Rscons
end
@cache.register_build(dest, :Copy, [src], @env, install: @install_builder)
end
(target_is_dir ? Dir.exists?(@target) : File.exists?(@target)) ? true : false
(target_is_dir ? Dir.exist?(@target) : File.exist?(@target)) ? true : false
end
end
+1 -1
View File
@@ -14,7 +14,7 @@ module Rscons
def run(options)
if File.directory?(@target)
true
elsif File.exists?(@target)
elsif File.exist?(@target)
Ansi.write($stderr, :red, "Error: `#{@target}' already exists and is not a directory", :reset, "\n")
false
else
+1 -1
View File
@@ -8,7 +8,7 @@ module Rscons
# dependency file.
def finalize_command_with_depfile
deps = @sources
if File.exists?(@vars["_DEPFILE"])
if File.exist?(@vars["_DEPFILE"])
deps += Util.parse_dependency_file(@vars["_DEPFILE"])
end
@cache.register_build(@target, @command, deps.uniq, @env)
+2 -2
View File
@@ -147,7 +147,7 @@ module Rscons
unless Rscons.phony_target?(target)
# target file must exist on disk
unless File.exists?(target)
unless File.exist?(target)
if options[:debug]
puts "Target #{target} needs rebuilding because it does not exist on disk"
end
@@ -307,7 +307,7 @@ module Rscons
parts.each_index do |i|
next if parts[i] == ""
subpath = File.join(*parts[0, i + 1])
unless File.exists?(subpath)
unless File.exist?(subpath)
FileUtils.mkdir_p(subpath)
@cache["directories"][subpath] = !!options[:install]
end
+2 -2
View File
@@ -118,13 +118,13 @@ module Rscons
# Find the build script.
if rsconscript
unless File.exists?(rsconscript)
unless File.exist?(rsconscript)
$stderr.puts "Cannot read #{rsconscript}"
return 1
end
else
rsconscript = DEFAULT_RSCONSCRIPTS.find do |f|
File.exists?(f)
File.exist?(f)
end
end