2020-10-10 14:16:11 +02:00
|
|
|
# typed: false
|
2019-05-24 21:36:48 -03:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class SoftwareSpec
|
2019-05-26 00:17:40 -03:00
|
|
|
undef uses_from_macos
|
|
|
|
|
2020-04-28 14:17:54 +01:00
|
|
|
def uses_from_macos(deps, bounds = {})
|
2019-09-17 18:10:02 -04:00
|
|
|
@uses_from_macos_elements ||= []
|
2020-04-28 14:17:54 +01:00
|
|
|
|
|
|
|
if deps.is_a?(Hash)
|
|
|
|
bounds = deps.dup
|
2021-02-16 09:25:34 +00:00
|
|
|
deps = bounds.shift
|
2020-04-28 14:17:54 +01:00
|
|
|
end
|
|
|
|
|
2020-05-04 17:16:39 +01:00
|
|
|
bounds = bounds.transform_values { |v| MacOS::Version.from_symbol(v) }
|
2020-04-28 14:17:54 +01:00
|
|
|
if MacOS.version >= bounds[:since]
|
|
|
|
@uses_from_macos_elements << deps
|
|
|
|
else
|
|
|
|
depends_on deps
|
|
|
|
end
|
2019-05-24 21:36:48 -03:00
|
|
|
end
|
|
|
|
end
|