wayneeseguin-rvm 0.0.31 → 0.0.35
Sign up to get free protection for your applications and to get access to all the features.
- data/config/db +20 -0
- data/rvm.gemspec +8 -4
- data/scripts/rvm +10 -1207
- data/scripts/rvm-cli +230 -0
- data/scripts/rvm-install +2 -7
- data/scripts/rvm-ruby-installer +346 -0
- data/scripts/rvm-selector +188 -0
- data/scripts/rvm-update +12 -13
- data/scripts/rvm-utility +459 -0
- metadata +8 -5
- data/config/cache +0 -23
data/scripts/rvm-cli
ADDED
@@ -0,0 +1,230 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
function __rvm_parse-args {
|
4
|
+
while [ $# -gt 0 ] ; do
|
5
|
+
rvm_token="$1" ; shift
|
6
|
+
case "$rvm_token" in
|
7
|
+
install|uninstall|path|info|setup|version|srcdir|list|symlinks|reset|debug|reload|usage|help|implode|update)
|
8
|
+
rvm_action=$rvm_token
|
9
|
+
;;
|
10
|
+
use)
|
11
|
+
rvm_action=$rvm_token
|
12
|
+
if [ "$1" = "default" ] ; then
|
13
|
+
rvm_ruby_interpreter="system" ; shift
|
14
|
+
elif [ -z "$1" ] ; then
|
15
|
+
rvm_ruby_interpreter="system"
|
16
|
+
fi
|
17
|
+
;;
|
18
|
+
|
19
|
+
ruby|jruby|ree|macruby|rbx|rubinius|default|all)
|
20
|
+
rvm_ruby_interpreter="$rvm_token"
|
21
|
+
rvm_action="${rvm_action:-use}"
|
22
|
+
;;
|
23
|
+
|
24
|
+
gemdir)
|
25
|
+
rvm_action=$rvm_token
|
26
|
+
|
27
|
+
if [ "$1" = "system" ] ; then
|
28
|
+
rvm_ruby_interpreter="system" ; shift
|
29
|
+
fi
|
30
|
+
|
31
|
+
if [ "$1" = "user" ] ; then
|
32
|
+
rvm_ruby_interpreter="user" ; shift
|
33
|
+
fi
|
34
|
+
|
35
|
+
rvm_ruby_interpreter="${rvm_ruby_interpreter:-current}"
|
36
|
+
;;
|
37
|
+
|
38
|
+
gemdup)
|
39
|
+
rvm_action=$rvm_token
|
40
|
+
if [ -z "$1" ] ; then
|
41
|
+
rvm_ruby_interpreter="default"
|
42
|
+
elif [ "$1" = "system" ] ; then
|
43
|
+
rvm_ruby_interpreter=$1 ; shift
|
44
|
+
elif [ "$1" = "default" ] ; then
|
45
|
+
rvm_ruby_interpreter=$1 ; shift
|
46
|
+
else
|
47
|
+
rvm_ruby_interpreter=$1 ; shift
|
48
|
+
rvm_ruby_version=$2 ; shift
|
49
|
+
fi
|
50
|
+
;;
|
51
|
+
|
52
|
+
do|rubydo)
|
53
|
+
rvm_action=$rvm_token
|
54
|
+
temp=$(echo $1 | awk '{print substr($1, 0, 1)}')
|
55
|
+
if [ "$temp" != "-" ] ; then
|
56
|
+
if [ ! -z "$(echo $temp | grep '[0-9]')" ] ; then
|
57
|
+
rvm_ruby_version=$(echo "$1" | tr ',' ' ') ; shift
|
58
|
+
else
|
59
|
+
rvm_ruby_version=$1 ; shift
|
60
|
+
fi
|
61
|
+
else
|
62
|
+
unset rvm_ruby_version
|
63
|
+
fi
|
64
|
+
unset rvm_ruby_interpreter
|
65
|
+
;;
|
66
|
+
|
67
|
+
1.8|1.8.0|1.8.1|1.8.2|1.8.3|1.8.4|1.8.5|1.8.6|1.8.7|1.9|1.9.1|1.9.2)
|
68
|
+
rvm_ruby_interpreter="ruby"
|
69
|
+
rvm_ruby_version="$rvm_token"
|
70
|
+
rvm_action="${rvm_action:-use}"
|
71
|
+
;;
|
72
|
+
1.2.0|1.3.1)
|
73
|
+
rvm_ruby_interpreter="jruby"
|
74
|
+
rvm_ruby_version="$rvm_token"
|
75
|
+
rvm_action="${rvm_action:-use}"
|
76
|
+
;;
|
77
|
+
|
78
|
+
-v|--version)
|
79
|
+
if [ -z "$1" ] ; then
|
80
|
+
rvm_action="version"
|
81
|
+
else
|
82
|
+
rvm_ruby_version="$1"
|
83
|
+
fi
|
84
|
+
shift
|
85
|
+
;;
|
86
|
+
|
87
|
+
-t|--tag) rvm_ruby_tag="$1";
|
88
|
+
rvm_action="${rvm_action:-use}"
|
89
|
+
shift ;;
|
90
|
+
-r|--rev) rvm_ruby_rev="$1";
|
91
|
+
rvm_action="${rvm_action:-use}"
|
92
|
+
shift ;;
|
93
|
+
-b|--branch) rvm_ruby_rev="$1";
|
94
|
+
rvm_action="${rvm_action:-use}"
|
95
|
+
shift ;;
|
96
|
+
|
97
|
+
|
98
|
+
-P|--prefix) rvm_prefix_path="$1" ; shift ;;
|
99
|
+
-B|--bin) rvm_bin_path="$1" ; shift ;;
|
100
|
+
-S|--source) rvm_source_path="$1" ; shift ;;
|
101
|
+
-A|--archive) rvm_archives_path="$1" ; shift ;;
|
102
|
+
-G|--gems) rvm_gem_path="$1" ; shift ;;
|
103
|
+
-C|--configure)
|
104
|
+
if [ ! -z "$1" ] ; then
|
105
|
+
rvm_ruby_configure="$(echo $1 | tr ',' ' ')"
|
106
|
+
shift
|
107
|
+
else
|
108
|
+
rvm_action="error"
|
109
|
+
rvm_error_message="--configure *must* be followed by configure flags."
|
110
|
+
break;
|
111
|
+
fi
|
112
|
+
;;
|
113
|
+
--re-configure) rvm_re_configure=1 ;;
|
114
|
+
-M|--make) rvm_ruby_make="$1" ; shift ;;
|
115
|
+
-I|--make-install) rvm_ruby_make_install="$1"; shift ;;
|
116
|
+
-l|--level) rvm_ruby_patch_level="$1" ; shift ;;
|
117
|
+
-n|--nice) rvm_niceness="$1" ; shift ;;
|
118
|
+
-f|--file) rvm_ruby_args="$1" ; shift ;;
|
119
|
+
-h|--help) rvm_action=help ; shift ;;
|
120
|
+
-d|--default) rvm_set_default=1 ;;
|
121
|
+
--head) rvm_ruby_rev="head" ;;
|
122
|
+
--trace|--debug) rvm_debug=1 ;;
|
123
|
+
--force) rvm_force=1 ;;
|
124
|
+
--set-prompt) rvm_set_prompt=1 ;;
|
125
|
+
--all) rvm_all=1 ; shift ;;
|
126
|
+
-m|--gem-set) rvm_gem_set_name="$1" ; shift ;;
|
127
|
+
--rm-gem-set) rvm_gem_set_name_rm="$1" ; shift ;;
|
128
|
+
--jit) rvm_rubinius_jit="RBX_LLVM=1" ;;
|
129
|
+
|
130
|
+
default|system)
|
131
|
+
rvm_action="use"
|
132
|
+
rvm_ruby_interpreter="system"
|
133
|
+
;;
|
134
|
+
*)
|
135
|
+
rvm_action="error"
|
136
|
+
rvm_error_message="Unrecognized command line argument(s): '$rvm_token $*'"
|
137
|
+
break;
|
138
|
+
esac
|
139
|
+
if [ ! -z "$rvm_ruby_args" -o ! -z "$rvm_error_message" ] ; then break; fi
|
140
|
+
done
|
141
|
+
|
142
|
+
if [ ! -z "$rvm_error_message" ] ; then popd 2> /dev/null ; return 1 ; fi
|
143
|
+
if [ -z "$rvm_debug" ] ; then set +x ; else set -x ; fi
|
144
|
+
|
145
|
+
}
|
146
|
+
|
147
|
+
function rvm {
|
148
|
+
|
149
|
+
__rvm_cleanup-variables
|
150
|
+
__rvm_load-rvmrc
|
151
|
+
__rvm_initialize
|
152
|
+
__rvm_load-defaults
|
153
|
+
__rvm_parse-args $*
|
154
|
+
|
155
|
+
case "$rvm_action" in
|
156
|
+
install) __rvm_install-ruby $rvm_ruby_interpreter $rvm_ruby_version $rvm_ruby_patch_level ;;
|
157
|
+
uninstall) __rvm_uninstall $rvm_ruby_interpreter $rvm_ruby_version $rvm_ruby_patch_level ;;
|
158
|
+
use) __rvm_use $rvm_ruby_interpreter $rvm_ruby_version $rvm_ruby_patch_level ;;
|
159
|
+
list) __rvm_list ;;
|
160
|
+
gemdir) __rvm_gem-dir $rvm_ruby_interpreter $rvm_ruby_version $rvm_ruby_patch_level ;;
|
161
|
+
srcdir) __rvm_src-dir $rvm_ruby_interpreter $rvm_ruby_version $rvm_ruby_patch_level ;;
|
162
|
+
gemdup) __rvm_gem-dup $rvm_ruby_interpreter $rvm_ruby_version $rvm_ruby_patch_level ;;
|
163
|
+
symlinks) __rvm_symlinks ;;
|
164
|
+
version) __rvm_version ;;
|
165
|
+
rubydo)
|
166
|
+
if [ ! -z "$rvm_ruby_version" ] ; then
|
167
|
+
rvm_ruby_versions=$(echo $rvm_ruby_version | tr ',' ' ')
|
168
|
+
for rvm_ruby_version in $rvm_ruby_versions ; do
|
169
|
+
temp=$(echo $rvm_ruby_version | awk '{print substr($1, 0, 1)}')
|
170
|
+
if [ ! -z "$(echo $temp | grep '[0-9]')" ] ; then
|
171
|
+
rvm_ruby_interpreter="ruby"
|
172
|
+
else
|
173
|
+
rvm_ruby_interpreter="$rvm_ruby_version"
|
174
|
+
unset rvm_ruby_version
|
175
|
+
fi
|
176
|
+
unset temp
|
177
|
+
__rvm_select $rvm_ruby_interpreter $rvm_ruby_version
|
178
|
+
|
179
|
+
rvm_command="$rvm_ruby_binary $rvm_ruby_args"
|
180
|
+
echo "$(basename $rvm_ruby_binary):"
|
181
|
+
eval $rvm_command
|
182
|
+
unset rvm_ruby_interpreter rvm_ruby_patch_level rvm_ruby_version rvm_ruby_package_name rvm_ruby_home rvm_ruby_irbrc rvm_ruby_binary
|
183
|
+
done
|
184
|
+
else # all
|
185
|
+
rvm_ruby_versions=`/bin/ls $rvm_install_path/bin/ruby-*`
|
186
|
+
for rvm_ruby_binary in $rvm_ruby_versions ; do
|
187
|
+
if [ -x $rvm_ruby_binary ] ; then
|
188
|
+
rvm_command="$rvm_ruby_binary $rvm_ruby_args"
|
189
|
+
echo "$(basename $rvm_ruby_binary):"
|
190
|
+
eval $rvm_command
|
191
|
+
fi
|
192
|
+
done
|
193
|
+
fi
|
194
|
+
;;
|
195
|
+
reset) __rvm_reset ;;
|
196
|
+
# TODO: how can we use bin_path here for reload, default file?
|
197
|
+
reload) source ~/.rvm/scripts/rvm ;;
|
198
|
+
implode) __rvm_implode ;;
|
199
|
+
update)
|
200
|
+
if [ "$rvm_ruby_rev" = "head" ] ; then
|
201
|
+
if [ -d $rvm_source_path/rvm/.git ] ; then
|
202
|
+
cd $rvm_source_path/rvm/ && git pull origin master
|
203
|
+
else
|
204
|
+
cd $rvm_source_path && git clone git://github.com/wayneeseguin/rvm.git && cd rvm/
|
205
|
+
fi
|
206
|
+
./scripts/rvm-update
|
207
|
+
else
|
208
|
+
# TODO: rvm_install_path:
|
209
|
+
gem install rvm --no-rdoc --no-ri -q && rvm-update && source ~/.rvm/scripts/rvm
|
210
|
+
fi
|
211
|
+
;;
|
212
|
+
error) __rvm_log "fail" "$rvm_error_message ( see: rvm usage )" ; popd 2> /dev/null ; return 1; ;;
|
213
|
+
info|debug)
|
214
|
+
__rvm_version
|
215
|
+
__rvm_info
|
216
|
+
if [ "$rvm_action" = "debug" ] ; then __rvm_debug ; fi
|
217
|
+
return 0
|
218
|
+
;;
|
219
|
+
usage|help) __rvm_usage ;;
|
220
|
+
*)
|
221
|
+
if [ ! -z "$rvm_action" ] ; then
|
222
|
+
__rvm_log "fail" "unknown action '$rvm_action'"
|
223
|
+
else
|
224
|
+
__rvm_usage
|
225
|
+
fi
|
226
|
+
return 1
|
227
|
+
esac
|
228
|
+
|
229
|
+
if [ "$rvm_debug" = "1" ] ; then set +x ; unset rvm_debug ; fi
|
230
|
+
}
|
data/scripts/rvm-install
CHANGED
@@ -23,18 +23,13 @@ done
|
|
23
23
|
|
24
24
|
for file in ~/.bash_profile ~/.bashrc ~/.zshrc ; do
|
25
25
|
if [ -s $file ] ; then
|
26
|
-
echo -e "\n\033[0;
|
26
|
+
echo -e "\n\033[0;32m<i>\033[0m Ensuring that rvm script location in $file is scripts/rvm not bin/rvm"
|
27
27
|
actual_file=$(file ~/.zshrc | awk '{print $5}')
|
28
28
|
sed -i.orig 's/rvm\/bin\/rvm/rvm\/scripts\/rvm/g' $actual_file
|
29
29
|
fi
|
30
30
|
done
|
31
31
|
|
32
|
-
|
33
|
-
echo -e "\n\033[0;33m<w>\033[0m Removing old rvm file from ~/.rvm/bin/rvm"
|
34
|
-
rm -f ~/.rvm/bin/rvm
|
35
|
-
fi
|
36
|
-
|
37
|
-
for dir in scripts examples ; do
|
32
|
+
for dir in config scripts examples ; do
|
38
33
|
mkdir -p $rvm_dir/$dir
|
39
34
|
for file in `/bin/ls $source_dir/$dir/`; do
|
40
35
|
cp $source_dir/$dir/$file $rvm_dir/$dir/$file
|
@@ -0,0 +1,346 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
#
|
4
|
+
# Installer
|
5
|
+
#
|
6
|
+
|
7
|
+
function __rvm_install-source {
|
8
|
+
|
9
|
+
if [ -z "$rvm_selected" ] ; then __rvm_select $* ; fi
|
10
|
+
|
11
|
+
__rvm_log "info" "Installing Ruby from source to: $rvm_ruby_home"
|
12
|
+
mkdir -p $rvm_ruby_log_path
|
13
|
+
|
14
|
+
pushd $rvm_source_path > /dev/null
|
15
|
+
|
16
|
+
if [ ! -z "$rvm_force" ] ; then
|
17
|
+
rm -rf $rvm_ruby_home
|
18
|
+
rm -rf $rvm_ruby_src_path
|
19
|
+
fi
|
20
|
+
|
21
|
+
if [ -z "$rvm_ruby_tag" -a -z "$rvm_ruby_rev" ] ; then
|
22
|
+
if [ ! -d $rvm_ruby_src_path ] ; then
|
23
|
+
rvm_url="${rvm_url:-"ftp://ftp.ruby-lang.org/pub/ruby/1.$rvm_major_version/$rvm_ruby_package_name.tar.gz"}"
|
24
|
+
__rvm_log "info" "\tDownloading $rvm_ruby_package_name, this may take a while depending on your connection..."
|
25
|
+
__rvm_fetch $rvm_url
|
26
|
+
__rvm_log "info" "\tExtracting $rvm_ruby_package_name ..."
|
27
|
+
mkdir -p $rvm_ruby_src_path # Is this line necessary considering -C below? v
|
28
|
+
__rvm_run "extract" tar xzf $rvm_archives_path/$rvm_ruby_package_name.tar.gz -C $rvm_source_path
|
29
|
+
fi
|
30
|
+
else
|
31
|
+
__rvm_log "info" "\tRetrieving Ruby from $rvm_url"
|
32
|
+
if [ ! -z "`echo $rvm_url | grep '^git'`" ] ; then
|
33
|
+
if [ -d "$rvm_ruby_src_path/.git" ] ; then
|
34
|
+
cd $rvm_ruby_src_path
|
35
|
+
if [ -z "$rvm_ruby_rev" ] ; then
|
36
|
+
git pull origin master
|
37
|
+
else
|
38
|
+
git checkout ${rvm_ruby_rev:-HEAD}
|
39
|
+
fi
|
40
|
+
else
|
41
|
+
git clone --depth 1 $rvm_ruby_repo_url $rvm_ruby_src_path
|
42
|
+
fi
|
43
|
+
else
|
44
|
+
if [ -z "$rvm_ruby_rev" ] ; then
|
45
|
+
# TODO: Check if tag v is valid
|
46
|
+
rvm_url=$rvm_ruby_repo_url/tags/$rvm_ruby_tag
|
47
|
+
rvm_rev=""
|
48
|
+
else
|
49
|
+
if [ "$rvm_ruby_rev" = "head" -o "$rvm_ruby_rev" = "trunk" ] ; then
|
50
|
+
rvm_url=$rvm_ruby_repo_url/branches/ruby_1_${rvm_major_version}_${rvm_minor_version}
|
51
|
+
rvm_rev=""
|
52
|
+
else
|
53
|
+
rvm_url=$rvm_ruby_repo_url/branches/ruby_1_${rvm_major_version}_${rvm_minor_version}
|
54
|
+
rvm_rev="-r $rvm_ruby_rev"
|
55
|
+
fi
|
56
|
+
fi
|
57
|
+
|
58
|
+
if [ -d "$rvm_ruby_src_path/.svn" ] ; then
|
59
|
+
cd $rvm_ruby_src_path
|
60
|
+
svn checkout -q $rvm_rev
|
61
|
+
else
|
62
|
+
svn checkout -q $rvm_rev --force $rvm_url $rvm_ruby_src_path
|
63
|
+
fi
|
64
|
+
fi
|
65
|
+
fi
|
66
|
+
|
67
|
+
cd $rvm_ruby_src_path
|
68
|
+
if [ $? -gt 0 ] ; then __rvm_log "error" "There was an error, please check $rvm_ruby_log_path/*.error.log" ; popd 2> /dev/null ; return 1 ; fi
|
69
|
+
|
70
|
+
if [ ! -s "$rvm_ruby_src_path/configure" -a "$rvm_ruby_interpreter" = "ruby" ] ; then
|
71
|
+
rvm_autoconf=`which autoconf`
|
72
|
+
if [ $? -ne 0 ] ; then __rvm_log "fail" "rvm expects autoconf" ; fi
|
73
|
+
__rvm_run "autoconf" $rvm_autoconf
|
74
|
+
fi
|
75
|
+
|
76
|
+
if [ $? -gt 0 ] ; then __rvm_log "error" "There was an error, please check $rvm_ruby_log_path/*.error.log" ; popd 2> /dev/null ; return 1 ; fi
|
77
|
+
|
78
|
+
if [ -s ./Makefile -a -z "$rvm_re_configure" ] ; then
|
79
|
+
__rvm_log "warn" "\tSkipping configure step, Makefile exists so configure must have already been run."
|
80
|
+
elif [ -s ./configure ] ; then
|
81
|
+
__rvm_log "info" "\tConfiguring $rvm_ruby_package_name using $rvm_ruby_configure, this may take a while depending on your cpu(s)..."
|
82
|
+
__rvm_run "configure" ./configure --prefix=$rvm_ruby_home $rvm_ruby_configure
|
83
|
+
else
|
84
|
+
__rvm_log "warn" "\tSkipping configure step, 'configure' script does not exist, did autoconf not run successfully?"
|
85
|
+
fi
|
86
|
+
|
87
|
+
__rvm_log "info" "\tCompiling $rvm_ruby_package_name, this may take a while, depending on your cpu(s)..."
|
88
|
+
if [ -z "$rvm_ruby_make" ] ; then
|
89
|
+
__rvm_run "make" make
|
90
|
+
else
|
91
|
+
__rvm_run "make" $rvm_ruby_make
|
92
|
+
fi
|
93
|
+
|
94
|
+
if [ -z "$rvm_ruby_make" ] ; then
|
95
|
+
__rvm_log "info" "\tInstalling $rvm_ruby_package_name"
|
96
|
+
__rvm_run "install" make install
|
97
|
+
else
|
98
|
+
__rvm_run "install" $rvm_ruby_make_install
|
99
|
+
fi
|
100
|
+
__rvm_run "chmod.bin" chmod +x $rvm_ruby_home/bin/*
|
101
|
+
|
102
|
+
__rvm_bin_scripts
|
103
|
+
__rvm_log "info" "Installation of $rvm_ruby_package_name is complete."
|
104
|
+
|
105
|
+
__rvm_log "info" "\tInstalling rubygems dedicated to $rvm_ruby_package_name..."
|
106
|
+
rvm_gem_package_name="rubygems-1.3.5"
|
107
|
+
rvm_gem_url="http://rubyforge.org/frs/download.php/60718/$rvm_gem_package_name.tgz"
|
108
|
+
if [ -d $rvm_source_path/$rvm_gem_package_name ] ; then
|
109
|
+
cd $rvm_source_path/$rvm_gem_package_name
|
110
|
+
else
|
111
|
+
__rvm_fetch $rvm_gem_url
|
112
|
+
mkdir -p $rvm_source_path/$rvm_gem_package_name
|
113
|
+
__rvm_run "rubygems.extract" tar zxf $rvm_archives_path/$rvm_gem_package_name.tgz -C $rvm_source_path
|
114
|
+
fi
|
115
|
+
# Well this is fun... fix nil error on require_paths:
|
116
|
+
sed -i.orig "s/require_paths\.join/require_paths.to_a.join/" $rvm_source_path/$rvm_gem_package_name/lib/rubygems/gem_path_searcher.rb
|
117
|
+
|
118
|
+
__rvm_run "rubygems.install" $rvm_ruby_binary $rvm_source_path/$rvm_gem_package_name/setup.rb
|
119
|
+
popd 2> /dev/null
|
120
|
+
|
121
|
+
for binary in gem irb erb ri rdoc testrb rake ; do
|
122
|
+
if [ -x $rvm_ruby_src_path/bin/$binary ] ; then
|
123
|
+
cp $rvm_ruby_src_path/bin/$binary $rvm_ruby_home/bin/$binary
|
124
|
+
string="ENV['GEM_HOME']=ENV['GEM_HOME'] || '$rvm_gem_home'\nENV['PATH']='$rvm_ruby_home/bin:$rvm_gem_home/bin:' + ENV['PATH']"
|
125
|
+
awk "NR==2 {print \"$string\"} {print}" $rvm_ruby_home/bin/$binary > $rvm_ruby_home/bin/$binary.new
|
126
|
+
mv $rvm_ruby_home/bin/$binary.new $rvm_ruby_home/bin/$binary
|
127
|
+
chmod +x $rvm_ruby_home/bin/$binary
|
128
|
+
else
|
129
|
+
__rvm_log "warn" "$rvm_ruby_home/bin/$binary is missing"
|
130
|
+
fi
|
131
|
+
done
|
132
|
+
|
133
|
+
for rvm_gem_name in rake ; do
|
134
|
+
__rvm_log "info" "Installing $rvm_gem_name"
|
135
|
+
__rvm_run "gems" $rvm_ruby_home/bin/gem install $rvm_gem_name --no-rdoc --no-ri -q
|
136
|
+
done
|
137
|
+
|
138
|
+
__rvm_log "info" "Installation of rubygems for $rvm_ruby_package_name is complete."
|
139
|
+
if [ -x $rvm_gem_home/bin/$binary ] ; then
|
140
|
+
string="ENV['GEM_HOME']=ENV['GEM_HOME'] || '$rvm_gem_home'\nENV['PATH']='$rvm_ruby_home/bin:$rvm_gem_home/bin:' + ENV['PATH']"
|
141
|
+
mv $rvm_gem_home/bin/$binary $rvm_gem_home/bin/$binary.orig
|
142
|
+
awk "NR==2 {print \"$string\"} {print}" $rvm_gem_home/bin/$binary.orig > $rvm_gem_home/bin/$binary
|
143
|
+
chmod +x $rvm_gem_home/bin/$binary
|
144
|
+
else
|
145
|
+
__rvm_log "warn" "$rvm_gem_home/bin/$binary is missing"
|
146
|
+
fi
|
147
|
+
|
148
|
+
binary=rake
|
149
|
+
if [ -x $rvm_ruby_home/bin/$binary ] ; then
|
150
|
+
mv $rvm_ruby_home/bin/$binary $rvm_gem_home/bin/$binary.orig
|
151
|
+
awk "NR==2 {print \"$string\"} {print}" $rvm_gem_home/bin/$binary.orig > $rvm_gem_home/bin/$binary
|
152
|
+
else
|
153
|
+
__rvm_log "warn" "$rvm_gem_home/bin/$binary is missing."
|
154
|
+
fi
|
155
|
+
unset binary
|
156
|
+
}
|
157
|
+
|
158
|
+
function __rvm_install-ruby {
|
159
|
+
|
160
|
+
if [ -z "$rvm_selected" ] ; then __rvm_select $* ; fi
|
161
|
+
if [ ! -z "$RUBYOPT" ] ; then ruby_options=$RUBYOPT ; unset RUBYOPT ; fi
|
162
|
+
|
163
|
+
case "$rvm_ruby_interpreter" in
|
164
|
+
|
165
|
+
macruby)
|
166
|
+
if [ "`uname`" = "Darwin" ] ; then
|
167
|
+
rvm_ruby_repo_url=$rvm_macruby_repo_url
|
168
|
+
rvm_ruby_configure=""
|
169
|
+
rvm_ruby_make="rake macruby:build framework_instdir=$rvm_path/macruby-head framework_name=/macruby-head --trace"
|
170
|
+
rvm_ruby_make_install="rake framework:install framework_instdir=$rvm_path/macruby-head framework_name=/macruby-head --trace"
|
171
|
+
#rvm_ruby_rev="${rvm_ruby_rev:-head}" # Hard coding this for now
|
172
|
+
|
173
|
+
DESTDIR="$rvm_ruby_home" ; export DESTDIR
|
174
|
+
if [ -z "$rvm_ruby_rev" ] ; then
|
175
|
+
# TODO: Check if tag v is valid
|
176
|
+
#rvm_ruby_repo_url=$rvm_ruby_repo_url/tags/$rvm_ruby_tag
|
177
|
+
rvm_ruby_rev="head" # For now, until nightly release are available.
|
178
|
+
else
|
179
|
+
if [ "$rvm_ruby_rev" = "head" -o "$rvm_ruby_rev" = "trunk" ] ; then
|
180
|
+
#rvm_ruby_repo_url=$rvm_ruby_repo_url/trunk
|
181
|
+
rvm_ruby_rev="head"
|
182
|
+
else
|
183
|
+
#rvm_ruby_repo_url=$rvm_ruby_repo_url/trunk
|
184
|
+
rvm_ruby_rev="-r $rvm_ruby_rev"
|
185
|
+
fi
|
186
|
+
fi
|
187
|
+
__rvm_fetch $rvm_url
|
188
|
+
__rvm_run /usr/sbin/installer -pkg $rvm_ruby_package_name.pkg -target "$rvm_path/$rvm_ruby_package_name/"
|
189
|
+
#__rvm_install-source
|
190
|
+
unset DESTDIR
|
191
|
+
else
|
192
|
+
__rvm_log "fail" "MacRuby can only be installed on a Darwin OS."
|
193
|
+
fi
|
194
|
+
;;
|
195
|
+
|
196
|
+
ruby-enterprise|ree)
|
197
|
+
rvm_url="http://rubyforge.org/frs/download.php/58677/$rvm_ruby_package_name.tar.gz"
|
198
|
+
__rvm_log "info" "Installing Ruby Enterprise Edition from source to: $rvm_ruby_home"
|
199
|
+
pushd $rvm_source_path > /dev/null
|
200
|
+
if [ -d $rvm_ruby_src_path ] ; then
|
201
|
+
cd $rvm_ruby_src_path
|
202
|
+
else
|
203
|
+
__rvm_log "info" "\tDownloading $rvm_ruby_package_name, this may take a while depending on your connection..."
|
204
|
+
__rvm_fetch $rvm_url
|
205
|
+
if [ $? -gt 0 ] ; then __rvm_log "error" "There was an error, please check $rvm_ruby_log_path/*.error.log" ; popd 2> /dev/null ; return 1 ; fi
|
206
|
+
__rvm_log "info" "\tExtracting $rvm_ruby_package_name..."
|
207
|
+
mkdir -p $rvm_ruby_src_path
|
208
|
+
__rvm_run "extract" tar xzf $rvm_archives_path/$rvm_ruby_package_name.tar.gz -C $rvm_source_path
|
209
|
+
fi
|
210
|
+
|
211
|
+
__rvm_log "info" "\tInstalling $rvm_ruby_package_name, this may take a while, depending on your cpu(s)..."
|
212
|
+
mkdir -p $rvm_ruby_log_path
|
213
|
+
|
214
|
+
cd $rvm_ruby_src_path
|
215
|
+
__rvm_run "install" ./installer -a $rvm_path/ruby-enterprise-$rvm_ruby_version-$rvm_ruby_patch_level --dont-install-useful-gems --no-tcmalloc
|
216
|
+
chmod +x $rvm_ruby_home/bin/*
|
217
|
+
|
218
|
+
ln -fs $rvm_ruby_home/bin/ruby $rvm_path/bin/$rvm_ruby_package_name
|
219
|
+
|
220
|
+
__rvm_log "info" "\tInstalling rubygems dedicated to $rvm_ruby_package_name..."
|
221
|
+
rvm_gem_package_name="rubygems-1.3.5"
|
222
|
+
rvm_gem_url="http://rubyforge.org/frs/download.php/60718/$rvm_gem_package_name.tgz"
|
223
|
+
if [ -d $rvm_source_path/$rvm_gem_package_name ] ; then
|
224
|
+
cd $rvm_source_path/$rvm_gem_package_name
|
225
|
+
else
|
226
|
+
__rvm_fetch $rvm_gem_url
|
227
|
+
mkdir -p $rvm_source_path/$rvm_gem_package_name
|
228
|
+
__rvm_run "extract" tar zxf $rvm_archives_path/$rvm_gem_package_name.tgz -C $rvm_source_path
|
229
|
+
fi
|
230
|
+
# Well this is fun... fix nil error on require_paths:
|
231
|
+
sed -i.orig "s/require_paths\.join/require_paths.to_a.join/" $rvm_source_path/$rvm_gem_package_name/lib/rubygems/gem_path_searcher.rb > $rvm_ruby_log_path/rubygems.install.log 2> $rvm_ruby_log_path/rubygems.install.error.log
|
232
|
+
|
233
|
+
__rvm_run "rubygems.install" $rvm_ruby_home/bin/ruby $rvm_source_path/$rvm_gem_package_name/setup.rb
|
234
|
+
__rvm_log "info" "Installation of $rvm_ruby_package_name complete."
|
235
|
+
popd 2> /dev/null
|
236
|
+
|
237
|
+
for rvm_gem_name in rake ; do
|
238
|
+
__rvm_log "info" "Installing $rvm_gem_name"
|
239
|
+
__rvm_run "gems" $rvm_ruby_home/bin/gem install $rvm_gem_name --no-rdoc --no-ri -q
|
240
|
+
done
|
241
|
+
;;
|
242
|
+
|
243
|
+
rbx|rubinius)
|
244
|
+
__rvm_reset # Requires 1.8 to install due to parsetree. TOOD: Check for 1.8 + parse-tree
|
245
|
+
rvm_ruby_repo_url=$rvm_rubinius_repo_url
|
246
|
+
rvm_ruby_configure=""
|
247
|
+
rvm_ruby_make="rake"
|
248
|
+
rvm_ruby_make_install="rake install"
|
249
|
+
rvm_ruby_home="$rvm_path/$rvm_ruby_interpreter-$rvm_ruby_version"
|
250
|
+
#rvm_ruby_rev="head"
|
251
|
+
# TODO: Check if already git repo, then git pull origin master && build
|
252
|
+
if [ ! -d $rvm_ruby_home -o ! -d $rvm_ruby_home/.git ] ; then
|
253
|
+
rm -rf $rvm_ruby_home
|
254
|
+
git clone --depth 1 $rvm_ruby_repo_url $rvm_ruby_home
|
255
|
+
fi
|
256
|
+
cd $rvm_ruby_home
|
257
|
+
__rvm_run "build" $rvm_rubinius_jit rake build
|
258
|
+
for binary in ruby irb ; do
|
259
|
+
ln -fs $rvm_ruby_home/bin/rbx $rvm_ruby_home/bin/$binary
|
260
|
+
done
|
261
|
+
;;
|
262
|
+
|
263
|
+
jruby)
|
264
|
+
rvm_package_file="$rvm_ruby_interpreter-bin-$rvm_ruby_version"
|
265
|
+
rvm_url="http://dist.codehaus.org/$rvm_ruby_interpreter/$rvm_ruby_version/$rvm_package_file.zip"
|
266
|
+
rvm_jruby_repo_url="${rvm_jruby_repo_url:-"git://kenai.com/jruby~main"}"
|
267
|
+
|
268
|
+
__rvm_log "info" "Installing jRuby to: $rvm_ruby_home"
|
269
|
+
mkdir -p $rvm_ruby_log_path
|
270
|
+
pushd $rvm_source_path > /dev/null
|
271
|
+
|
272
|
+
if [ ! -z "$rvm_ruby_rev" ] ; then
|
273
|
+
if [ ! -d $rvm_path/$rvm_ruby_interpreter-$rvm_ruby_version -o ! -d $rvm_path/$rvm_ruby_interpreter-$rvm_ruby_version/.git ] ; then
|
274
|
+
git clone --depth 1 $rvm_jruby_repo_url $rvm_ruby_src_path
|
275
|
+
cd $rvm_ruby_src_path && ant
|
276
|
+
fi
|
277
|
+
else
|
278
|
+
if [ -d $rvm_ruby_src_path ] ; then
|
279
|
+
cd $rvm_ruby_src_path
|
280
|
+
else
|
281
|
+
__rvm_log "info" "\tDownloading $rvm_package_file, this may take a while depending on your connection..."
|
282
|
+
__rvm_fetch $rvm_url
|
283
|
+
__rvm_log "info" "\tExtracting $rvm_package_file..."
|
284
|
+
__rvm_run "extract" unzip -q $rvm_archives_path/$rvm_package_file.zip -d $rvm_source_path
|
285
|
+
cd $rvm_ruby_src_path
|
286
|
+
fi
|
287
|
+
fi
|
288
|
+
|
289
|
+
__rvm_log "info" "\tInstalling $rvm_ruby_package_name..."
|
290
|
+
mkdir -p $rvm_ruby_home/bin/
|
291
|
+
__rvm_run "sync" rsync -ag $rvm_ruby_src_path/ $rvm_ruby_home/
|
292
|
+
__rvm_run "nailgun" cd $rvm_ruby_src_path/tool/nailgun && make
|
293
|
+
popd 2> /dev/null
|
294
|
+
chmod +x $rvm_ruby_home/bin/*
|
295
|
+
for binary in jruby jgem jirb ; do
|
296
|
+
ln -fs $rvm_ruby_home/bin/$binary $rvm_ruby_home/bin/${binary#j}
|
297
|
+
done
|
298
|
+
|
299
|
+
ln -fs $rvm_ruby_home/bin/ruby $rvm_path/bin/$rvm_ruby_package_name
|
300
|
+
for rvm_gem_name in rake jruby-openssl ; do
|
301
|
+
__rvm_log "info" "Installing $rvm_gem_name"
|
302
|
+
__rvm_run "gems" $rvm_ruby_home/bin/jgem install $rvm_gem_name --no-rdoc --no-ri -q
|
303
|
+
done
|
304
|
+
;;
|
305
|
+
|
306
|
+
ruby)
|
307
|
+
if [ -z "rvm_ruby_configure" ] ; then rvm_ruby_configure="--enable-shared=true" ; fi
|
308
|
+
__rvm_install-source $*
|
309
|
+
;;
|
310
|
+
|
311
|
+
default)
|
312
|
+
__rvm_log "fail" "please specify a ruby implementation to install."
|
313
|
+
;;
|
314
|
+
|
315
|
+
*) __rvm_log "fail" "Ruby implementation '$rvm_ruby_interpreter' is not known."
|
316
|
+
|
317
|
+
esac
|
318
|
+
|
319
|
+
if [ ! -z "$ruby_options" ] ; then
|
320
|
+
RUBYOPT=$ruby_options ; export RUBYOPT
|
321
|
+
fi
|
322
|
+
|
323
|
+
}
|
324
|
+
|
325
|
+
function __rvm_uninstall {
|
326
|
+
|
327
|
+
if [ -z "$rvm_selected" ] ; then __rvm_select $* ; fi
|
328
|
+
|
329
|
+
if [ ! -z "$rvm_ruby_package_name" ] ; then
|
330
|
+
for dir in $rvm_source_path $rvm_path ; do
|
331
|
+
if [ -d $dir/$rvm_ruby_package_name ] ; then
|
332
|
+
__rvm_log "info" "Removing $dir/$rvm_ruby_package_name..."
|
333
|
+
rm -rf $dir/$rvm_ruby_package_name
|
334
|
+
else
|
335
|
+
__rvm_log "info" "it seems that $dir/$rvm_ruby_package_name is already non existent."
|
336
|
+
fi
|
337
|
+
if [ -e $rvm_bin_path/$rvm_ruby_package_name ] ; then
|
338
|
+
rm -f $rvm_bin_path/$rvm_ruby_package_name
|
339
|
+
fi
|
340
|
+
done ; unset dir
|
341
|
+
rm -rf $rvm_gem_path/$rvm_ruby_interpreter/$rvm_ruby_version*/
|
342
|
+
else
|
343
|
+
__rvm_log "fail" "Cannot uninstall unknown package '$rvm_ruby_package_name'"
|
344
|
+
fi
|
345
|
+
|
346
|
+
}
|