зеркало из https://github.com/github/ruby.git
* lib/fileutils.rb: Don't need to define fu_get_gid and fu_get_gid in
rescue LoadError on 'etc'. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45743 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
cce5fe1ae5
Коммит
17a4a9b993
|
@ -1,3 +1,8 @@
|
|||
Tue Apr 29 12:50:02 2014 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* 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@callcc.net>
|
||||
|
||||
* parse.y (symbols_i): like r45492, call rb_gc_resurrect().
|
||||
|
|
|
@ -1097,47 +1097,35 @@ module FileUtils
|
|||
|
||||
begin
|
||||
require 'etc'
|
||||
|
||||
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
|
||||
end
|
||||
private_module_function :fu_get_uid
|
||||
|
||||
def fu_get_gid(group) #:nodoc:
|
||||
group # FIXME
|
||||
end
|
||||
private_module_function :fu_get_gid
|
||||
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
|
||||
|
||||
#
|
||||
# Options: noop verbose
|
||||
#
|
||||
|
|
Загрузка…
Ссылка в новой задаче