move shell_profile to compat/utils.rb & deprecate
This commit is contained in:
parent
bf63c08d50
commit
dcc3377aa3
10
Library/Homebrew/compat/utils.rb
Normal file
10
Library/Homebrew/compat/utils.rb
Normal file
@ -0,0 +1,10 @@
|
||||
# return the shell profile file based on users' preference shell
|
||||
def shell_profile
|
||||
opoo "shell_profile has been deprecated in favor of Utils::Shell.profile"
|
||||
case ENV["SHELL"]
|
||||
when %r{/(ba)?sh} then "~/.bash_profile"
|
||||
when %r{/zsh} then "~/.zshrc"
|
||||
when %r{/ksh} then "~/.kshrc"
|
||||
else "~/.bash_profile"
|
||||
end
|
||||
end
|
||||
@ -519,16 +519,6 @@ def paths
|
||||
end.uniq.compact
|
||||
end
|
||||
|
||||
# return the shell profile file based on users' preference shell
|
||||
def shell_profile
|
||||
case ENV["SHELL"]
|
||||
when %r{/(ba)?sh} then "~/.bash_profile"
|
||||
when %r{/zsh} then "~/.zshrc"
|
||||
when %r{/ksh} then "~/.kshrc"
|
||||
else "~/.bash_profile"
|
||||
end
|
||||
end
|
||||
|
||||
def disk_usage_readable(size_in_bytes)
|
||||
if size_in_bytes >= 1_073_741_824
|
||||
size = size_in_bytes.to_f / 1_073_741_824
|
||||
|
||||
@ -76,7 +76,7 @@ module Utils
|
||||
def self.prepend_path_in_shell_profile(path)
|
||||
case preferred_shell
|
||||
when :bash, :ksh, :sh, :zsh, nil
|
||||
"echo 'export PATH=\"#{sh_quote(path)}:$PATH'\" >> #{shell_profile}"
|
||||
"echo 'export PATH=\"#{sh_quote(path)}:$PATH\"' >> #{shell_profile}"
|
||||
when :csh, :tcsh
|
||||
"echo 'setenv PATH #{csh_quote(path)}:$PATH' >> #{shell_profile}"
|
||||
when :fish
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user