class Boxen::Preflight::OS

Constants

SUPPORTED_RELEASES

Public Instance Methods

ok?() click to toggle source
# File lib/boxen/preflight/os.rb, line 6
def ok?
  osx? && (skip_os_check? || supported_release?)
end
run() click to toggle source
# File lib/boxen/preflight/os.rb, line 10
  def run
    abort <<~HEREDOC
      You must be running one of the following Mac OS versions:

      #{pretty_list_output(SUPPORTED_RELEASES)}

      While not recommended, it is possible to ignore this warning and
      continue anyway. Just prefix your Boxen command with
      `SKIP_OS_CHECK=1`.
    HEREDOC
  end

Private Instance Methods

current_release() click to toggle source
# File lib/boxen/preflight/os.rb, line 39
def current_release
  @current_release ||= `sw_vers -productVersion`
end
osx?() click to toggle source
# File lib/boxen/preflight/os.rb, line 29
def osx?
  `uname -s`.chomp == "Darwin"
end
pretty_list_output(values) click to toggle source
# File lib/boxen/preflight/os.rb, line 24
def pretty_list_output(values)
  output = values.map { |value| "- #{value}" }
  output.join("\n")
end
skip_os_check?() click to toggle source
# File lib/boxen/preflight/os.rb, line 43
def skip_os_check?
  ENV['SKIP_OS_CHECK'] == '1'
end
supported_release?() click to toggle source
# File lib/boxen/preflight/os.rb, line 33
def supported_release?
  SUPPORTED_RELEASES.any? do |r|
    current_release.start_with? r
  end
end