diff -Naur a/bin/fastri-server b/bin/fastri-server --- a/bin/fastri-server 2008-02-02 09:50:24.000000000 -0700 +++ b/bin/fastri-server 2009-07-06 16:58:33.000000000 -0600 @@ -17,7 +17,7 @@ # will be able to use it with $SAFE = 1. ObjectSpace.each_object{|obj| obj.untaint unless obj.frozen? } - paths = [ RI::Paths::SYSDIR, RI::Paths::SITEDIR, RI::Paths::HOMEDIR ].find_all do |p| + paths = [ ::RDoc::RI::Paths::SYSDIR, ::RDoc::RI::Paths::SITEDIR, ::RDoc::RI::Paths::HOMEDIR ].find_all do |p| p && File.directory?(p) end FastRI::Util.gem_directories_unique.each do |name, version, path| diff -Naur a/lib/fastri/ri_index.rb b/lib/fastri/ri_index.rb --- a/lib/fastri/ri_index.rb 2008-02-02 09:50:24.000000000 -0700 +++ b/lib/fastri/ri_index.rb 2009-07-06 16:53:40.000000000 -0600 @@ -1,9 +1,9 @@ # Copyright (C) 2006 Mauricio Fernandez # -require 'rdoc/ri/ri_cache' -require 'rdoc/ri/ri_reader' -require 'rdoc/ri/ri_descriptions' +require 'rdoc/ri/cache' +require 'rdoc/ri/reader' +require 'rdoc/ri/descriptions' require 'fastri/version' @@ -53,7 +53,7 @@ # Redefine RI::MethodEntry#full_name to use the following notation: # Namespace::Foo.singleton_method (instead of ::). RiIndex depends on this to # tell singleton methods apart. - class ::RI::MethodEntry # :nodoc: + class RDoc::RI::MethodEntry # :nodoc: remove_method :full_name def full_name res = @in_class.full_name @@ -95,12 +95,12 @@ # but RI doesn't support merging at the method-level, so path = @ri_index.source_paths_for(self).first File.join(File.join(path, *prefix), - RI::RiWriter.internal_to_external(@name) + + ::RDoc::RI::Writer.internal_to_external(@name) + (singleton_method? ? "-c" : "-i" ) + ".yaml") else path = @ri_index.paths[@source_index] File.join(File.join(path, *prefix), - RI::RiWriter.internal_to_external(@name) + + ::RDoc::RI::Writer.internal_to_external(@name) + (singleton_method? ? "-c" : "-i" ) + ".yaml") end end @@ -234,7 +234,7 @@ methods = Hash.new{|h,k| h[k] = []} namespaces = methods.clone @paths.each_with_index do |path, source_index| - ri_reader = RI::RiReader.new(RI::RiCache.new(path)) + ri_reader = ::RDoc::RI::Reader.new(::RDoc::RI::Cache.new(path.split("\n"))) obtain_classes(ri_reader.top_level_namespace.first).each{|name| namespaces[name] << source_index } obtain_methods(ri_reader.top_level_namespace.first).each{|name| methods[name] << source_index } end @@ -343,7 +343,7 @@ # by deserializing the YAML. def get_method(method_entry) path = method_entry.path_name - File.open(path) { |f| RI::Description.deserialize(f) } + File.open(path) { |f| ::RDoc::RI::Description.deserialize(f) } end # Return a ClassDescription for a given ClassEntry. diff -Naur a/lib/fastri/ri_service.rb b/lib/fastri/ri_service.rb --- a/lib/fastri/ri_service.rb 2008-02-02 09:50:24.000000000 -0700 +++ b/lib/fastri/ri_service.rb 2009-07-06 11:55:50.000000000 -0600 @@ -2,10 +2,10 @@ # # Inspired by ri-emacs.rb by Kristof Bastiaensen -require 'rdoc/ri/ri_paths' -require 'rdoc/ri/ri_util' -require 'rdoc/ri/ri_formatter' -require 'rdoc/ri/ri_display' +require 'rdoc/ri/paths' +require 'rdoc/ri/util' +require 'rdoc/ri/formatter' +require 'rdoc/ri/display' require 'fastri/ri_index.rb' require 'fastri/name_descriptor' @@ -13,6 +13,8 @@ module FastRI +class RiError < Exception; end + class ::DefaultDisplay def full_params(method) method.params.split(/\n/).each do |p| @@ -26,7 +28,7 @@ end end -class StringRedirectedDisplay < ::DefaultDisplay +class StringRedirectedDisplay < ::RDoc::RI::DefaultDisplay attr_reader :stringio, :formatter def initialize(*args) super(*args) @@ -47,7 +49,7 @@ end end -class ::RI::TextFormatter +class ::RDoc::RI::TextFormatter def puts(*a); @stringio.puts(*a) end def print(*a); @stringio.print(*a) end end @@ -60,11 +62,11 @@ end end -class RedirectedAnsiFormatter < RI::AnsiFormatter +class RedirectedAnsiFormatter < ::RDoc::RI::AnsiFormatter include FormatterRedirection end -class RedirectedTextFormatter < RI::TextFormatter +class RedirectedTextFormatter < ::RDoc::RI::TextFormatter include FormatterRedirection end @@ -415,7 +417,7 @@ options.formatter = RedirectedTextFormatter end options.width = opt[:width] - StringRedirectedDisplay.new(options) + StringRedirectedDisplay.new(options.formatter, options.width, options.use_stdout) end def capture_stdout(display) diff -Naur a/lib/fastri/util.rb b/lib/fastri/util.rb --- a/lib/fastri/util.rb 2008-02-02 09:50:24.000000000 -0700 +++ b/lib/fastri/util.rb 2009-07-06 08:51:26.000000000 -0600 @@ -35,9 +35,9 @@ # don't let rdoc/ri/ri_paths load rubygems.rb, that takes ~100ms ! emulation = $".all?{|x| /rubygems\.rb$/ !~ x} # 1.9 compatibility $".unshift "rubygems.rb" if emulation -require 'rdoc/ri/ri_paths' +require 'rdoc/ri/paths' $".delete "rubygems.rb" if emulation -require 'rdoc/ri/ri_writer' +require 'rdoc/ri/writer' module FastRI module Util diff -Naur a/test/test_functional_ri_service.rb b/test/test_functional_ri_service.rb --- a/test/test_functional_ri_service.rb 2008-02-02 09:50:24.000000000 -0700 +++ b/test/test_functional_ri_service.rb 2009-07-06 09:50:16.000000000 -0600 @@ -5,7 +5,7 @@ class TestFunctionalRiService < Test::Unit::TestCase # only created once, since it takes a long time - @@ri = FastRI::RiService.new(FastRI::RiIndex.new_from_paths(RI::Paths::PATH)) + @@ri = FastRI::RiService.new(FastRI::RiIndex.new_from_paths(::RDoc::RI::Paths.path(true, true, true, true))) def setup @ri = @@ri end