| 
									
										
										
										
											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 | 
					
						
							|  |  |  |   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 | 
					
						
							| 
									
										
										
										
											2023-02-10 23:15:40 -05:00
										 |  |  |       comma_array "--groups", | 
					
						
							| 
									
										
										
										
											2023-09-04 21:48:26 +01:00
										 |  |  |                   description: "Installs the specified comma-separated list of gem groups (default: last used). " \ | 
					
						
							|  |  |  |                                "Replaces any previously installed groups." | 
					
						
							|  |  |  |       comma_array "--add-groups", | 
					
						
							|  |  |  |                   description: "Installs the specified comma-separated list of gem groups, " \ | 
					
						
							|  |  |  |                                "in addition to those already installed." | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       conflicts "--groups", "--add-groups" | 
					
						
							| 
									
										
										
										
											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
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-09-04 21:48:26 +01:00
										 |  |  |     groups = args.groups || args.add_groups || [] | 
					
						
							| 
									
										
										
										
											2023-04-10 13:11:38 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-09-04 21:48:26 +01:00
										 |  |  |     if groups.delete("all") | 
					
						
							|  |  |  |       groups |= Homebrew.valid_gem_groups | 
					
						
							|  |  |  |     elsif args.groups # if we have been asked to replace | 
					
						
							|  |  |  |       Homebrew.forget_user_gem_groups! | 
					
						
							|  |  |  |     end | 
					
						
							| 
									
										
										
										
											2021-05-12 16:07:47 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-04-10 13:11:38 +01:00
										 |  |  |     Homebrew.install_bundler_gems!(groups: groups) | 
					
						
							| 
									
										
										
										
											2019-11-21 19:50:23 +00:00
										 |  |  |   end | 
					
						
							|  |  |  | end |