Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Commit

Permalink
Extract method shared by Path and Git, fixes specs
Browse files Browse the repository at this point in the history
  • Loading branch information
indirect committed Feb 20, 2010
1 parent 0857cb5 commit 79ef3c1
Showing 1 changed file with 22 additions and 23 deletions.
45 changes: 22 additions & 23 deletions lib/bundler/source.rb
Expand Up @@ -150,27 +150,29 @@ def default_spec(*args)
end
end

def local_specs
@local_specs ||= begin
index = Index.new
def load_spec_files
index = Index.new

if File.directory?(path)
Dir["#{path}/#{@glob}"].each do |file|
file = Pathname.new(file)
# Eval the gemspec from its parent directory
if spec = Dir.chdir(file.dirname) { eval(File.read(file.basename)) }
spec = Specification.from_gemspec(spec)
spec.loaded_from = file
spec.source = self
index << spec
end
if File.directory?(path)
Dir["#{path}/#{@glob}"].each do |file|
file = Pathname.new(file)
# Eval the gemspec from its parent directory
if spec = Dir.chdir(file.dirname) { eval(File.read(file.basename)) }
spec = Specification.from_gemspec(spec)
spec.loaded_from = file
spec.source = self
index << spec
end

index << default_spec if default_spec && index.empty?
end

index.freeze
index << default_spec if default_spec && index.empty?
end

index.freeze
end

def local_specs
@local_specs ||= load_spec_files
end

def install(spec)
Expand Down Expand Up @@ -236,13 +238,10 @@ def path
end

def specs
@specs ||= begin
index = Index.new
# Start by making sure the git cache is up to date
cache
checkout
super
end
# Start by making sure the git cache is up to date
cache
checkout
@specs ||= load_spec_files
end

def install(spec)
Expand Down

0 comments on commit 79ef3c1

Please sign in to comment.