[前][次][番号順一覧][スレッド一覧]

ruby-changes:55138

From: hsbt <ko1@a...>
Date: Wed, 27 Mar 2019 17:26:18 +0900 (JST)
Subject: [ruby-changes:55138] hsbt:r67345 (trunk): Merge fileutils-1.2.0 from ruby/fileutils.

hsbt	2019-03-27 17:26:09 +0900 (Wed, 27 Mar 2019)

  New Revision: 67345

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=67345

  Log:
    Merge fileutils-1.2.0 from ruby/fileutils.
    
      It includes the following updates:
    
      * https://github.com/ruby/fileutils/pull/26
      * https://github.com/ruby/fileutils/pull/27
      * https://github.com/ruby/fileutils/pull/29
      * https://github.com/ruby/fileutils/pull/34

  Modified files:
    trunk/lib/fileutils/fileutils.gemspec
    trunk/lib/fileutils.rb
Index: lib/fileutils.rb
===================================================================
--- lib/fileutils.rb	(revision 67344)
+++ lib/fileutils.rb	(revision 67345)
@@ -114,12 +114,14 @@ module FileUtils https://github.com/ruby/ruby/blob/trunk/lib/fileutils.rb#L114
   #
   # Changes the current directory to the directory +dir+.
   #
-  # If this method is called with block, resumes to the old
-  # working directory after the block execution finished.
+  # If this method is called with block, resumes to the previous
+  # working directory after the block execution has finished.
   #
-  #   FileUtils.cd('/', :verbose => true)   # chdir and report it
+  #   FileUtils.cd('/')  # change directory
   #
-  #   FileUtils.cd('/') do  # chdir
+  #   FileUtils.cd('/', :verbose => true)   # change directory and report it
+  #
+  #   FileUtils.cd('/') do  # change directory
   #     # ...               # do something
   #   end                   # return to original directory
   #
@@ -1080,11 +1082,6 @@ module FileUtils https://github.com/ruby/ruby/blob/trunk/lib/fileutils.rb#L1082
   end
   module_function :chown_R
 
-  begin
-    require 'etc'
-  rescue LoadError # rescue LoadError for miniruby
-  end
-
   def fu_get_uid(user)   #:nodoc:
     return nil unless user
     case user
@@ -1093,6 +1090,7 @@ module FileUtils https://github.com/ruby/ruby/blob/trunk/lib/fileutils.rb#L1090
     when /\A\d+\z/
       user.to_i
     else
+      require 'etc'
       Etc.getpwnam(user) ? Etc.getpwnam(user).uid : nil
     end
   end
@@ -1106,6 +1104,7 @@ module FileUtils https://github.com/ruby/ruby/blob/trunk/lib/fileutils.rb#L1104
     when /\A\d+\z/
       group.to_i
     else
+      require 'etc'
       Etc.getgrnam(group) ? Etc.getgrnam(group).gid : nil
     end
   end
@@ -1275,8 +1274,15 @@ module FileUtils https://github.com/ruby/ruby/blob/trunk/lib/fileutils.rb#L1274
     def entries
       opts = {}
       opts[:encoding] = ::Encoding::UTF_8 if fu_windows?
-      Dir.children(path, opts)\
-          .map {|n| Entry_.new(prefix(), join(rel(), n.untaint)) }
+
+      files = if Dir.respond_to?(:children)
+        Dir.children(path, opts)
+      else
+        Dir.entries(path(), opts)
+           .reject {|n| n == '.' or n == '..' }
+      end
+
+      files.map {|n| Entry_.new(prefix(), join(rel(), n.untaint)) }
     end
 
     def stat
Index: lib/fileutils/fileutils.gemspec
===================================================================
--- lib/fileutils/fileutils.gemspec	(revision 67344)
+++ lib/fileutils/fileutils.gemspec	(revision 67345)
@@ -14,7 +14,7 @@ Gem::Specification.new do |s| https://github.com/ruby/ruby/blob/trunk/lib/fileutils/fileutils.gemspec#L14
   s.description = "Several file utility methods for copying, moving, removing, etc."
 
   s.require_path = %w{lib}
-  s.files = [".gitignore", ".travis.yml", "Gemfile", "LICENSE.txt", "README.md", "Rakefile", "bin/console", "bin/setup", "fileutils.gemspec", "lib/fileutils.rb", "lib/fileutils/version.rb"]
+  s.files = ["LICENSE.txt", "README.md", "Rakefile", "fileutils.gemspec", "lib/fileutils.rb", "lib/fileutils/version.rb"]
   s.required_ruby_version = ">= 2.3.0"
 
   s.authors = ["Minero Aoki"]

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]