Extract installer setup to prelude method
This commit is contained in:
		
							parent
							
								
									e8727a4eee
								
							
						
					
					
						commit
						4c0db19538
					
				@ -104,6 +104,7 @@ module Homebrew extend self
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  def install_formula f
 | 
					  def install_formula f
 | 
				
			||||||
    fi = FormulaInstaller.new(f)
 | 
					    fi = FormulaInstaller.new(f)
 | 
				
			||||||
 | 
					    fi.prelude
 | 
				
			||||||
    fi.install
 | 
					    fi.install
 | 
				
			||||||
    fi.caveats
 | 
					    fi.caveats
 | 
				
			||||||
    fi.finish
 | 
					    fi.finish
 | 
				
			||||||
 | 
				
			|||||||
@ -59,6 +59,7 @@ module Homebrew extend self
 | 
				
			|||||||
    installer = FormulaInstaller.new(f)
 | 
					    installer = FormulaInstaller.new(f)
 | 
				
			||||||
    installer.options |= Tab.for_formula(f).used_options
 | 
					    installer.options |= Tab.for_formula(f).used_options
 | 
				
			||||||
    installer.show_header = false
 | 
					    installer.show_header = false
 | 
				
			||||||
 | 
					    installer.prelude
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    oh1 "Upgrading #{f.name}"
 | 
					    oh1 "Upgrading #{f.name}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -30,10 +30,6 @@ class FormulaInstaller
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    @poured_bottle = false
 | 
					    @poured_bottle = false
 | 
				
			||||||
    @pour_failed   = false
 | 
					    @pour_failed   = false
 | 
				
			||||||
 | 
					 | 
				
			||||||
    verify_deps_exist unless ignore_deps
 | 
					 | 
				
			||||||
    lock
 | 
					 | 
				
			||||||
    check_install_sanity
 | 
					 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def pour_bottle? install_bottle_options={:warn=>false}
 | 
					  def pour_bottle? install_bottle_options={:warn=>false}
 | 
				
			||||||
@ -41,6 +37,12 @@ class FormulaInstaller
 | 
				
			|||||||
    options.empty? && install_bottle?(f, install_bottle_options)
 | 
					    options.empty? && install_bottle?(f, install_bottle_options)
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  def prelude
 | 
				
			||||||
 | 
					    verify_deps_exist unless ignore_deps
 | 
				
			||||||
 | 
					    lock
 | 
				
			||||||
 | 
					    check_install_sanity
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def verify_deps_exist
 | 
					  def verify_deps_exist
 | 
				
			||||||
    f.recursive_dependencies.map(&:to_formula)
 | 
					    f.recursive_dependencies.map(&:to_formula)
 | 
				
			||||||
  rescue TapFormulaUnavailableError => e
 | 
					  rescue TapFormulaUnavailableError => e
 | 
				
			||||||
@ -311,6 +313,7 @@ class FormulaInstaller
 | 
				
			|||||||
    fi.ignore_deps = true
 | 
					    fi.ignore_deps = true
 | 
				
			||||||
    fi.only_deps = false
 | 
					    fi.only_deps = false
 | 
				
			||||||
    fi.show_header = false
 | 
					    fi.show_header = false
 | 
				
			||||||
 | 
					    fi.prelude
 | 
				
			||||||
    oh1 "Installing #{f} dependency: #{Tty.green}#{dep.name}#{Tty.reset}"
 | 
					    oh1 "Installing #{f} dependency: #{Tty.green}#{dep.name}#{Tty.reset}"
 | 
				
			||||||
    outdated_keg.unlink if outdated_keg
 | 
					    outdated_keg.unlink if outdated_keg
 | 
				
			||||||
    fi.install
 | 
					    fi.install
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user