homebrew-cask-versions/lib/hbc/macos.rb
Roland Walker a401047164 remove homebrew-fork MACOS_RELEASE constants
* contain logic within module Hbc::MacOS
* add release_with_patchlevel method
* allow MACOS_RELEASE and MACOS_RELEASE_WITH_PATCHLEVEL
  environment variables to override the determined release
  values regardless of whether under the test harness
2015-01-13 07:35:27 -05:00

18 lines
508 B
Ruby

# originally from Homebrew
require 'hbc/macos/release'
module Hbc::MacOS
extend self
# These Comparable instances can be compared to numerics, strings, or symbols
def release_with_patchlevel
@@release_with_patchlevel ||=
Release.new(ENV.fetch('MACOS_RELEASE_WITH_PATCHLEVEL',
`/usr/bin/sw_vers -productVersion 2>/dev/null`.chomp))
end
def release
@@release ||= Release.new(ENV.fetch('MACOS_RELEASE', release_with_patchlevel.to_s[/10\.\d+/]))
end
end