
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: 23: def 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 $: 44: end 45: 46: $:.each do |path| 47: if /site_ruby/ =~ path 48: rdoc_path = File.join(path, 'rdoc', 'rdoc.rb') 49: if File.exist?(rdoc_path) 50: adjust_for_existing_rdoc(path) 51: break 52: end 53: end 54: end 55: 56: ## End of Transitional Hack ## 57: 58: 59: require 'rdoc/rdoc' 60: 61: begin 62: r = RDoc::RDoc.new 63: r.document(ARGV) 64: rescue RDoc::RDocError => e 65: $stderr.puts e.message 66: exit(1) 67: end