def run_rdoc(*args)
args << @spec.rdoc_options
args << DocManager.configured_args
args << '--quiet'
args << @spec.require_paths.clone
args << @spec.extra_rdoc_files
args.flatten!
r = RDoc::RDoc.new
old_pwd = Dir.pwd
Dir.chdir(@spec.full_gem_path)
begin
r.document args
rescue Errno::EACCES => e
dirname = File.dirname e.message.split("-")[1].strip
raise Gem::FilePermissionError.new(dirname)
rescue RuntimeError => ex
STDERR.puts "While generating documentation for #{@spec.full_name}"
STDERR.puts "... MESSAGE: #{ex}"
STDERR.puts "... RDOC args: #{args.join(' ')}"
STDERR.puts ex.backtrace if Gem.configuration.backtrace
STDERR.puts "(continuing with the rest of the installation)"
ensure
Dir.chdir(old_pwd)
end
end