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
9begin
10  gem 'rdoc'
11rescue NameError => e # --disable-gems
12  raise unless e.name == :gem
13rescue Gem::LoadError
14end
15
16require 'rdoc/rdoc'
17
18begin
19  r = RDoc::RDoc.new
20  r.document ARGV
21rescue Errno::ENOSPC
22  $stderr.puts 'Ran out of space creating documentation'
23  $stderr.puts
24  $stderr.puts 'Please free up some space and try again'
25rescue SystemExit
26  raise
27rescue Exception => e
28  if $DEBUG_RDOC then
29    $stderr.puts e.message
30    $stderr.puts "#{e.backtrace.join "\n\t"}"
31    $stderr.puts
32  elsif Interrupt === e then
33    $stderr.puts
34    $stderr.puts 'Interrupted'
35  else
36    $stderr.puts "uh-oh! RDoc had a problem:"
37    $stderr.puts e.message
38    $stderr.puts
39    $stderr.puts "run with --debug for full backtrace"
40  end
41
42  exit 1
43end
44
45