    # File lib/rubygems/installer.rb, line 104
      def install
        # If we're forcing the install then disable security unless the security
        # policy says that we only install singed gems.
        @security_policy = nil if @force and @security_policy and
                                  not @security_policy.only_signed

        unless @force then
          if rrv = @spec.required_ruby_version then
            unless rrv.satisfied_by? Gem.ruby_version then
              raise Gem::InstallError, "#{@spec.name} requires Ruby version #{rrv}"
            end
          end

          if rrgv = @spec.required_rubygems_version then
            unless rrgv.satisfied_by? Gem::Version.new(Gem::RubyGemsVersion) then
              raise Gem::InstallError,
                    "#{@spec.name} requires RubyGems version #{rrgv}"
            end
          end

          unless @ignore_dependencies then
            deps = @spec.runtime_dependencies
            deps |= @spec.development_dependencies if @development

            deps.each do |dep_gem|
              ensure_dependency @spec, dep_gem
            end
          end
        end

        FileUtils.mkdir_p @gem_home unless File.directory? @gem_home
        raise Gem::FilePermissionError, @gem_home unless File.writable? @gem_home

        Gem.ensure_gem_subdirectories @gem_home

        FileUtils.mkdir_p @gem_dir

        extract_files
        generate_bin
        build_extensions
        write_spec

        write_require_paths_file_if_needed

        # HACK remove?  Isn't this done in multiple places?
        cached_gem = File.join @gem_home, "cache", @gem.split(/\//).pop
        unless File.exist? cached_gem then
          FileUtils.cp @gem, File.join(@gem_home, "cache")
        end

        say @spec.post_install_message unless @spec.post_install_message.nil?

        @spec.loaded_from = File.join(@gem_home, 'specifications',
                                      "#{@spec.full_name}.gemspec")

        Gem.source_index.add_spec @spec

        return @spec
      rescue Zlib::GzipFile::Error
        raise Gem::InstallError, "gzip error installing #{@gem}"
      end