Граф коммитов

121 Коммитов

Автор SHA1 Сообщение Дата
nobu 4b5267018a fileutils.rb: fix traversal loop
* lib/fileutils.rb (FileUtils#rmdir): fix traversal loop, not trying
  remove same directory only.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41283 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-13 13:12:35 +00:00
kazu 1739ecda3b FileUtils.rmdir use remove_tailing_slash
* lib/fileutils.rb (FileUtils.rmdir): use remove_tailing_slash.
* test/fileutils/test_fileutils.rb: test for above.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41052 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-03 15:01:42 +00:00
ayumin cef3f2ebd4 * lib/fileutils.rb: fix behavior when mkdir/mkdir_p accepted "/".
* test/fileutils/test_fileutils.rb: add test for above change.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41047 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-03 14:20:15 +00:00
drbrain 874f8c0494 * lib/fileutils.rb: Revert r34669 which altered the way
metaprogramming in FileUtils occurred.  [ruby-trunk - Bug #7958]

* test/fileutils/visibility_tests.rb:  Refactored tests of FileUtils
  options modules to expose bug found in #7958
* test/fileutils/test_dryrun.rb:  ditto.
* test/fileutils/test_nowrite.rb:  ditto.
* test/fileutils/test_verbose.rb:  ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39544 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-01 02:09:42 +00:00
mame 7dc77be299 * lib/fileutils.rb (copy_entry, wrap_traverse): preserve attributes of
directories on FileUtils.cp_r.  The fix was proposed by Jan
  Wedekind.  [Bug #7246]

* test/fileutils/test_fileutils.rb: add a test for above.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39015 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-02 03:54:00 +00:00
mame 4077b9b89d * lib/fileutils.rb: chmod/chmod_R with a string mode (e.g., "+x")
caused error in verbose mode.

* test/fileutils/test_fileutils.rb: add a test for above.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39011 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-02 03:07:17 +00:00
zzak c8b0b5362c * lib/fileutils.rb (chmod): Add "X" to modes, convert format to table
[ruby-core:48965] [Bug #7288]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37652 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-14 04:26:20 +00:00
glass 2142287c86 * lib/fileutils.rb (module FileUtils): repatch [ruby-core:39622]
[Feature #5337]. improve performance of FileUtils.compare_stream.
  [ruby-core:47545] [Feature #7028]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37465 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-04 02:56:11 +00:00
ayumin 6eb316780f * lib/fileutils.rb: fix typo.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36727 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-18 15:55:15 +00:00
ayumin e6021a1be2 * lib/fileutils.rb (uptodate?): remove useless parameter.
patched by Oscar Del Ben.[Bug #6708][ruby-core:46256]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36400 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-16 08:15:05 +00:00
drbrain dfa9522c33 * lib/fileutils.rb (cp_r): Fixed cp_r example. Patch by TJ Koblentz
from pull request #114.  [ruby-trunk - Bug #6410]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35626 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-11 21:02:58 +00:00
akr 7d89ecdc52 * lib/fileutils.rb (copy_metadata): use File.lchown and File.lchmod to
update meta data of symlinks.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35499 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-30 14:37:54 +00:00
akr 5e3009aa45 * lib/fileutils.rb (fu_have_symlink?): specify TypeError for rescue
clause.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34987 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-12 11:09:11 +00:00
nobu 1100fdfc65 * lib/fileutils.rb: remove tailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34975 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-11 21:48:45 +00:00
naruse 9a93699a49 * lib/fileutils.rb: use chomp(?/) instead of sub to optimize and avoid
to regexping invalid string.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34809 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-25 08:08:55 +00:00
shirosaki 5cfba33a77 * lib/fileutils.rb: revert a line modified accidentally at r34669.
This fixes mingw test errors in TestDir_M17N.
  [ruby-core:42728] [Feature #4970]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34706 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-20 12:30:11 +00:00
tenderlove ace46301d8 * lib/fileutils.rb: refactored FileUtil methods to use the
`define_command` API.  Patch from 7rans <transfire@gmail.com>
* test/fileutils/test_dryrun.rb: corresponding test refactoring
* test/fileutils/test_nowrite.rb: ditto
* test/fileutils/test_verbose.rb: ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34669 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-17 17:59:47 +00:00
nobu 6a6c314fd0 * lib/fileutils.rb (FileUtils::Entry_#entries): use utility method
instead of typoed regexp.  [ruby-core:41829] [Bug #5817]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34146 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-28 02:22:52 +00:00
ayumin 6ec841b2df * lib/fileutils.rb (module FileUtils): improve performance of
FileUtils.compare_stream. a patch by Masaki Matsushita.
  [Feature #5337] [ruby-core:39622]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33297 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-09-19 10:34:30 +00:00
drbrain 55aa4dce3b * lib/fileutils.rb: Document block behavior of FileUtils.cd. Patch by
Bil Kleb.  [Ruby 1.9 - Bug 4751]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31684 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-22 02:12:15 +00:00
drbrain 57580b76e8 * lib/fileutils.rb: Hide internal methods from RDoc. Patch by Darragh
Curran.  [Ruby 1.9 - Bug #4684]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31541 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-12 22:49:40 +00:00
kosaki 0a1e7d1568 * lib/fileutils.rb (FileUtils#chmod): accept symbolic mode argument.
The patch was written by takkanm. [ruby-core:26029][Feature #2190]

* lib/fileutils.rb (FileUtils#fu_mode): new helper function.
* lib/fileutils.rb (FileUtils#symbolic_modes_to_i): ditto.
* lib/fileutils.rb (FileUtils#mode_mask): ditto.
* lib/fileutils.rb (FileUtils#user_mask): ditto.

* test/fileutils/test_fileutils.rb (TestFileUtils#test_chmod_symbol_mode):
  new test for the above symbolic mode.
* test/fileutils/test_fileutils.rb (TestFileUtils#test_chmod_R): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31407 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-01 16:16:05 +00:00
knu 6692ef3c54 * lib/fileutils.rb (FileUtils#touch): Fix corrupted output when
:mtime is specified in addition to :nocreate (and :verbose).
  ref [ruby-dev:43401]




git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31287 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-04-15 06:05:25 +00:00
kosaki 8c5961f6f9 * lib/fileutils.rb (FileUtils#touch): fix corrupted output when
FileUtils.touch(:nocreate => true, :verbose => true) case.
  The patch was written by Hiroyuki Iwatsuki. [ruby-dev:43401]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31273 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-04-14 10:58:10 +00:00
nobu c7837ed8d3 * lib/fileutils.rb (FileUtils::Entry_#copy_file): updated FileUtils.cp
to still copy file permissions when :preserve is false (as cp does
  this even when -p isn't set).

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31123 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-03-17 23:48:13 +00:00
shyouhei c1afbd39e1 * lib/fileutils.rb (FileUtils::remove_entry_secure): there is a
race condition in the case where the given path is a directory,
  and some other user can move that directory, and create a
  symlink while this method is executing.
  Reported by: Nicholas Jefferson <nicholas at pythonic.com.au>


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30896 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-02-18 10:42:50 +00:00
nobu 780678dafb * lib/fileutils.rb (FileUtils::LowMethods): make low level methods
in NoWrite and DryRun to do nothing.  [ruby-dev:43129]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30787 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-02-04 18:37:52 +00:00
nobu 878384483d * lib/fileutils.rb (FileUtils::Entry_#copy): check file name
spearator boundary.  [ruby-core:31360]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28685 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-20 03:27:59 +00:00
marcandre 4349da9c1b * lib/fileutils.rb: Fix warning
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28382 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-06-22 05:46:01 +00:00
usa fef3c0a415 * lib/fileutils.rb (FileUtils::Entry_#entries): returns pathname in
UTF-8 on Windows to allow FileUtils accessing all pathnames
  internally.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27856 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-17 00:41:56 +00:00
shyouhei 50fa45fb89 * lib/fileutils.rb (FileUtils::cp_r): dup needed here; options are
destroyed otherwise.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27400 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-19 10:46:48 +00:00
nobu 3a2f5d9cf7 * lib/fileutils.rb (fu_each_src_dest): ensure src is accessible.
* lib/fileutils.rb (fu_same): use File.identical? to get rid of
  exceptions.  [ruby-core:28141]

* lib/fileutils.rb (fu_have_st_ino): no longer used.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27317 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-12 00:19:52 +00:00
nobu a3dde7df52 * lib/fileutils.rb (fu_have_st_ino): check if required method is
defined, instead of platform name.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27316 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-12 00:18:55 +00:00
knu da54a4589a * lib/fileutils.rb (FileUtils#fu_get_uid, fu_get_gid): Do not
convert an integer back and forth.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25433 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-22 08:51:40 +00:00
nobu ee647e1b96 * lib/fileutils.rb (FileUtils::Entry_#copy_file): open the source
file first to ensure it can be copied.  [ruby-core:25498]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24823 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-09 13:02:04 +00:00
nobu a02b33742c * lib/fileutils.rb (FileUtils::Entry_#copy_file): open with
default umask.  [ruby-core:23952]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23774 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-21 01:47:25 +00:00
matz 70e504b34e * lib/fileutils.rb (FileUtils#fu_get_gid): stringify group
argument before making regexp match.  [ruby-dev:38155]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22940 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-13 22:42:16 +00:00
nobu 287a34ae0d * {ext,lib,test}/**/*.rb: removed trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-06 03:56:38 +00:00
nobu bcf6fd2c86 * lib/fileutils.rb (mv): added description for the case of
different partitions.  [ruby-talk:329072]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22567 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-23 05:47:06 +00:00
nobu 97de7d1081 * Makefile.in, win32/Makefile.sub (RMDIRS): remove directory and
parents.

* Makefile.in, win32/Makefile.sub (distclean-rdoc): added to remove
  temprary rdoc.

* Makefile.in, win32/Makefile.sub (distclean): removes extout
  directory.

* Makefile.in, win32/Makefile.sub (clean-ext): skips non-existent
  directories.

* common.mk (clean, distclean): cleans rdoc.

* configure.in (RMDIRS, RMALL): added to clean extout.

* lib/fileutils.rb (FileUtils#rmdir): added :parents option.

* lib/mkmf.rb (create_makefile): cleans installed files at clean
  instead of distclean.

* lib/mkmf.rb (create_makefile): added clean-so and clean-rb.

* lib/mkmf.rb (def init_mkmf): added DISTCLEANDIRS.

* lib/un.rb (rmdir): added -p option.

* tool/rmdirs, win32/rmdirs.bat: removes directory and the parents.

* win32/rm.bat: added -r option.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21764 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-25 02:06:29 +00:00
yugui a8c3540b32 * dln.c: Ruby no longer supports Windows CE.
* eval.c: ditto.

* include/ruby/defines.h: ditto.

* include/ruby/win32.h: ditto.

* ruby.c: ditto.

* strftime.c: ditto.

* win32/Makefile.sub: ditto.

* win32/win32.c: ditto.

* ext/tk/extconf.rb: ditto.

* lib/fileutils.rb: ditto.

* test/fileutils/test_fileutils.rb: ditto.

* wince/*: removed.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19681 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-04 13:48:20 +00:00
yugui 8dd118c0db * djgpp/GNUmakefile.in: removed. Ruby no longer supports djgpp.
* djgpp/README.djgpp: ditto.

* djgpp/config.hin: ditto.

* djgpp/config.sed: ditto.

* djgpp/configure.bat: ditto.

* djgpp/mkver.sed: ditto.

* ext/Setup.dj: ditto.

* dln.c: removed djgpp supports.

* file.c: ditto.

* gc.c: ditto.

* io.c: ditto.

* process.c: ditto.

* ruby.c: ditto.

* signal.c: ditto.

* util.c: ditto.

* vm_core.h: ditto.

* lib/fileutils.rb: ditto.

* lib/mkmf.rb: ditto.

* ext/socket/socket.c: ditto.

* test/fileutils/test_fileutils.rb: ditto.

* test/ruby/test_env.rb: ditto.

* test/ruby/test_path.rb: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19678 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-04 13:25:12 +00:00
nobu a107e1e998 * lib/fileutils.rb (copy_stream, fu_copy_stream0, copy_file): use
IO.copy_stream to get rid of extraneous conversion.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19009 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-01 02:31:56 +00:00
matz 9a46ab6b62 * lib/fileutils.rb (FileUtils::Entry_::copy): prevent self copy of
directories.

* lib/fileutils.rb (FileUtils::fu_each_src_dest0): use try_convert.

* lib/fileutils.rb (FileUtils::fu_update_option): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13350 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-09-06 13:59:37 +00:00
nobu 9b7ecc68a9 * file.c (rb_stat_s_utime): fixed a commit miss for the platforms
where utimes() does not exist.

* lib/fileutils.rb (touch): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11985 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-03-04 14:38:02 +00:00
aamine 738bf0e8a4 * lib/fileutils.rb (touch): last #touch change causes error when :mtime option was not given.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11975 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-03-03 13:54:54 +00:00
aamine e089d1161d * lib/fileutils.rb (mv): could not move directory between different file systems. [ruby-dev:30411]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11974 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-03-03 13:53:38 +00:00
nobu 15dabe8216 * file.c (rb_file_s_utime): allow nil to set the current time.
* lib/fileutils.rb (touch): ditto, and added :mtime and :nocreate
  options.  fixed: [ruby-talk:219037]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11973 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-03-03 13:37:02 +00:00
nobu 88d6c083ea * ext/extmk.rb, lib/fileutils.rb, lib/mkmf.rb, lib/optparse.rb,
lib/shellwords.rb: get rid of shadowing outer local variable.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11112 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-10-09 14:41:24 +00:00
matz 803591e900 * string.c (sym_eql): fail early to gain performance.
* string.c (sym_hash): cache hash value in aux.shared if possible.

* gc.c (rb_obj_id): no need to treat symbols specially.

* lib/fileutils.rb (FileUtils::FileUtils): singleton_methods() no
  longer return an array of strings, but of symbols.

* lib/delegate.rb (DelegateClass): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10971 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-09-20 04:18:25 +00:00