Refactor the CLI::Args module so it doesn't have different paths to check arguments depending on whether the arguments have been parsed or not. Instead, set the values we need from the global ARGV at first, global initialisation time where they will be thrown away when the actual arguments are parsed. To do this some other general refactoring was needed: - more methods made private when possible - e.g. `HEAD?` used consistently instead of `head` before arguments are parsed. - formula options are only parsed after named arguments are extracted
		
			
				
	
	
		
			17 lines
		
	
	
		
			372 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
			
		
		
	
	
			17 lines
		
	
	
		
			372 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
| # frozen_string_literal: true
 | |
| 
 | |
| module Homebrew
 | |
|   module Fetch
 | |
|     module_function
 | |
| 
 | |
|     def fetch_bottle?(f)
 | |
|       return true if Homebrew.args.force_bottle? && f.bottle
 | |
|       return false unless f.bottle && f.pour_bottle?
 | |
|       return false if Homebrew.args.build_formula_from_source?(f)
 | |
|       return false unless f.bottle.compatible_cellar?
 | |
| 
 | |
|       true
 | |
|     end
 | |
|   end
 | |
| end
 |