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

ruby-changes:3944

From: ko1@a...
Date: Tue, 12 Feb 2008 10:18:08 +0900 (JST)
Subject: [ruby-changes:3944] drbrain - Ruby:r15434 (trunk): Restore require rubygems check

drbrain	2008-02-12 10:17:39 +0900 (Tue, 12 Feb 2008)

  New Revision: 15434

  Modified files:
    trunk/ChangeLog
    trunk/lib/rdoc/ri/paths.rb

  Log:
    Restore require rubygems check

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=15434&r2=15433&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/lib/rdoc/ri/paths.rb?r1=15434&r2=15433&diff_format=u

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 15433)
+++ ChangeLog	(revision 15434)
@@ -1,3 +1,7 @@
+Tue Feb 12 10:16:47 2008  Eric Hodel  <drbrain@s...>
+
+	* lib/rdoc/ri/paths.rb:  Restore require rubygems check.
+
 Tue Feb 12 02:42:27 2008  Yukihiro Matsumoto  <matz@r...>
 
 	* range.c (range_include): specialize single character string
Index: lib/rdoc/ri/paths.rb
===================================================================
--- lib/rdoc/ri/paths.rb	(revision 15433)
+++ lib/rdoc/ri/paths.rb	(revision 15434)
@@ -42,31 +42,35 @@
   # This is the search path for 'ri'
   PATH = [ SYSDIR, SITEDIR, HOMEDIR ].find_all {|p| p && File.directory?(p)}
 
-  require 'rubygems' unless defined?(Gem) and Gem::Enable
+  begin
+    require 'rubygems' unless defined?(Gem) and Gem::Enable
 
-  # HACK dup'd from Gem.latest_partials and friends
-  all_paths = []
+    # HACK dup'd from Gem.latest_partials and friends
+    all_paths = []
 
-  all_paths = Gem.path.map do |dir|
-    Dir[File.join(dir, 'doc', '*', 'ri')]
-  end.flatten
+    all_paths = Gem.path.map do |dir|
+      Dir[File.join(dir, 'doc', '*', 'ri')]
+    end.flatten
 
-  ri_paths = {}
+    ri_paths = {}
 
-  all_paths.each do |dir|
-    base = File.basename File.dirname(dir)
-    if base =~ /(.*)-((\d+\.)*\d+)/ then
-      name, version = $1, $2
-      ver = Gem::Version.new version
-      if ri_paths[name].nil? or ver > ri_paths[name][0] then
-        ri_paths[name] = [ver, dir]
+    all_paths.each do |dir|
+      base = File.basename File.dirname(dir)
+      if base =~ /(.*)-((\d+\.)*\d+)/ then
+        name, version = $1, $2
+        ver = Gem::Version.new version
+        if ri_paths[name].nil? or ver > ri_paths[name][0] then
+          ri_paths[name] = [ver, dir]
+        end
       end
     end
+
+    GEMDIRS = ri_paths.map { |k,v| v.last }.sort
+    GEMDIRS.each { |dir| PATH << dir }
+  rescue LoadError
+    GEMDIRS = []
   end
 
-  GEMDIRS = ri_paths.map { |k,v| v.last }.sort
-  GEMDIRS.each { |dir| PATH << dir }
-
   # Returns the selected documentation directories as an Array, or PATH if no
   # overriding directories were given.
 

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

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