 a1f112f3fe
			
		
	
	
		a1f112f3fe
		
			
		
	
	
	
	
		
			
			This reduces the surface area of our `Kernel` monkeypatch and removes the need to `include Kernel` in a bunch of modules. While we're here, also move `Kernel#require?` to `Homebrew` and fully scope the calls to it.
		
			
				
	
	
		
			37 lines
		
	
	
		
			984 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
			
		
		
	
	
			37 lines
		
	
	
		
			984 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
| # typed: strict
 | |
| # frozen_string_literal: true
 | |
| 
 | |
| require "utils/output"
 | |
| 
 | |
| module Homebrew
 | |
|   module Bundle
 | |
|     module WhalebrewDumper
 | |
|       extend Utils::Output::Mixin
 | |
| 
 | |
|       sig { void }
 | |
|       def self.reset!
 | |
|         @images = T.let(nil, T.nilable(T::Array[String]))
 | |
|       end
 | |
| 
 | |
|       sig { returns(T::Array[T.nilable(String)]) }
 | |
|       def self.images
 | |
|         return [] unless Bundle.whalebrew_installed?
 | |
| 
 | |
|         odisabled "`brew bundle` `whalebrew` support", "using `whalebrew` directly"
 | |
|         @images ||= T.let(
 | |
|           `whalebrew list 2>/dev/null`.split("\n")
 | |
|                                       .reject { |line| line.start_with?("COMMAND ") }
 | |
|                                       .filter_map { |line| line.split(/\s+/).last }
 | |
|                                       .uniq,
 | |
|           T.nilable(T::Array[String]),
 | |
|         )
 | |
|       end
 | |
| 
 | |
|       sig { returns(String) }
 | |
|       def self.dump
 | |
|         images.map { |image| "whalebrew \"#{image}\"" }.join("\n")
 | |
|       end
 | |
|     end
 | |
|   end
 | |
| end
 |