os/mac: move legacy functions to compat

This commit is contained in:
Bo Anderson 2020-05-16 12:30:29 +01:00
parent 9fcaa46cdf
commit c70bb474e3
3 changed files with 31 additions and 16 deletions

View File

@ -4,3 +4,4 @@ require "compat/cask/dsl/version"
require "compat/language/python"
require "compat/requirements/macos_requirement"
require "compat/formula"
require "compat/os/mac" if OS.mac?

View File

@ -0,0 +1,30 @@
# frozen_string_literal: true
module OS
module Mac
class << self
module Compat
def preferred_arch
# odeprecated "MacOS.preferred_arch", "Hardware::CPU.arch (or ideally let the compiler handle it)"
if Hardware::CPU.is_64_bit?
Hardware::CPU.arch_64_bit
else
Hardware::CPU.arch_32_bit
end
end
def tcc_db
# odeprecated "MacOS.tcc_db"
@tcc_db ||= Pathname.new("/Library/Application Support/com.apple.TCC/TCC.db")
end
def pre_mavericks_accessibility_dotfile
# odeprecated "MacOS.pre_mavericks_accessibility_dotfile"
@pre_mavericks_accessibility_dotfile ||= Pathname.new("/private/var/db/.AccessibilityAPIEnabled")
end
end
prepend Compat
end
end
end

View File

@ -166,14 +166,6 @@ module OS
paths.uniq
end
def preferred_arch
if Hardware::CPU.is_64_bit?
Hardware::CPU.arch_64_bit
else
Hardware::CPU.arch_32_bit
end
end
def app_with_bundle_id(*ids)
path = mdfind(*ids)
.reject { |p| p.include?("/Backups.backupdb/") }
@ -196,13 +188,5 @@ module OS
def mdfind_query(*ids)
ids.map! { |id| "kMDItemCFBundleIdentifier == #{id}" }.join(" || ")
end
def tcc_db
@tcc_db ||= Pathname.new("/Library/Application Support/com.apple.TCC/TCC.db")
end
def pre_mavericks_accessibility_dotfile
@pre_mavericks_accessibility_dotfile ||= Pathname.new("/private/var/db/.AccessibilityAPIEnabled")
end
end
end