 dc71b7c8f6
			
		
	
	
		dc71b7c8f6
		
			
		
	
	
	
	
		
			
			- move some things out of `extend` that don't really fit there e.g. `Module`s that are included but not doing any overriding/monkeypatching - move some code into `extend/os` to fix all remaining `rubocop:todo Homebrew/MoveToExtendOS`s - remove some unneeded `bundle` skipper code that doesn't really make sense given our current bottling strategy - extract some `Pathname` extensions to `extend/pathname` for separate files - move a `ENV` `Kernel` extension into `kernel.rb` - `odeprecate` a seemingly unused backwards compatibility method - move `readline_nonblock` from a monkeypatch to a `ReadlineNonblock.read` method as its only used in one place - fix up a link in documentation
		
			
				
	
	
		
			40 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Ruby
		
	
	
	
	
	
			
		
		
	
	
			40 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Ruby
		
	
	
	
	
	
| # typed: true # rubocop:todo Sorbet/StrictSigil
 | |
| # frozen_string_literal: true
 | |
| 
 | |
| require "cask/utils"
 | |
| require "on_system"
 | |
| 
 | |
| module Cask
 | |
|   class DSL
 | |
|     # Superclass for all stanzas which take a block.
 | |
|     class Base
 | |
|       extend Forwardable
 | |
| 
 | |
|       def initialize(cask, command = SystemCommand)
 | |
|         @cask = cask
 | |
|         @command = command
 | |
|       end
 | |
| 
 | |
|       def_delegators :@cask, :token, :version, :caskroom_path, :staged_path, :appdir, :language, :arch
 | |
| 
 | |
|       def system_command(executable, **options)
 | |
|         @command.run!(executable, **options)
 | |
|       end
 | |
| 
 | |
|       # No need to define it as it's the default/superclass implementation.
 | |
|       # rubocop:disable Style/MissingRespondToMissing
 | |
|       def method_missing(method, *)
 | |
|         if method
 | |
|           underscored_class = T.must(self.class.name).gsub(/([[:lower:]])([[:upper:]][[:lower:]])/, '\1_\2').downcase
 | |
|           section = underscored_class.split("::").last
 | |
|           Utils.method_missing_message(method, @cask.to_s, section)
 | |
|           nil
 | |
|         else
 | |
|           super
 | |
|         end
 | |
|       end
 | |
|       # rubocop:enable Style/MissingRespondToMissing
 | |
|     end
 | |
|   end
 | |
| end
 |