install_rdoc (Gem::Commands::SetupCommand)

    # File lib/rubygems/commands/setup_command.rb, line 233
      def install_rdoc
        gem_doc_dir = File.join Gem.dir, 'doc'
        rubygems_name = "rubygems-#{Gem::RubyGemsVersion}"
        rubygems_doc_dir = File.join gem_doc_dir, rubygems_name

        if File.writable? gem_doc_dir and
           (not File.exist? rubygems_doc_dir or
            File.writable? rubygems_doc_dir) then
          say "Removing old RubyGems RDoc and ri" if @verbose
          Dir[File.join(Gem.dir, 'doc', 'rubygems-[0-9]*')].each do |dir|
            rm_rf dir
          end

          if options[:ri] then
            ri_dir = File.join rubygems_doc_dir, 'ri'
            say "Installing #{rubygems_name} ri into #{ri_dir}" if @verbose
            run_rdoc '--ri', '--op', ri_dir
          end

          if options[:rdoc] then
            rdoc_dir = File.join rubygems_doc_dir, 'rdoc'
            say "Installing #{rubygems_name} rdoc into #{rdoc_dir}" if @verbose
            run_rdoc '--op', rdoc_dir
          end
        elsif @verbose then
          say "Skipping RDoc generation, #{gem_doc_dir} not writable"
          say "Set the GEM_HOME environment variable if you want RDoc generated"
        end
      end