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

ruby-changes:33662

From: akr <ko1@a...>
Date: Tue, 29 Apr 2014 12:51:17 +0900 (JST)
Subject: [ruby-changes:33662] akr:r45743 (trunk): * lib/fileutils.rb: Don't need to define fu_get_gid and fu_get_gid in

akr	2014-04-29 12:51:13 +0900 (Tue, 29 Apr 2014)

  New Revision: 45743

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=45743

  Log:
    * lib/fileutils.rb: Don't need to define fu_get_gid and fu_get_gid in
      rescue LoadError on 'etc'.

  Modified files:
    trunk/ChangeLog
    trunk/lib/fileutils.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 45742)
+++ ChangeLog	(revision 45743)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Tue Apr 29 12:50:02 2014  Tanaka Akira  <akr@f...>
+
+	* lib/fileutils.rb: Don't need to define fu_get_gid and fu_get_gid in
+	  rescue LoadError on 'etc'.
+
 Tue Apr 29 10:21:38 2014  Kazuki Tsujimoto  <kazuki@c...>
 
 	* parse.y (symbols_i): like r45492, call rb_gc_resurrect().
Index: lib/fileutils.rb
===================================================================
--- lib/fileutils.rb	(revision 45742)
+++ lib/fileutils.rb	(revision 45743)
@@ -1097,46 +1097,34 @@ module FileUtils https://github.com/ruby/ruby/blob/trunk/lib/fileutils.rb#L1097
 
   begin
     require 'etc'
+  rescue LoadError # rescue LoadError for miniruby
+  end
 
-    def fu_get_uid(user)   #:nodoc:
-      return nil unless user
-      case user
-      when Integer
-        user
-      when /\A\d+\z/
-        user.to_i
-      else
-        Etc.getpwnam(user) ? Etc.getpwnam(user).uid : nil
-      end
-    end
-    private_module_function :fu_get_uid
-
-    def fu_get_gid(group)   #:nodoc:
-      return nil unless group
-      case group
-      when Integer
-        group
-      when /\A\d+\z/
-        group.to_i
-      else
-        Etc.getgrnam(group) ? Etc.getgrnam(group).gid : nil
-      end
-    end
-    private_module_function :fu_get_gid
-
-  rescue LoadError
-    # need Win32 support???
-
-    def fu_get_uid(user)   #:nodoc:
-      user    # FIXME
+  def fu_get_uid(user)   #:nodoc:
+    return nil unless user
+    case user
+    when Integer
+      user
+    when /\A\d+\z/
+      user.to_i
+    else
+      Etc.getpwnam(user) ? Etc.getpwnam(user).uid : nil
     end
-    private_module_function :fu_get_uid
+  end
+  private_module_function :fu_get_uid
 
-    def fu_get_gid(group)   #:nodoc:
-      group   # FIXME
+  def fu_get_gid(group)   #:nodoc:
+    return nil unless group
+    case group
+    when Integer
+      group
+    when /\A\d+\z/
+      group.to_i
+    else
+      Etc.getgrnam(group) ? Etc.getgrnam(group).gid : nil
     end
-    private_module_function :fu_get_gid
   end
+  private_module_function :fu_get_gid
 
   #
   # Options: noop verbose

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

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