@@ -559,7 +559,7 @@ def self.resolve(
559559 end
560560 else
561561 rack = to_rack ( name )
562- alias_path = factory ( name , force_bottle :, flags :, prefer_stub : true ) . alias_path
562+ alias_path = factory_stub ( name , force_bottle :, flags :) . alias_path
563563 f = from_rack ( rack , *spec , alias_path :, force_bottle :, flags :)
564564 end
565565
@@ -1172,6 +1172,48 @@ def self.factory(
11721172 formula
11731173 end
11741174
1175+ # A shortcut for calling `factory` with `prefer_stub: true`.
1176+ #
1177+ # Note: this method returns a stubbed formula which will include only:
1178+ #
1179+ # * name
1180+ # * version
1181+ # * revision
1182+ # * version_scheme
1183+ # * bottle information (for the current OS's bottle, only)
1184+ # * aliases
1185+ # * oldnames
1186+ # * any other data that can be computed using only this information
1187+ #
1188+ # Only use the output for operations that do not require full formula data.
1189+ #
1190+ # @see .factory
1191+ # @api internal
1192+ sig {
1193+ params (
1194+ ref : T . any ( Pathname , String ) ,
1195+ spec : Symbol ,
1196+ alias_path : T . nilable ( T . any ( Pathname , String ) ) ,
1197+ from : T . nilable ( Symbol ) ,
1198+ warn : T ::Boolean ,
1199+ force_bottle : T ::Boolean ,
1200+ flags : T ::Array [ String ] ,
1201+ ignore_errors : T ::Boolean ,
1202+ ) . returns ( Formula )
1203+ }
1204+ def self . factory_stub (
1205+ ref ,
1206+ spec = :stable ,
1207+ alias_path : nil ,
1208+ from : nil ,
1209+ warn : false ,
1210+ force_bottle : false ,
1211+ flags : [ ] ,
1212+ ignore_errors : false
1213+ )
1214+ factory ( ref , spec , alias_path :, from :, warn :, force_bottle :, flags :, ignore_errors :, prefer_stub : true )
1215+ end
1216+
11751217 # Return a {Formula} instance for the given rack.
11761218 #
11771219 # @param spec when nil, will auto resolve the formula's spec.
0 commit comments