1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

This commit was generated by cvs2svn to compensate for changes in r372,

which included commits to RCS files with non-trunk default branches.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@373 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 1999-01-20 04:59:39 +00:00
parent 9c5b1986a3
commit 210367ec88
140 changed files with 25635 additions and 14037 deletions

View file

@ -30,7 +30,7 @@ class << File
to.binmode
begin
while TRUE
while true
r = from.sysread(fsize)
rsize = r.size
w = 0
@ -40,9 +40,9 @@ class << File
end
end
rescue EOFError
ret = TRUE
ret = true
rescue
ret = FALSE
ret = false
ensure
to.close
from.close
@ -50,7 +50,7 @@ class << File
ret
end
def copy from, to, verbose = FALSE
def copy from, to, verbose = false
$stderr.print from, " -> ", catname(from, to), "\n" if verbose
syscopy from, to
end
@ -59,11 +59,11 @@ class << File
# move file
def move from, to, verbose = FALSE
def move from, to, verbose = false
to = catname(from, to)
$stderr.print from, " -> ", to, "\n" if verbose
if PLATFORM =~ /djgpp|cygwin32|mswin32/ and FileTest.file? to
if PLATFORM =~ /djgpp|cygwin|mswin32/ and FileTest.file? to
unlink to
end
begin
@ -76,10 +76,10 @@ class << File
alias mv move
# compare two files
# TRUE: identical
# FALSE: not identical
# true: identical
# false: not identical
def compare from, to, verbose = FALSE
def compare from, to, verbose = false
$stderr.print from, " <=> ", to, "\n" if verbose
fsize = size(from)
fsize = 1024 if fsize < 512
@ -90,7 +90,7 @@ class << File
to = open(to, "r")
to.binmode
ret = FALSE
ret = false
fr = tr = ''
begin
@ -103,7 +103,7 @@ class << File
end
end
rescue
ret = FALSE
ret = false
ensure
to.close
from.close
@ -116,7 +116,7 @@ class << File
# unlink files safely
def safe_unlink(*files)
verbose = if files[-1].is_a? String then FALSE else files.pop end
verbose = if files[-1].is_a? String then false else files.pop end
begin
$stderr.print files.join(" "), "\n" if verbose
chmod 0777, *files
@ -129,7 +129,7 @@ class << File
alias rm_f safe_unlink
def makedirs(*dirs)
verbose = if dirs[-1].is_a? String then FALSE else dirs.pop end
verbose = if dirs[-1].is_a? String then false else dirs.pop end
# mode = if dirs[-1].is_a? Fixnum then dirs.pop else 0755 end
mode = 0755
for dir in dirs
@ -146,14 +146,15 @@ class << File
alias o_chmod chmod
def chmod(mode, *files)
verbose = if files[-1].is_a? String then FALSE else files.pop end
verbose = if files[-1].is_a? String then false else files.pop end
$stderr.printf "chmod %04o %s\n", mode, files.join(" ") if verbose
o_chmod mode, *files
end
def install(from, to, mode, verbose)
def install(from, to, mode = nil, verbose = false)
to = catname(from, to)
unless FileTest.exist? to and cmp from, to
unlink to if FileTest.exist? to
cp from, to, verbose
chmod mode, to, verbose if mode
end