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

ruby-changes:12870

From: nobu <ko1@a...>
Date: Fri, 21 Aug 2009 07:26:13 +0900 (JST)
Subject: [ruby-changes:12870] Ruby:r24603 (trunk): * lib/rdoc/ri/gemdirs.rb: split from lib/rdoc/ri/paths.rb to get

nobu	2009-08-21 07:25:52 +0900 (Fri, 21 Aug 2009)

  New Revision: 24603

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

  Log:
    * lib/rdoc/ri/gemdirs.rb: split from lib/rdoc/ri/paths.rb to get
      rid of loading rubygems and searching all gems always.

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

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 24602)
+++ ChangeLog	(revision 24603)
@@ -1,3 +1,15 @@
+Fri Aug 21 07:25:45 2009  Nobuyoshi Nakada  <nobu@r...>
+
+	* lib/rdoc/ri/gemdirs.rb: split from lib/rdoc/ri/paths.rb to ge
+	  rid of loading rubygems and searching all gems always.
+
+Fri Aug 21 07:14:52 2009  Nobuyoshi Nakada  <nobu@r...>
+
+	* configure.in (RUBY_PROGRAM_VERSION, RUBY_RELEASE_DATE): extracts
+	  from version.h for cross-compiling.
+
+	* template/fake.rb.in (RUBY_VERSION, RUBY_DESCRIPTION): use above.
+
 Fri Aug 21 00:08:01 2009  Nobuyoshi Nakada  <nobu@r...>
 
 	* lib/rdoc/ri/paths.rb (RDoc::RI::Paths): Gem::Enable has been obsolete.
Index: lib/rdoc/ri/paths.rb
===================================================================
--- lib/rdoc/ri/paths.rb	(revision 24602)
+++ lib/rdoc/ri/paths.rb	(revision 24603)
@@ -51,34 +51,8 @@
   SITEDIR = File.join(base, "site")
   HOMEDIR = (File.expand_path("~/.#{rdoc}") rescue nil)
 
-  begin
-    require 'rubygems' unless defined?(Gem)
+  autoload(:GEMDIRS, File.expand_path('../gemdirs.rb', __FILE__))
 
-    # 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
-
-    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]
-        end
-      end
-    end
-
-    GEMDIRS = ri_paths.map { |k,v| v.last }.sort
-  rescue LoadError
-    GEMDIRS = []
-  end
-
   # Returns the selected documentation directories as an Array, or PATH if no
   # overriding directories were given.
 
Index: lib/rdoc/ri/gemdirs.rb
===================================================================
--- lib/rdoc/ri/gemdirs.rb	(revision 0)
+++ lib/rdoc/ri/gemdirs.rb	(revision 24603)
@@ -0,0 +1,28 @@
+module RDoc::RI::Paths
+  begin
+    require 'rubygems' unless defined?(Gem)
+
+    # 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
+
+    ri_paths = {}
+
+    all_paths.each do |dir|
+      if %r"/([^/]*)-((?:\d+\.)*\d+)/ri\z" =~ dir
+        name, version = $1, $2
+        ver = Gem::Version.new(version)
+        if !ri_paths[name] or ver > ri_paths[name][0]
+          ri_paths[name] = [ver, dir]
+        end
+      end
+    end
+
+    GEMDIRS = ri_paths.map { |k,v| v.last }.sort
+  rescue LoadError
+    GEMDIRS = []
+  end
+end

Property changes on: lib/rdoc/ri/gemdirs.rb
___________________________________________________________________
Name: svn:eol-style
   + LF
Name: svn:keywords
   + Author Id Revision


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

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