forked from postmodern/chruby
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchruby.rb
More file actions
58 lines (46 loc) · 1.29 KB
/
chruby.rb
File metadata and controls
58 lines (46 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
require 'formula'
class Chruby < Formula
url 'https://github.com/downloads/postmodern/chruby/chruby-0.2.3.tar.gz'
homepage 'https://github.com/postmodern/chruby#readme'
md5 '5e10ea4a538e3b5ba34ce139fab5d7b7'
head 'https://github.com/postmodern/chruby.git'
def install
system 'make', 'install', "PREFIX=#{prefix}"
end
def caveats
config_file = case File.basename(ENV['SHELL'])
when 'bash' then '~/.bashrc'
when 'zsh' then '~/.zshrc'
else '~/.profile'
end
alternatives = {
'RVM' => '~/.rvm/rubies',
'rbenv' => '~/.rbenv/versions',
'rbfu' => '~/.rbfu/rubies'
}
ruby_manager, rubies_dir = alternatives.find do |name,dir|
File.directory?(File.expand_path(dir))
end
message = %{
Add chruby to #{config_file}
. #{HOMEBREW_PREFIX}/opt/chruby/share/chruby/chruby.sh
}
if rubies_dir
message << %{
RUBIES=(#{rubies_dir}/*)
}
else
message << %{
RUBIES=(
/usr/local/ruby-1.9.3-p327
/usr/local/jruby-1.7.0
/usr/local/rubinius-2.0.0-rc1
)
}
end
message << %{
For system-wide installation, add the above text to /etc/profile.
}
return message.undent
end
end