| 
									
										
										
										
											2020-11-25 17:03:23 +01:00
										 |  |  | # typed: true | 
					
						
							| 
									
										
										
										
											2019-04-19 15:38:03 +09:00
										 |  |  | # frozen_string_literal: true | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-07-09 13:51:19 +01:00
										 |  |  | require "readall" | 
					
						
							| 
									
										
										
										
											2019-04-17 18:25:08 +09:00
										 |  |  | require "cli/parser" | 
					
						
							| 
									
										
										
										
											2022-09-05 13:57:22 +01:00
										 |  |  | require "env_config" | 
					
						
							| 
									
										
										
										
											2014-04-13 16:25:46 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-04-27 19:45:18 -05:00
										 |  |  | module Homebrew | 
					
						
							| 
									
										
										
										
											2020-10-20 12:03:48 +02:00
										 |  |  |   extend T::Sig | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-09-26 01:44:51 +02:00
										 |  |  |   module_function | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-10-20 12:03:48 +02:00
										 |  |  |   sig { returns(CLI::Parser) } | 
					
						
							| 
									
										
										
										
											2018-11-05 18:23:26 +05:30
										 |  |  |   def readall_args | 
					
						
							|  |  |  |     Homebrew::CLI::Parser.new do | 
					
						
							| 
									
										
										
										
											2021-01-15 15:04:02 -05:00
										 |  |  |       description <<~EOS | 
					
						
							| 
									
										
										
										
											2020-06-16 20:35:40 +02:00
										 |  |  |         Import all items from the specified <tap>, or from all installed taps if none is provided. | 
					
						
							|  |  |  |         This can be useful for debugging issues across all items when making | 
					
						
							| 
									
										
										
										
											2018-11-05 18:23:26 +05:30
										 |  |  |         significant changes to `formula.rb`, testing the performance of loading | 
					
						
							| 
									
										
										
										
											2020-06-16 20:35:40 +02:00
										 |  |  |         all items or checking if any current formulae/casks have Ruby issues. | 
					
						
							| 
									
										
										
										
											2018-11-05 18:23:26 +05:30
										 |  |  |       EOS | 
					
						
							|  |  |  |       switch "--aliases", | 
					
						
							|  |  |  |              description: "Verify any alias symlinks in each tap." | 
					
						
							|  |  |  |       switch "--syntax", | 
					
						
							| 
									
										
										
										
											2020-07-27 14:01:22 +01:00
										 |  |  |              description: "Syntax-check all of Homebrew's Ruby files (if no `<tap>` is passed)." | 
					
						
							| 
									
										
										
										
											2022-09-05 13:57:22 +01:00
										 |  |  |       switch "--eval-all", | 
					
						
							|  |  |  |              description: "Evaluate all available formulae and casks, whether installed or not. " \ | 
					
						
							|  |  |  |                           "Implied if HOMEBREW_EVAL_ALL is set." | 
					
						
							| 
									
										
										
										
											2021-01-10 14:26:40 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  |       named_args :tap | 
					
						
							| 
									
										
										
										
											2018-11-05 18:23:26 +05:30
										 |  |  |     end | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-04-27 19:45:18 -05:00
										 |  |  |   def readall | 
					
						
							| 
									
										
										
										
											2020-07-30 18:40:10 +02:00
										 |  |  |     args = readall_args.parse | 
					
						
							| 
									
										
										
										
											2018-11-05 18:23:26 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-27 14:01:22 +01:00
										 |  |  |     if args.syntax? && args.no_named? | 
					
						
							| 
									
										
										
										
											2017-10-18 18:20:30 -04:00
										 |  |  |       scan_files = "#{HOMEBREW_LIBRARY_PATH}/**/*.rb" | 
					
						
							| 
									
										
										
										
											2021-09-30 10:13:43 +01:00
										 |  |  |       ruby_files = Dir.glob(scan_files).grep_v(%r{/(vendor)/}) | 
					
						
							| 
									
										
										
										
											2015-03-07 11:55:14 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-07-09 13:51:19 +01:00
										 |  |  |       Homebrew.failed = true unless Readall.valid_ruby_syntax?(ruby_files) | 
					
						
							| 
									
										
										
										
											2015-03-07 11:55:14 +00:00
										 |  |  |     end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-11-05 18:23:26 +05:30
										 |  |  |     options = { aliases: args.aliases? } | 
					
						
							| 
									
										
										
										
											2020-03-04 17:28:15 +00:00
										 |  |  |     taps = if args.no_named? | 
					
						
							| 
									
										
										
										
											2022-09-05 13:57:22 +01:00
										 |  |  |       if !args.eval_all? && !Homebrew::EnvConfig.eval_all? | 
					
						
							|  |  |  |         odeprecated "brew readall", "brew readall --eval-all or HOMEBREW_EVAL_ALL" | 
					
						
							|  |  |  |       end | 
					
						
							| 
									
										
										
										
											2016-07-09 13:51:19 +01:00
										 |  |  |       Tap | 
					
						
							| 
									
										
										
										
											2016-08-05 22:01:32 +08:00
										 |  |  |     else | 
					
						
							| 
									
										
										
										
											2021-01-10 14:26:40 -05:00
										 |  |  |       args.named.to_installed_taps | 
					
						
							| 
									
										
										
										
											2015-12-19 18:47:20 +08:00
										 |  |  |     end | 
					
						
							| 
									
										
										
										
											2016-07-09 13:51:19 +01:00
										 |  |  |     taps.each do |tap| | 
					
						
							|  |  |  |       Homebrew.failed = true unless Readall.valid_tap?(tap, options) | 
					
						
							| 
									
										
										
										
											2014-04-27 19:45:18 -05:00
										 |  |  |     end | 
					
						
							| 
									
										
										
										
											2010-07-18 14:20:54 -07:00
										 |  |  |   end | 
					
						
							|  |  |  | end |