| 
									
										
										
										
											2020-11-25 17:03:23 +01:00
										 |  |  | # typed: true | 
					
						
							| 
									
										
										
										
											2019-11-21 19:50:23 +00:00
										 |  |  | # frozen_string_literal: true | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | require "cli/parser" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | module Homebrew | 
					
						
							| 
									
										
										
										
											2020-10-20 12:03:48 +02:00
										 |  |  |   extend T::Sig | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-21 19:50:23 +00:00
										 |  |  |   module_function | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-10-20 12:03:48 +02:00
										 |  |  |   sig { returns(CLI::Parser) } | 
					
						
							| 
									
										
										
										
											2019-11-21 19:50:23 +00:00
										 |  |  |   def install_bundler_gems_args | 
					
						
							|  |  |  |     Homebrew::CLI::Parser.new do | 
					
						
							| 
									
										
										
										
											2021-01-15 15:04:02 -05:00
										 |  |  |       description <<~EOS | 
					
						
							| 
									
										
										
										
											2019-11-21 19:50:23 +00:00
										 |  |  |         Install Homebrew's Bundler gems. | 
					
						
							|  |  |  |       EOS | 
					
						
							| 
									
										
										
										
											2021-05-12 16:07:47 +01:00
										 |  |  |       comma_array "--groups=", | 
					
						
							|  |  |  |                   description: "Installs the specified comma-separated list of gem groups (default: last used)." | 
					
						
							| 
									
										
										
										
											2020-07-30 18:40:10 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-01-10 14:26:40 -05:00
										 |  |  |       named_args :none | 
					
						
							| 
									
										
										
										
											2019-11-21 19:50:23 +00:00
										 |  |  |     end | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def install_bundler_gems | 
					
						
							| 
									
										
										
										
											2021-05-12 16:07:47 +01:00
										 |  |  |     args = install_bundler_gems_args.parse | 
					
						
							| 
									
										
										
										
											2019-11-21 19:50:23 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-05-12 16:07:47 +01:00
										 |  |  |     # Clear previous settings. We want to fully replace - not append. | 
					
						
							|  |  |  |     Homebrew::Settings.delete(:gemgroups) if args.groups | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     Homebrew.install_bundler_gems!(groups: args.groups || []) | 
					
						
							| 
									
										
										
										
											2019-11-21 19:50:23 +00:00
										 |  |  |   end | 
					
						
							|  |  |  | end |