PageRenderTime 218ms CodeModel.GetById 215ms app.highlight 0ms RepoModel.GetById 1ms app.codeStats 0ms

/tools/Ruby/bin/rdoc

http://github.com/agross/netopenspace
Ruby | 67 lines | 29 code | 14 blank | 24 comment | 3 complexity | 60eea4b90696d1fb926e4d3c29d9f09d MD5 | raw file
 1#!/usr/bin/env ruby
 2#
 3#  RDoc: Documentation tool for source code
 4#        (see lib/rdoc/rdoc.rb for more information)
 5#
 6#  Copyright (c) 2003 Dave Thomas
 7#  Released under the same terms as Ruby
 8#
 9#  $Revision: 11708 $
10
11## Transitional Hack ####
12#
13#  RDoc was initially distributed independently, and installed
14#  itself into <prefix>/lib/ruby/site_ruby/<ver>/rdoc...
15#
16#  Now that RDoc is part of the distribution, it's installed into
17#  <prefix>/lib/ruby/<ver>, which unfortunately appears later in the
18#  search path. This means that if you have previously installed RDoc,
19#  and then install from ruby-lang, you'll pick up the old one by
20#  default. This hack checks for the condition, and readjusts the
21#  search path if necessary.
22
23def adjust_for_existing_rdoc(path)
24  
25  $stderr.puts %{
26  It seems as if you have a previously-installed RDoc in
27  the directory #{path}.
28
29  Because this is now out-of-date, you might want to consider
30  removing the directories:
31
32    #{File.join(path, "rdoc")}
33
34  and
35
36    #{File.join(path, "markup")}
37
38  }
39
40  # Move all the site_ruby directories to the end
41  p $:
42  $:.replace($:.partition {|path| /site_ruby/ !~ path}.flatten)
43  p $:
44end
45
46$:.each do |path|
47  if /site_ruby/ =~ path 
48    rdoc_path = File.join(path, 'rdoc', 'rdoc.rb')
49    if File.exists?(rdoc_path)
50      adjust_for_existing_rdoc(path)
51      break
52    end
53  end
54end
55
56## End of Transitional Hack ##
57
58
59require 'rdoc/rdoc'
60
61begin
62  r = RDoc::RDoc.new
63  r.document(ARGV)
64rescue RDoc::RDocError => e
65  $stderr.puts e.message
66  exit(1)
67end