Merge pull request #20124 from Homebrew/add-cask-config-rbi-compiler

Add Cask::Config RBI compiler
This commit is contained in:
Mike McQuaid 2025-06-17 10:32:59 +00:00 committed by GitHub
commit 768c10c6fb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 95 additions and 0 deletions

View File

@ -0,0 +1,58 @@
# typed: true
# DO NOT EDIT MANUALLY
# This is an autogenerated file for dynamic methods in `Cask::Config`.
# Please instead update this file by running `bin/tapioca dsl Cask::Config`.
module Cask
class Config
sig { returns(String) }
def appdir; end
sig { returns(String) }
def audio_unit_plugindir; end
sig { returns(String) }
def colorpickerdir; end
sig { returns(String) }
def dictionarydir; end
sig { returns(String) }
def fontdir; end
sig { returns(String) }
def input_methoddir; end
sig { returns(String) }
def internet_plugindir; end
sig { returns(String) }
def keyboard_layoutdir; end
sig { returns(T::Array[String]) }
def languages; end
sig { returns(String) }
def mdimporterdir; end
sig { returns(String) }
def prefpanedir; end
sig { returns(String) }
def qlplugindir; end
sig { returns(String) }
def screen_saverdir; end
sig { returns(String) }
def servicedir; end
sig { returns(String) }
def vst3_plugindir; end
sig { returns(String) }
def vst_plugindir; end
end
end

View File

@ -0,0 +1,37 @@
# typed: strict
# frozen_string_literal: true
require_relative "../../../../global"
require "cask/config"
module Tapioca
module Compilers
class CaskConfig < Tapioca::Dsl::Compiler
ConstantType = type_member { { fixed: Module } }
sig { override.returns(T::Enumerable[Module]) }
def self.gather_constants = [Cask::Config]
sig { override.void }
def decorate
root.create_module("Cask") do |mod|
mod.create_class("Config") do |klass|
Cask::Config.defaults.each do |key, value|
return_type = if key == :languages
# :languages is a `LazyObject`, so it lazily evaluates to an
# array of strings when a method is called on it.
"T::Array[String]"
elsif key.end_with?("?")
"T::Boolean"
else
value.class.to_s
end
klass.create_method(key.to_s, return_type:, class_method: false)
end
end
end
end
end
end
end