8000 Detect the shell and specify the appropriate rc file (issue #19). · devandroid/chruby@296bf5d · GitHub
[go: up one dir, main page]

Skip to content

Commit 296bf5d

Browse files
committed
Detect the shell and specify the appropriate rc file (issue postmodern#19).
1 parent bafb67e commit 296bf5d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

homebrew/chruby.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ def install
1212
end
1313

1414
def caveats
15+
config_file = case File.basename(ENV['SHELL'])
16+
when 'bash' then '~/.bashrc'
17+
when 'zsh' then '~/.zshrc'
18+
else '~/.profile'
19+
end
20+
1521
alternatives = {
1622
'RVM' => '~/.rvm/rubies',
1723
'rbenv' => '~/.rbenv/versions',
@@ -23,7 +29,7 @@ def caveats
2329
end
2430

2531
message = %{
26-
Add chruby to ~/.bashrc or ~/.profile:
32+
Add chruby to #{config_file}
2733
2834
. /usr/local/opt/chruby/share/chruby/chruby.sh
2935
}

0 commit comments

Comments
 (0)
0