class Bundler::Source::Path

def load_spec_files

def load_spec_files
  index = Index.new
  expanded_path = path.expand_path(Bundler.root)
  if File.directory?(expanded_path)
    Dir["#{expanded_path}/#{@glob}"].each do |file|
      spec = Bundler.load_gemspec(file)
      if spec
        spec.loaded_from = file.to_s
        spec.source = self
        index << spec
      end
    end
    if index.empty? && @name && @version
      index << Gem::Specification.new do |s|
        s.name     = @name
        s.source   = self
        s.version  = Gem::Version.new(@version)
        s.platform = Gem::Platform::RUBY
        s.summary  = "Fake gemspec for #{@name}"
        s.relative_loaded_from = "#{@name}.gemspec"
        s.authors  = ["no one"]
        if expanded_path.join("bin").exist?
          executables = expanded_path.join("bin").children
          executables.reject!{|p| File.directory?(p) }
          s.executables = executables.map{|c| c.basename.to_s }
        end
      end
    end
  elsif File.exists?(expanded_path)
    raise PathError, "The path `#{expanded_path}` is not a directory."
  else
    raise PathError, "The path `#{expanded_path}` does not exist."
  end
  index
end