Module: OnSystem::MacOSAndLinux Private

Includes:
DSL
Included in:
Cask::DSL, Formula, Formula, Homebrew::Service, PourBottleCheck, Resource, SoftwareSpec
Defined in:
on_system.rbi,
on_system/dsl.rb

This module is part of a private API. This module may only be used in the Homebrew/brew repository. Third parties should avoid using this module if possible, as it may be removed or changed without warning.

Instance Attribute Summary

Attributes included from DSL

#on_system_block_min_os

Instance Method Summary collapse

Methods included from DSL

#on_arch_conditional, #on_os_blocks_exist?, #on_system_blocks_exist?

Instance Method Details

#on_macos(&block) ⇒ T.type_parameter(:U)?

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Parameters:

  • block (T.proc.returns(T.type_parameter(:U)))

Returns:

  • (T.type_parameter(:U), nil)


9
# File 'on_system.rbi', line 9

def on_macos(&block); end

#on_system(linux, macos:, &block) ⇒ T.type_parameter(:U)?

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Parameters:

  • linux (Symbol)
  • macos (Symbol)
  • block (T.proc.returns(T.type_parameter(:U)))

Returns:

  • (T.type_parameter(:U), nil)

Raises:

  • (ArgumentError)


120
121
122
123
124
125
126
127
128
129
# File 'on_system/dsl.rb', line 120

def on_system(linux, macos:, &block)
  mark_on_system_block(os: true)
  raise ArgumentError, "The first argument to `on_system` must be `:linux`" if linux != :linux

  os_version, _, or_condition = macos.to_s.partition(/_(?=or_)/)
  return if !OnSystem.os_condition_met?(os_version.to_sym, or_condition.presence&.to_sym) &&
            !OnSystem.os_condition_met?(:linux)

  with_on_system_block(:os, &block)
end

#on_system_conditional(macos: nil, linux: nil) ⇒ T.type_parameter(:U)?

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Parameters:

  • macos (T.all(Object, T.type_parameter(:U)), nil) (defaults to: nil)
  • linux (T.all(Object, T.type_parameter(:U)), nil) (defaults to: nil)

Returns:

  • (T.type_parameter(:U), nil)


137
138
139
140
141
142
143
144
# File 'on_system/dsl.rb', line 137

def on_system_conditional(macos: nil, linux: nil)
  mark_on_system_block
  if OnSystem.os_condition_met?(:macos) && macos.present?
    macos
  elsif OnSystem.os_condition_met?(:linux) && linux.present?
    linux
  end
end