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"
if expanded_path.join("bin").exist?
binaries = expanded_path.join("bin").children.map{|c| c.basename.to_s }
s.executables = binaries
end
end
end
else
raise PathError, "The path `#{expanded_path}` does not exist."
end
index
end