Merge pull request #6540 from davidosomething/support-zdotdir
Fix #6533 - Add support for zsh ZDOTDIR
This commit is contained in:
		
						commit
						59e3cc7990
					
				@ -19,8 +19,15 @@ describe Utils::Shell do
 | 
			
		||||
      expect(subject.profile).to eq("~/.bash_profile")
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    it "returns /tmp/.zshrc for Zsh if ZDOTDIR is /tmp" do
 | 
			
		||||
      ENV["SHELL"] = "/bin/zsh"
 | 
			
		||||
      ENV["ZDOTDIR"] = "/tmp"
 | 
			
		||||
      expect(subject.profile).to eq("/tmp/.zshrc")
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    it "returns ~/.zshrc for Zsh" do
 | 
			
		||||
      ENV["SHELL"] = "/bin/zsh"
 | 
			
		||||
      ENV["ZDOTDIR"] = nil
 | 
			
		||||
      expect(subject.profile).to eq("~/.zshrc")
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -39,6 +39,8 @@ module Utils
 | 
			
		||||
 | 
			
		||||
    # return the shell profile file based on user's preferred shell
 | 
			
		||||
    def profile
 | 
			
		||||
      return "#{ENV["ZDOTDIR"]}/.zshrc" if preferred == :zsh && ENV["ZDOTDIR"].present?
 | 
			
		||||
 | 
			
		||||
      SHELL_PROFILE_MAP.fetch(preferred, "~/.bash_profile")
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user