# File lib/gem_plugin.rb, line 108
    def load(needs = {})
      gems = Gem::SourceIndex.from_installed_gems
      needs = needs.merge({"gem_plugin" => INCLUDE})

      # add packaged gem plugins
      Dir.glob(File.join(SITE_GEMPLUGINS, "*.gemspec")).each do |file_name|
        gemspec = Gem::SourceIndex.load_specification(file_name.untaint)
        if gemspec
          class << gemspec
            def full_gem_path
              File.join(File::dirname(@loaded_from), name)
            end
            def full_init_path
              File.join(Config::CONFIG['rubylibdir'], name, "init.rb")
            end
          end
          gems.add_spec(gemspec)
        end
      end
      
      gems.each do |path, gem|
        # don't load gems more than once
        next if @gems.has_key? gem.name        
        check = needs.dup

        # rolls through the depends and inverts anything it finds
        gem.dependencies.each do |dep|
          # this will fail if a gem is depended more than once
          if check.has_key? dep.name
            check[dep.name] = !check[dep.name]
          end
        end
        
        # now since excluded gems start as true, inverting them
        # makes them false so we'll skip this gem if any excludes are found
        if (check.select {|name,test| !test}).length == 0
          # looks like no needs were set to false, so it's good
          
          # Previously was set wrong, we already have the correct gem path!
          #gem_dir = File.join(Gem.dir, "gems", "#{gem.name}-#{gem.version}")
          gem_dir = gem.full_gem_path

          # Load correct init.rb, according to whether this is a 
          # packaged gem plugin or not
          if gem.respond_to?("full_init_path")
            require gem.full_init_path
          else
            require File.join(gem_dir, "lib", gem.name, "init.rb")
          end
          
          @gems[gem.name] = gem_dir
        end
      end

      return nil
    end