summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authordave <dave@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-12-01 07:12:49 +0000
committerdave <dave@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-12-01 07:12:49 +0000
commit87762adcb0d38d6c575448f67c2906964215f3a1 (patch)
treec74f6e5b2b51f641cdc7895a37eb4c161b2c6d72 /bin
parentc1c55573bdaecbd972f57b46dd22dfbd0e1a02dd (diff)
Add RDoc
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5073 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'bin')
-rw-r--r--bin/rdoc67
1 files changed, 67 insertions, 0 deletions
diff --git a/bin/rdoc b/bin/rdoc
new file mode 100644
index 0000000..fe61913
--- /dev/null
+++ b/bin/rdoc
@@ -0,0 +1,67 @@
+#!/usr/bin/env ruby
+#
+# RDoc: Documentation tool for source code
+# (see lib/rdoc/rdoc.rb for more information)
+#
+# Copyright (c) 2003 Dave Thomas
+# Released under the same terms as Ruby
+#
+# $Revision$
+
+## Transitional Hack ####
+#
+# RDoc was initially distributed independently, and installed
+# itself into <prefix>/lib/ruby/site_ruby/<ver>/rdoc...
+#
+# Now that RDoc is part of the distribution, it's installed into
+# <prefix>/lib/ruby/<ver>, which unfortunately appears later in the
+# search path. This means that if you have previously installed RDoc,
+# and then install from ruby-lang, you'll pick up the old one by
+# default. This hack checks for the condition, and readjusts the
+# search path if necessary.
+
+def adjust_for_existing_rdoc(path)
+
+ $stderr.puts %{
+ It seems as if you have a previously-installed RDoc in
+ the directory #{path}.
+
+ Because this is now out-of-date, you might want to consider
+ removing the directories:
+
+ #{File.join(path, "rdoc")}
+
+ and
+
+ #{File.join(path, "markup")}
+
+ }
+
+ # Move all the site_ruby directories to the end
+ p $:
+ $:.replace($:.partition {|path| /site_ruby/ !~ path}.flatten)
+ p $:
+end
+
+$:.each do |path|
+ if /site_ruby/ =~ path
+ rdoc_path = File.join(path, 'rdoc', 'rdoc.rb')
+ if File.exists?(rdoc_path)
+ adjust_for_existing_rdoc(path)
+ break
+ end
+ end
+end
+
+## End of Transitional Hack ##
+
+
+require 'rdoc/rdoc'
+
+begin
+ r = RDoc::RDoc.new
+ r.document(ARGV)
+rescue RDoc::RDocError => e
+ $stderr.puts e.message
+ exit(1)
+end