move default_prefix to extend/os

This commit is contained in:
hyuraku 2023-01-24 21:02:24 +09:00
parent d636f5bc0a
commit e2f0075ee8
4 changed files with 26 additions and 10 deletions

View File

@ -1,15 +1,7 @@
# typed: true
# frozen_string_literal: true
require "simulate_system"
module Homebrew
# TODO: Refactor and move to extend/os
DEFAULT_PREFIX, DEFAULT_REPOSITORY = if OS.mac? && Hardware::CPU.arm? # rubocop:disable Homebrew/MoveToExtendOS
[HOMEBREW_MACOS_ARM_DEFAULT_PREFIX, HOMEBREW_MACOS_ARM_DEFAULT_REPOSITORY]
elsif Homebrew::SimulateSystem.simulating_or_running_on_linux?
[HOMEBREW_LINUX_DEFAULT_PREFIX, HOMEBREW_LINUX_DEFAULT_REPOSITORY]
else
[HOMEBREW_DEFAULT_PREFIX, HOMEBREW_DEFAULT_REPOSITORY]
end.freeze
DEFAULT_PREFIX = HOMEBREW_DEFAULT_PREFIX
DEFAULT_REPOSITORY = HOMEBREW_DEFAULT_REPOSITORY
end

View File

@ -0,0 +1,10 @@
# typed: true
# frozen_string_literal: true
require "simulate_system"
if OS.mac? && Hardware::CPU.arm?
require "extend/os/mac/default_prefix"
elsif Homebrew::SimulateSystem.simulating_or_running_on_linux?
require "extend/os/linux/default_prefix"
end

View File

@ -0,0 +1,7 @@
# typed: true
# frozen_string_literal: true
module Homebrew
DEFAULT_PREFIX = HOMEBREW_LINUX_DEFAULT_PREFIX
DEFAULT_REPOSITORY = HOMEBREW_LINUX_DEFAULT_REPOSITORY
end

View File

@ -0,0 +1,7 @@
# typed: true
# frozen_string_literal: true
module Homebrew
DEFAULT_PREFIX = HOMEBREW_MACOS_ARM_DEFAULT_PREFIX
DEFAULT_REPOSITORY = HOMEBREW_MACOS_ARM_DEFAULT_REPOSITORY
end