Merge pull request #11987 from MikeMcQuaid/shims_path_helper

ENV/super: add `shims_path` helper method.
This commit is contained in:
Mike McQuaid 2021-09-08 13:39:30 +01:00 committed by GitHub
commit d42c81a507
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 2 deletions

View File

@ -29,6 +29,13 @@ module Superenv
base.run_time_deps = [] base.run_time_deps = []
end end
# The location of Homebrew's shims on this OS.
# @public
sig { returns(Pathname) }
def self.shims_path
HOMEBREW_SHIMS_PATH/"super"
end
# @private # @private
sig { returns(T.nilable(Pathname)) } sig { returns(T.nilable(Pathname)) }
def self.bin; end def self.bin; end

View File

@ -4,9 +4,15 @@
module Superenv module Superenv
extend T::Sig extend T::Sig
# The location of Homebrew's shims on Linux.
# @public
def self.shims_path
HOMEBREW_SHIMS_PATH/"linux/super"
end
# @private # @private
def self.bin def self.bin
(HOMEBREW_SHIMS_PATH/"linux/super").realpath shims_path.realpath
end end
# @private # @private

View File

@ -5,13 +5,19 @@ module Superenv
extend T::Sig extend T::Sig
class << self class << self
# The location of Homebrew's shims on macOS.
# @public
def shims_path
HOMEBREW_SHIMS_PATH/"mac/super"
end
undef bin undef bin
# @private # @private
def bin def bin
return unless DevelopmentTools.installed? return unless DevelopmentTools.installed?
(HOMEBREW_SHIMS_PATH/"mac/super").realpath shims_path.realpath
end end
end end