Permalink
Browse files

Actually commit resolver.rb

  • Loading branch information...
1 parent 701db81 commit 30d8b91eb9e493e776d3bf1cce554f395f4c3ebe @alloy alloy committed Sep 11, 2011
Showing with 30 additions and 0 deletions.
  1. +30 −0 lib/cocoa_pods/resolver.rb
View
@@ -0,0 +1,30 @@
+module Pod
+ class Resolver
+ def initialize(specification)
+ @specification = specification
+ end
+
+ def resolve
+ @sets = []
+ find_dependency_sets(@specification)
+ specs = @sets.map(&:podspec)
+ p specs
+ end
+
+ def find_dependency_sets(specification)
+ specification.read(:dependencies).each do |dependency|
+ Source.search(dependency).each do |set|
+ # TODO ultimately this compatibility check should be used to try and
+ # resolve the conflicts, but for now we'll keep it simple.
+ if existing_set = @sets.find { |s| s == set }
+ existing_set.required_by(specification, dependency)
+ else
+ set.required_by(specification, dependency)
+ @sets << set
+ find_dependency_sets(set.podspec)
+ end
+ end
+ end
+ end
+ end
+end

0 comments on commit 30d8b91

Please sign in to comment.