Commit 07a7560c authored by Samuel E. Giddins's avatar Samuel E. Giddins

[Documentation] Document Molinillo module methods

parent edc4f9f7
...@@ -93,6 +93,13 @@ module Pod ...@@ -93,6 +93,13 @@ module Pod
include Molinillo::SpecificationProvider include Molinillo::SpecificationProvider
# Returns (and caches) the specification that satisfy the given dependency.
#
# @return [Array<Specification>] the specifications that satisfy the given
# `dependency`.
#
# @param [Dependency] dependency the dependency that is being searched for.
#
def search_for(dependency) def search_for(dependency)
@search ||= {} @search ||= {}
@search[dependency] ||= begin @search[dependency] ||= begin
...@@ -114,6 +121,13 @@ module Pod ...@@ -114,6 +121,13 @@ module Pod
@search[dependency].dup @search[dependency].dup
end end
# Returns the dependencies of `specification`.
#
# @return [Array<Specification>] all dependencies of `specification`.
#
# @param [Specification] specification the specification whose own
# dependencies are being asked for.
#
def dependencies_for(specification) def dependencies_for(specification)
specification.all_dependencies.map do |dependency| specification.all_dependencies.map do |dependency|
if dependency.root_name == Specification.root_name(specification.name) if dependency.root_name == Specification.root_name(specification.name)
...@@ -124,14 +138,42 @@ module Pod ...@@ -124,14 +138,42 @@ module Pod
end end
end end
# Returns the name for the given `dependency`.
#
# @return [String] the name for the given `dependency`.
#
# @param [Dependency] dependency the dependency whose name is being
# queried.
#
def name_for(dependency) def name_for(dependency)
dependency.name dependency.name
end end
# @return [String] the user-facing name for a {Podfile}.
#
def name_for_explicit_dependency_source def name_for_explicit_dependency_source
'Podfile' 'Podfile'
end end
# @return [String] the user-facing name for a {Lockfile}.
#
def name_for_locking_dependency_source
'Podfile.lock'
end
# Determines whether the given `requirement` is satisfied by the given
# `spec`, in the context of the current `activated` dependency graph.
#
# @return [Boolean] whether `requirement` is satisfied by `spec` in the
# context of the current `activated` dependency graph.
#
# @param [Dependency] requirement the dependency in question.
#
# @param [Molinillo::DependencyGraph] activated the current dependency
# graph in the resolution process.
#
# @param [Specification] spec the specification in question.
#
def requirement_satisfied_by?(requirement, activated, spec) def requirement_satisfied_by?(requirement, activated, spec)
existing_vertices = activated.vertices.values.select do |v| existing_vertices = activated.vertices.values.select do |v|
Specification.root_name(v.name) == requirement.root_name Specification.root_name(v.name) == requirement.root_name
...@@ -152,6 +194,15 @@ module Pod ...@@ -152,6 +194,15 @@ module Pod
# 3) Are there any conflicts for this dependency? # 3) Are there any conflicts for this dependency?
# 4) How many possibilities are there to satisfy this dependency? # 4) How many possibilities are there to satisfy this dependency?
# #
# @return [Array<Dependency>] the sorted dependencies.
#
# @param [Array<Dependency>] dependencies the unsorted dependencies.
#
# @param [Molinillo::DependencyGraph] activated the dependency graph of
# currently activated specs.
#
# @param [{String => Array<Conflict>}] conflicts the current conflicts.
#
def sort_dependencies(dependencies, activated, conflicts) def sort_dependencies(dependencies, activated, conflicts)
dependencies.sort_by do |dependency| dependencies.sort_by do |dependency|
name = name_for(dependency) name = name_for(dependency)
...@@ -172,6 +223,10 @@ module Pod ...@@ -172,6 +223,10 @@ module Pod
include Molinillo::UI include Molinillo::UI
# The UI object the resolver should use for displaying user-facing output.
#
# @return [UserInterface] the normal CocoaPods UI object.
#
def output def output
UI UI
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment