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

* lib/fileutils.rb: new method FileUtils.pwd (really).

* lib/fileutils.rb: FileUtils.pwd, cmp, identical?, uptodate? does not accept any option.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3467 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
aamine 2003-02-08 22:01:53 +00:00
parent a9da9667d0
commit 9952524a74
2 changed files with 27 additions and 14 deletions

View file

@ -1,3 +1,10 @@
Sun Feb 9 07:07:26 2003 Minero Aoki <aamine@loveruby.net>
* lib/fileutils.rb: new method FileUtils.pwd (really).
* lib/fileutils.rb: FileUtils.pwd, cmp, identical?, uptodate? does
not accept any option.
Sat Feb 8 18:35:30 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
* misc/ruby-mode.el (ruby-forward-string): fixed void variable

View file

@ -60,13 +60,21 @@
#
#
# See exp.rb for a summary of methods.
#
module FileUtils
# All methods are module_function.
#
# Options: (none)
#
# Returns the name of the current directory.
#
def pwd
Dir.pwd
end
alias getwd pwd
#
# Options: noop verbose
#
@ -88,16 +96,15 @@ module FileUtils
#
# Options: verbose
# Options: (none)
#
# Returns true if +newer+ is newer than all +old_list+.
# Non-existent files are older than any file.
#
# FileUtils.uptodate? 'hello.o', 'hello.c', 'hello.h' or system 'make'
# FileUtils.uptodate? 'hello.o', %w(hello.c hello.h) or system 'make'
#
def uptodate?( new, old_list, *options )
verbose, = fu_parseargs(options, :verbose)
fu_output_message "uptodate? #{new} #{old_list.join ' '}" if verbose
raise ArgumentError, 'uptodate? does not accept any option' unless options.empty?
return false unless FileTest.exist? new
new_time = File.ctime(new)
@ -550,7 +557,7 @@ module FileUtils
#
# Options: verbose
# Options: (none)
#
# Returns true if the contents of a file A and a file B are identical.
#
@ -558,8 +565,7 @@ module FileUtils
# FileUtils.cmp '/bin/cp', '/bin/mv' #=> maybe false
#
def cmp( filea, fileb, *options )
verbose, = fu_parseargs(options, :verbose)
fu_output_message "cmp #{filea} #{fileb}" if verbose
raise ArgumentError, 'cmp does not accept any option' unless options.empty?
sa = sb = nil
st = File.stat(filea)
@ -719,15 +725,15 @@ module FileUtils
OPT_TABLE = {
'pwd' => %w( verbose ),
'pwd' => %w(),
'cd' => %w( noop verbose ),
'chdir' => %w( noop verbose ),
'chmod' => %w( noop verbose ),
'cmp' => %w( verbose ),
'cmp' => %w(),
'copy' => %w( preserve noop verbose ),
'cp' => %w( preserve noop verbose ),
'cp_r' => %w( preserve noop verbose ),
'identical?' => %w( verbose ),
'identical?' => %w(),
'install' => %w( noop verbose ),
'link' => %w( force noop verbose ),
'ln' => %w( force noop verbose ),
@ -748,7 +754,7 @@ module FileUtils
'safe_unlink' => %w( noop verbose ),
'symlink' => %w( force noop verbose ),
'touch' => %w( noop verbose ),
'uptodate?' => %w( verbose )
'uptodate?' => %w()
}