aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew
diff options
context:
space:
mode:
authorJack Nagel2013-06-03 22:50:11 -0500
committerJack Nagel2013-06-03 22:50:11 -0500
commit0b4316fbd4b4039a3df7ac6073bf73e1ff637162 (patch)
tree0e4157fe7a64f2e12089f9efc9fa350d58a2734b /Library/Homebrew
parentd38b369497c568e396894c96eaaa5121850cafd0 (diff)
downloadbrew-0b4316fbd4b4039a3df7ac6073bf73e1ff637162.tar.bz2
FormulaInstaller: split up big method
Diffstat (limited to 'Library/Homebrew')
-rw-r--r--Library/Homebrew/formula_installer.rb69
1 files changed, 33 insertions, 36 deletions
diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb
index 3c6dd4606..af15e3ce1 100644
--- a/Library/Homebrew/formula_installer.rb
+++ b/Library/Homebrew/formula_installer.rb
@@ -140,49 +140,46 @@ class FormulaInstaller
end
end
- def effective_deps
- @deps ||= begin
- deps = Set.new
-
- # If a dep was also requested on the command line, we let it honor
- # any influential flags (--HEAD, --devel, etc.) the user has passed
- # when we check the installed status.
- requested_deps = f.recursive_dependencies.select do |dep|
- dep.requested? && !dep.installed?
- end
+ # Dependencies of f that were also explicitly requested on the command line.
+ # These honor options like --HEAD and --devel.
+ def requested_deps
+ f.recursive_dependencies.select { |dep| dep.requested? && !dep.installed? }
+ end
- # Otherwise, we filter these influential flags so that they do not
- # affect installation prefixes and other properties when we decide
- # whether or not the dep is needed.
- necessary_deps = ARGV.filter_for_dependencies do
- f.recursive_dependencies do |dependent, dep|
- if dep.optional? || dep.recommended?
- Dependency.prune unless dependent.build.with?(dep.name)
- elsif dep.build?
- Dependency.prune if install_bottle?(dependent)
- end
-
- if f.build.universal?
- dep.universal! unless dep.build?
- end
-
- if dep.satisfied?
- Dependency.prune
- elsif dep.installed?
- raise UnsatisfiedDependencyError.new(f, dep)
- end
+ # All dependencies that we must install before installing f.
+ # These do not honor flags like --HEAD and --devel.
+ def necessary_deps
+ ARGV.filter_for_dependencies do
+ f.recursive_dependencies do |dependent, dep|
+ if dep.optional? || dep.recommended?
+ Dependency.prune unless dependent.build.with?(dep.name)
+ elsif dep.build?
+ Dependency.prune if install_bottle?(dependent)
end
- end
- deps.merge(requested_deps)
- deps.merge(necessary_deps)
+ if f.build.universal?
+ dep.universal! unless dep.build?
+ end
- # Now that we've determined which deps we need, map them back
- # onto recursive_dependencies to preserve installation order
- f.recursive_dependencies.select { |d| deps.include? d }
+ if dep.satisfied?
+ Dependency.prune
+ elsif dep.installed?
+ raise UnsatisfiedDependencyError.new(f, dep)
+ end
+ end
end
end
+ # Combine requested_deps and necessary deps.
+ def filter_deps
+ deps = Set.new.merge(requested_deps).merge(necessary_deps)
+ f.recursive_dependencies.select { |d| deps.include? d }
+ end
+
+ def effective_deps
+ @effective_deps ||= filter_deps
+ end
+
def install_dependencies
effective_deps.each do |dep|
if dep.requested?