Finalize XDG support with proper backwards compatibility
Co-authored-by: MikeMcQuaid <125011+MikeMcQuaid@users.noreply.github.com>
This commit is contained in:
parent
040fd9cd91
commit
890e7ab9a8
@ -28,7 +28,7 @@ module Homebrew
|
||||
# In bin/brew: XDG_CONFIG_HOME set -> HOMEBREW_USER_CONFIG_HOME="${XDG_CONFIG_HOME}/homebrew"
|
||||
# XDG_CONFIG_HOME not set -> HOMEBREW_USER_CONFIG_HOME="${HOME}/.homebrew"
|
||||
using_xdg = user_config_home&.end_with?("/homebrew")
|
||||
|
||||
|
||||
if using_xdg && user_config_home
|
||||
# XDG mode: check both XDG and legacy locations, preferring existing files
|
||||
xdg_brewfile = "#{user_config_home}/Brewfile"
|
||||
|
@ -29,8 +29,9 @@ RSpec.describe Homebrew::Bundle::Brewfile do
|
||||
allow(ENV).to receive(:[]).with("XDG_CONFIG_HOME").and_return(nil)
|
||||
allow(File).to receive(:exist?).with("/Users/username/.homebrew/Brewfile")
|
||||
.and_return(config_dir_brewfile_exist)
|
||||
# Allow any other File.exist? calls to return false by default
|
||||
# Allow any other File.exist? calls and Dir.home calls for flexibility
|
||||
allow(File).to receive(:exist?).and_return(false)
|
||||
allow(Dir).to receive(:home).and_return("/Users/username")
|
||||
end
|
||||
|
||||
context "when `file` is specified with a relative path" do
|
||||
|
Loading…
x
Reference in New Issue
Block a user