diff options
| author | William Woodruff | 2015-07-23 00:34:57 -0400 |
|---|---|---|
| committer | Misty De Meo | 2015-08-21 10:59:35 -0700 |
| commit | f58506ea6f7000e7e6d3f6538dc5ff2c43ea7926 (patch) | |
| tree | 2f1fa333267ac42de974981da4927a8c22687120 /Library | |
| parent | 91e598cf3f88591f2146218eaa2ecc2a3a261e31 (diff) | |
| download | brew-f58506ea6f7000e7e6d3f6538dc5ff2c43ea7926.tar.bz2 | |
FormulaInstaller: add prevent_build_flags to eliminate code repetition
remove unneeded definition
change variable in FormulaInstaller.check_build_flags from bf to build_flags
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/cmd/install.rb | 6 | ||||
| -rw-r--r-- | Library/Homebrew/cmd/reinstall.rb | 8 | ||||
| -rw-r--r-- | Library/Homebrew/cmd/upgrade.rb | 8 | ||||
| -rw-r--r-- | Library/Homebrew/formula_installer.rb | 9 |
4 files changed, 10 insertions, 21 deletions
diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb index ce9bf5291..f41450be1 100644 --- a/Library/Homebrew/cmd/install.rb +++ b/Library/Homebrew/cmd/install.rb @@ -40,11 +40,7 @@ module Homebrew # if the user's flags will prevent bottle only-installations when no # developer tools are available, we need to stop them early on - if !MacOS.can_build? - bf = ARGV.collect_build_flags - - raise BuildFlagsError.new(bf) if !bf.empty? - end + FormulaInstaller.prevent_build_flags unless MacOS.can_build? ARGV.formulae.each do |f| # head-only without --HEAD is an error diff --git a/Library/Homebrew/cmd/reinstall.rb b/Library/Homebrew/cmd/reinstall.rb index 98941698a..4de1ad9c2 100644 --- a/Library/Homebrew/cmd/reinstall.rb +++ b/Library/Homebrew/cmd/reinstall.rb @@ -2,13 +2,7 @@ require "formula_installer" module Homebrew def reinstall - if !MacOS.can_build? - bf = ARGV.collect_build_flags - - if !bf.empty? - raise BuildFlagsError.new(bf) - end - end + FormulaInstaller.prevent_build_flags unless MacOS.can_build? ARGV.resolved_formulae.each { |f| reinstall_formula(f) } end diff --git a/Library/Homebrew/cmd/upgrade.rb b/Library/Homebrew/cmd/upgrade.rb index e8fc9c0f8..9bb5d46ad 100644 --- a/Library/Homebrew/cmd/upgrade.rb +++ b/Library/Homebrew/cmd/upgrade.rb @@ -3,13 +3,7 @@ require "cmd/outdated" module Homebrew def upgrade - if !MacOS.can_build? - bf = ARGV.collect_build_flags - - if !bf.empty? - raise BuildFlagsError.new(bf) - end - end + FormulaInstaller.prevent_build_flags unless MacOS.can_build? Homebrew.perform_preinstall_checks diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index 45bbd60d1..cb2b4923b 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -56,6 +56,13 @@ class FormulaInstaller @pour_failed = false end + # called by install/reinstall/upgrade when no build tools are available + def self.prevent_build_flags + build_flags = ARGV.collect_build_flags + + raise BuildFlagsError.new(build_flags) unless build_flags.empty? + end + def pour_bottle?(install_bottle_options = { :warn=>false }) return true if Homebrew::Hooks::Bottles.formula_has_bottle?(formula) @@ -234,8 +241,6 @@ class FormulaInstaller end def check_dependencies_bottled(deps) - unbottled = [] - unbottled = deps.select do |dep, _| formula = dep.to_formula !formula.pour_bottle? && !MacOS.can_build? |
