Skip to content

Commit

Permalink
Change File.exists? to File.exist? To fix rubinius/rubinius#2853
Browse files Browse the repository at this point in the history
In lib/daedalus.rb
  • Loading branch information
anthropomorphic committed Dec 27, 2013
1 parent 76bebae commit be408b8
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions lib/daedalus.rb
Original file line number Diff line number Diff line change
Expand Up @@ -151,12 +151,12 @@ def initialize(cc, cxx, ldshared, ldsharedxx, logger, blueprint)
@blueprint = blueprint

@mod_times = Hash.new do |h,k|
h[k] = (File.exists?(k) ? File.mtime(k) : Time.at(0))
h[k] = (File.exist?(k) ? File.mtime(k) : Time.at(0))
end

@sha1_mtimes = {}
@sha1s = Hash.new do |h,k|
if File.exists?(k)
if File.exist?(k)
@log.verbose "computing SHA1: #{k}"
@sha1_mtimes[k] = File.mtime(k)
h[k] = Digest::SHA1.file(k).hexdigest
Expand Down Expand Up @@ -274,7 +274,7 @@ class Path
def initialize(path)
@path = path

if File.exists?(data_path)
if File.exist?(data_path)
begin
File.open data_path, "rb" do |f|
@data = Marshal.load(f.read)
Expand Down Expand Up @@ -383,12 +383,12 @@ def newer_dependencies(ctx)
end

def out_of_date?(ctx)
unless File.exists?(@path)
unless File.exist?(@path)
return true if @autogen_builder
raise Errno::ENOENT, "Missing #{@path}"
end

return true unless File.exists?(object_path)
return true unless File.exist?(object_path)

return true if ctx.mtime_only and ctx.mtime(@path) > ctx.mtime(object_path)

Expand All @@ -414,14 +414,14 @@ def build(ctx)
end

def clean
File.unlink object_path if File.exists?(object_path)
File.unlink data_path if File.exists?(data_path)
File.unlink object_path if File.exist?(object_path)
File.unlink data_path if File.exist?(data_path)

Dir.rmdir artifacts_path if Dir.entries(artifacts_path).empty?
end

def describe(ctx)
if !File.exists?(object_path)
if !File.exist?(object_path)
puts "#{@path}: unbuilt"
else
if @data[:sha1] != sha1(ctx)
Expand Down Expand Up @@ -472,7 +472,7 @@ def to_build(&blk)

@data_file = "#{@build_dir}.data"

if File.exists?(@data_file)
if File.exist?(@data_file)
begin
File.open @data_file, "rb" do |f|
@data = Marshal.load(f.read)
Expand Down Expand Up @@ -508,7 +508,7 @@ def sha1
def have_objects
return true unless @objects
@objects.each do |o|
return false unless File.exists?(o)
return false unless File.exist?(o)
end

return true
Expand Down Expand Up @@ -587,9 +587,9 @@ def object_files

def out_of_date?(compiler)
Dir.chdir @base do
return true unless File.exists? name
return true unless File.exist? name
@sources.each do |s|
return true unless File.exists? s.object_path
return true unless File.exist? s.object_path
return true if File.mtime(s.object_path) > File.mtime(name)
end
@sources.any? { |s| s.out_of_date? compiler }
Expand All @@ -603,7 +603,7 @@ def consider(compiler, tasks)
def clean
Dir.chdir @base do
@sources.each { |s| s.clean }
File.delete name if File.exists? name
File.delete name if File.exist? name
end
end
end
Expand Down Expand Up @@ -666,7 +666,7 @@ def initialize(base, compiler)

def depends_on(file, command)
# TODO: HACK, the agony, this should be implicit
unless File.exists? File.join(@base, file)
unless File.exist? File.join(@base, file)
raise "library group #{@base} depends on #{file}, please run #{command}"
end
end
Expand Down Expand Up @@ -744,7 +744,7 @@ def objects

def consider(ctx, tasks)
@files.each { |x| x.consider(ctx, tasks) }
tasks.post << self unless tasks.empty? and File.exists?(@path)
tasks.post << self unless tasks.empty? and File.exist?(@path)
end

def build(ctx)
Expand All @@ -757,8 +757,8 @@ def clean
f.clean if f.respond_to? :clean
end

File.unlink @path if File.exists?(@path)
File.unlink data_path if File.exists?(data_path)
File.unlink @path if File.exist?(@path)
File.unlink data_path if File.exist?(data_path)
Dir.rmdir artifacts_path if Dir.entries(artifacts_path).empty?
end

Expand Down

0 comments on commit be408b8

Please sign in to comment.