rvm 1.0.9 → 1.0.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,14 +1,23 @@
1
1
  #!/usr/bin/env bash
2
2
 
3
3
  declare rvm_verbose_flag=${rvm_verbose_flag:-0}
4
+
4
5
  declare rvm_hook=${rvm_hook:-""}
5
6
 
6
7
  if [[ -n "$rvm_hook" ]] ; then
8
+
7
9
  if [[ -s "$rvm_path/hooks/$rvm_hook" ]] ; then
10
+
8
11
  if [[ ${rvm_verbose_flag:-0} -gt 0 || ${rvm_debug_flag:-0} -gt 0 ]] ; then
12
+
9
13
  "$rvm_path/scripts/log" "info" "running hook $rvm_hook"
14
+
10
15
  fi
16
+
11
17
  source "$rvm_path/hooks/$rvm_hook"
18
+
12
19
  fi
20
+
13
21
  fi
22
+
14
23
  unset rvm_hook
@@ -3,15 +3,8 @@
3
3
  if [[ "$rvm_trace_flag" -eq 2 ]] ; then set -x ; export rvm_trace_flag ; fi
4
4
 
5
5
  source "$rvm_path/scripts/base"
6
- source "$rvm_path/scripts/version"
7
-
8
- rvm_ruby_gem_home="${rvm_ruby_gem_home:-${GEM_HOME:-""}}"
9
6
 
10
- if [[ ! -d "$rvm_ruby_gem_home" ]] && command -v gem > /dev/null 2>&1; then
11
- rvm_ruby_gem_home="$(gem env home)"
12
- fi
13
-
14
- rvm_info=""
7
+ source "$rvm_path/scripts/version"
15
8
 
16
9
  version_for() {
17
10
  local binary=${1:-""}
@@ -119,35 +112,62 @@ $(__rvm_version)
119
112
  fi
120
113
 
121
114
  for file_name in "$HOME/.bashrc" "$HOME/.bash_profile" "$HOME/.zshenv" ; do
115
+
122
116
  if [[ -s "$file_name" ]] ; then
117
+
123
118
  rvm_info="$rvm_info\n$file_name:\n$(\grep 'rvm' $file_name 2>/dev/null || true)"
119
+
124
120
  fi
121
+
125
122
  done
126
123
 
127
124
  if [[ "$rvm_selfcontained" = "0" ]] ; then
125
+
128
126
  debug_files="$rvm_path/config/alias $rvm_path/config/system $rvm_path/config/db /etc/rvmrc /etc/gemrc"
127
+
129
128
  else
129
+
130
130
  debug_files="$rvm_path/config/alias $rvm_path/config/system $rvm_path/config/db $HOME/.rvmrc $HOME/.gemrc"
131
+
131
132
  fi
132
133
 
133
134
  for file_name in $(echo $debug_files); do
135
+
134
136
  if [[ -f "$file_name" ]] && [[ -s "$file_name" ]] ; then
137
+
135
138
  rvm_info="$rvm_info\n$file_name \(filtered\):\n$(awk '!/assword|_key/' < $file_name)\n"
139
+
136
140
  fi
141
+
137
142
  done
138
143
 
139
144
  rvm_info="$rvm_info\ngem sources:\n$(gem sources | awk '/gems/')\n\n"
140
145
  }
141
146
 
142
147
  info_sections() {
148
+
143
149
  for section in $(printf "${sections//,/ }") ; do
150
+
144
151
  rvm_info="" ; "info_${section}" ; printf "$rvm_info"
152
+
145
153
  done
154
+
146
155
  }
147
156
 
157
+ rvm_ruby_gem_home="${rvm_ruby_gem_home:-${GEM_HOME:-""}}"
158
+
159
+ if [[ ! -d "$rvm_ruby_gem_home" ]] && command -v gem > /dev/null 2>&1; then
160
+ rvm_ruby_gem_home="$(gem env home)"
161
+ fi
162
+
163
+ rvm_info=""
164
+
148
165
  args=($*)
149
- ruby_strings="${args[0]// /}"
150
- args="$(echo ${args[@]:1}) " # Strip trailing / leading / extra spacing.
166
+
167
+ ruby_strings="${args[$__array_start]// /}"
168
+ args[$__array_start]=""
169
+ args=(${args[@]})
170
+
151
171
  sections="${args// /}"
152
172
  all_sections="system rvm ruby homes binaries environment"
153
173
 
@@ -158,7 +178,9 @@ if "$rvm_path/scripts/match" "$all_sections debug" "${ruby_strings/,*/}" ; then
158
178
 
159
179
  fi
160
180
 
161
- if [[ -z "${sections// /}" ]] ; then sections="$all_sections" ; fi
181
+ if [[ -z "${sections// /}" ]] ; then
182
+ sections="$all_sections"
183
+ fi
162
184
 
163
185
  if [[ -z "$ruby_strings" ]] ; then
164
186
 
@@ -40,6 +40,15 @@ check_rubyopt_conditions() {
40
40
  fi
41
41
  }
42
42
 
43
+ # Regenerates a users wrappers as part of the update.
44
+ regenerate_wrappers() {
45
+ printf "\n"
46
+ if command -v __rvm_regenerate_wrappers >/dev/null; then
47
+ __rvm_regenerate_wrappers
48
+ fi
49
+ printf "\n"
50
+ }
51
+
43
52
  andand_return_instructions() {
44
53
  printf "
45
54
  This means that if you see something like:
@@ -493,6 +502,15 @@ for file in rvm rvmsudo rvm-shell rvm-auto-ruby ; do
493
502
 
494
503
  done
495
504
 
505
+ # Cleanup any .swp files that might have appeared.
506
+ files=($( find "$rvm_path/" -mindepth 1 -maxdepth 2 -iname '*.swp' -type f ))
507
+
508
+ for file in "${files[@]}" ; do
509
+
510
+ [[ -f "$file" ]] && rm -f "$file"
511
+
512
+ done
513
+
496
514
  printf "\n Copying manpages into place."
497
515
 
498
516
  files=($(builtin cd "$install_source_path/man" ; find . -maxdepth 1 -mindepth 1 -type f -print))
@@ -514,6 +532,8 @@ if [[ ${upgrade_flag:-0} -eq 1 ]] ; then
514
532
  upgrade_notes
515
533
 
516
534
  check_rubyopt_conditions
535
+
536
+ regenerate_wrappers
517
537
 
518
538
  printf "\nUpgrade of RVM in $rvm_path/ is complete.\n\n"
519
539
 
@@ -3,18 +3,41 @@
3
3
 
4
4
  # Turn on completion.
5
5
  begin
6
- require "readline"
6
+ require "readline"
7
+
8
+ require "irb/completion" rescue nil
9
+
10
+ # Turn on history saving.
11
+ # require "irb/ext/save-history"
12
+ # IRB.conf[:HISTORY_FILE] = File.join(ENV["HOME"], ".irb-history")
13
+
14
+ # Use an alternate way to on history saving until save-history is fixed.
15
+ #
16
+ # bug: http://redmine.ruby-lang.org/issues/show/1556
17
+ # patch: http://pastie.org/513500
18
+ #
19
+ # This technique was adopted from /etc/irbrc on OS X.
20
+ histfile = File.expand_path(".irb-history", ENV["HOME"])
21
+
22
+ if File.exists?(histfile)
23
+ lines = IO.readlines(histfile).collect { |line| line.chomp }
24
+ Readline::HISTORY.push(*lines)
25
+ end
26
+
27
+ Kernel::at_exit do
28
+ maxhistsize = 100
29
+ histfile = File::expand_path(".irb-history", ENV["HOME"])
30
+ lines = Readline::HISTORY.to_a.reverse.uniq.reverse
31
+ lines = lines[-maxhistsize, maxhistsize] if lines.compact.length > maxhistsize
32
+ File::open(histfile, "w+") { |io| io.puts lines.join("\n") }
33
+ end
34
+
7
35
  rescue
8
36
  puts "Readline was unable to be required, if you need completion or history install readline then reinstall the ruby.\nYou may follow 'rvm notes' for dependencies and/or read the docs page http://rvm.beginrescueend.com/packages/readline/ . Be sure you 'rvm remove X ; rvm install X' to re-compile your ruby with readline support after obtaining the readline libraries."
9
37
  end
10
- require "irb/completion" rescue nil
11
-
12
- # Turn on history saving.
13
- require "irb/ext/save-history"
14
- IRB.conf[:HISTORY_FILE] = File.join(ENV["HOME"], ".irb-history")
15
38
 
16
39
  # Calculate the ruby string.
17
- rvm_ruby_string = ENV["rvm_ruby_string"] || "#{RUBY_ENGINE rescue 'ruby'}-#{RUBY_VERSION}-#{(RUBY_PATCHLEVEL) ? "p#{RUBY_PATCHLEVEL}" : "r#{RUBY_REVISION}"}"
40
+ rvm_ruby_string = ENV["rvm_ruby_string"] || `rvm tools identifier`.strip.split("@", 2)[0]
18
41
 
19
42
  # Set up the prompt to be RVM specific.
20
43
  @prompt = {
@@ -37,3 +60,4 @@ rescue LoadError => load_error
37
60
  rescue => exception
38
61
  puts "Error : 'load #{ENV["HOME"]}/.irbrc' : #{exception.message}"
39
62
  end
63
+
@@ -293,18 +293,19 @@ args=($*)
293
293
  action="${args[0]:-""}"
294
294
  args=${args[@]:1} # Strip trailing / leading / extra spacing.
295
295
 
296
+
296
297
  if [[ -z "$action" ]] ; then list_rubies ; exit 0 ; fi
297
298
 
298
299
  case "$action" in
299
- known) list_known ;;
300
- known_strings) list_known_strings ;;
301
- gemsets) list_gemsets "$@" ;;
302
- default) list_default ;;
303
- rubies) list_rubies "$@" ;;
304
- strings) list_strings ;;
305
- ruby_svn_tags) list_ruby_svn_tags ;;
306
- help) usage ;;
307
- *) usage ; exit 1 ;;
300
+ known) list_known ;;
301
+ known_strings) list_known_strings ;;
302
+ gemsets) list_gemsets "$args" ;;
303
+ default) list_default ;;
304
+ rubies) list_rubies "$args" ;;
305
+ strings) list_strings ;;
306
+ ruby_svn_tags) list_ruby_svn_tags ;;
307
+ help) usage ;;
308
+ *) usage ; exit 1 ;;
308
309
  esac
309
310
 
310
311
  exit $?
@@ -7,7 +7,7 @@ if [[ "$rvm_trace_flag" -eq 2 ]] ; then set -x ; export rvm_trace_flag ; fi
7
7
 
8
8
  if [[ ! -z "$2" ]] ; then level=$1 ; shift ; else level="info" ; fi
9
9
 
10
- message="${1//%/%%}"
10
+ message="${1//\%/%%}"
11
11
 
12
12
  if [[ ${rvm_pretty_print_flag:-0} -eq 0 ]] ; then
13
13
 
@@ -373,7 +373,7 @@ export GEM_PATH="$rvm_ruby_gem_path"
373
373
  export MY_RUBY_HOME="$rvm_ruby_home"
374
374
  export PATH="$rvm_ruby_gem_home/bin:$rvm_ruby_global_gems_path/bin:$rvm_ruby_home/bin:\$PATH"
375
375
 
376
- exec "$macruby_path/mac$binary_name" "$prefix" "\$@"
376
+ exec "$macruby_path/mac$binary_name" "\$@"
377
377
  RubyWrapper
378
378
  )
379
379
 
@@ -575,7 +575,7 @@ RubyWrapper
575
575
 
576
576
  rvm_configure_flags="${rvm_configure_flags:-"--skip-system"}"
577
577
 
578
- rvm_ruby_configure="${rvm_bin_path:-"$rvm_path/bin"}/$ruby configure --prefix=$rvm_ruby_home $db_configure_flags $rvm_configure_flags" ; message="Configuring rbx"
578
+ rvm_ruby_configure="$rvm_path/wrappers/$ruby/ruby ./configure --prefix=$rvm_ruby_home $db_configure_flags $rvm_configure_flags" ; message="Configuring rbx"
579
579
 
580
580
  if [[ "$rvm_llvm_flag" = "0" ]] ; then
581
581
  rvm_ruby_configure="$rvm_ruby_configure --disable-llvm"
@@ -666,7 +666,11 @@ RubyWrapper
666
666
  builtin cd "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string"
667
667
 
668
668
  if [[ ${rvm_head_flag:-0} -eq 1 ]] ; then
669
+
670
+ __rvm_apply_patches
671
+
669
672
  __rvm_run "ant.dist" "ant dist" "$rvm_ruby_string - #ant dist"
673
+
670
674
  fi
671
675
 
672
676
  mkdir -p "$rvm_ruby_home/bin/"
@@ -2,5 +2,5 @@
2
2
 
3
3
  if [[ -z "${1:-""}" ]] || [[ -z "${2:-""}" ]] ; then exit 1 ; fi
4
4
 
5
- if [[ -n "$(echo "${1}" | awk "/${2}/")" ]] ; then exit 0 ; else exit 1 ; fi
5
+ if [[ -n "$(echo "${1}" | awk "/${2//\//\/}/")" ]] ; then exit 0 ; else exit 1 ; fi
6
6
 
@@ -5,12 +5,6 @@ if [[ "$rvm_trace_flag" -eq 2 ]] ; then set -x ; export rvm_trace_flag ; fi
5
5
  rvm_base_except="selector"
6
6
  source "$rvm_path/scripts/base"
7
7
 
8
- # Tools to make managing ruby dependencies inside of rvm easier.
9
- args=($*)
10
- action="${args[0]:-""}"
11
- library="${args[1]:-""}"
12
- args="$(echo ${args[@]:2})"
13
-
14
8
  install_package() {
15
9
 
16
10
  __rvm_db "${package}_url" "package_url"
@@ -18,56 +12,81 @@ install_package() {
18
12
  if [[ ! -z "$rvm_make_flags_flag" ]] ; then __rvm_make_flags ; fi
19
13
 
20
14
  (
21
- builtin cd "${rvm_src_path:-"$rvm_path/src"}"
15
+ builtin cd "$src_path"
22
16
 
23
- "$rvm_path/scripts/log" "info" "Fetching $package-$version.$archive_format to ${rvm_archives_path:-"$rvm_path/archives"}"
17
+ "$rvm_path/scripts/log" "info" \
18
+ "Fetching $package-$version.$archive_format to $archives_path"
24
19
 
25
- if [[ "$archive_format" = "tar.gz" ]] || [[ "$archive_format" = "tgz" ]] ; then
26
- "$rvm_path/scripts/fetch" \
27
- "$package_url/$package-$version.$archive_format" || (result=$? && return $result)
20
+ case "$archive_format" in
28
21
 
29
- __rvm_run "$package/extract" \
30
- "tar zxf ${rvm_archives_path:-"$rvm_path/archives"}/$package-$version.$archive_format -C ${rvm_src_path:-"$rvm_path/src"}" "Extracting $package-$version.$archive_format to ${rvm_src_path:-"$rvm_path/src"}"
22
+ tar.gz|tgz)
31
23
 
32
- elif [[ "$archive_format" = "tar.bz2" ]] ; then
33
- "$rvm_path/scripts/fetch" \
34
- "$package_url/$package-$version.$archive_format" || (result=$? && return $result)
24
+ "$rvm_path/scripts/fetch" \
25
+ "$package_url/$package-$version.$archive_format" \
26
+ || (result=$? && return $result)
35
27
 
36
- __rvm_run "$package/extract" \
37
- "tar jxf ${rvm_archives_path:-"$rvm_path/archives"}/$package-$version.$archive_format -C ${rvm_src_path:-"$rvm_path/src"}" "Extracting $package-$version.$archive_format to ${rvm_src_path:-"$rvm_path/src"}"
28
+ __rvm_run "$package/extract" \
29
+ "tar zxf $archives_path/$package-$version.$archive_format -C $src_path" \
30
+ "Extracting $package-$version.$archive_format to $src_path"
31
+ ;;
38
32
 
39
- elif [[ "$archive_format" = "zip" ]] ; then
40
- "$rvm_path/scripts/fetch" \
41
- "$package_url/$package-$version.$archive_format" || (result=$? && return $result)
33
+ tar.bz2)
42
34
 
43
- __rvm_run "$package/extract" \
44
- "unzip -q -o ${rvm_archives_path:-"$rvm_path/archives"}/$package-$version.$archive_format -d ${rvm_src_path:-"$rvm_path/src"}/$package-$version" "Extracting $package-$version.$archive_format to ${rvm_src_path:-"$rvm_path/src"}"
35
+ "$rvm_path/scripts/fetch" \
36
+ "$package_url/$package-$version.$archive_format" \
37
+ || (result=$? && return $result)
45
38
 
46
- else
47
- printf "\nUnrecognized archive format '$archive_format'" ; return 1
48
- fi
39
+ __rvm_run "$package/extract" \
40
+ "tar jxf $archives_path/$package-$version.$archive_format -C $src_path" \
41
+ "Extracting $package-$version.$archive_format to $src_path"
42
+
43
+ ;;
44
+
45
+ zip)
46
+
47
+ "$rvm_path/scripts/fetch" \
48
+ "$package_url/$package-$version.$archive_format" \
49
+ || (result=$? && return $result)
50
+
51
+ __rvm_run "$package/extract" \
52
+ "unzip -q -o $archives_path/$package-$version.$archive_format -d $src_path/$package-$version" \
53
+ "Extracting $package-$version.$archive_format to $src_path"
54
+ ;;
49
55
 
50
- builtin cd "${rvm_src_path:-"$rvm_path/src"}/$package-$version"
56
+ *)
57
+ printf "\nUnrecognized archive format '$archive_format'" ; return 1
58
+
59
+ esac
60
+
61
+ builtin cd "$src_path/$package-$version"
51
62
 
52
63
  __rvm_run "$package/configure" \
53
- "${configure:-"./configure --prefix=${prefix_path:-"${rvm_usr_path:-"$rvm_path/usr"}"}"} $configure_flags" "Configuring $package in ${rvm_src_path:-"$rvm_path/src"}/$package-$version."
64
+ "${configure:-"./configure --prefix=${prefix_path:-"$usr_path"}"} $configure_flags" \
65
+ "Configuring $package in $src_path/$package-$version."
54
66
 
55
67
  unset configure_flags
56
68
 
57
69
  if [[ "$action" = "uninstall" ]] ; then
70
+
58
71
  __rvm_run "$package/make.uninstall" \
59
- "/usr/bin/make uninstall" "Uninstalling $package from ${rvm_usr_path:-"$rvm_path/usr"}"
72
+ "/usr/bin/make uninstall" \
73
+ "Uninstalling $package from $usr_path"
60
74
 
61
75
  else
76
+
62
77
  __rvm_run "$package/make" \
63
- "/usr/bin/make $rvm_make_flags" "Compiling $package in ${rvm_src_path:-"$rvm_path/src"}/$package-$version."
78
+ "/usr/bin/make $rvm_make_flags" \
79
+ "Compiling $package in $src_path/$package-$version."
64
80
 
65
81
  __rvm_run "$package/make.install" \
66
- "/usr/bin/make install" "Installing $package to ${rvm_usr_path:-"$rvm_path/usr"}"
82
+ "/usr/bin/make install" \
83
+ "Installing $package to $usr_path"
84
+
67
85
  fi
68
86
 
69
87
  touch "$rvm_path/config/packages"
70
- "$rvm_path/scripts/db" "$rvm_path/config/packages" "${package}" "${version}"
88
+ "$rvm_path/scripts/db" \
89
+ "$rvm_path/config/packages" "${package}" "${version}"
71
90
  )
72
91
  result=$?
73
92
 
@@ -136,7 +155,7 @@ openssl() {
136
155
  else
137
156
  configure_command="./config"
138
157
  fi
139
- configure="$configure_command $openssl_os -I${rvm_usr_path:-"$rvm_path/usr"}/include -L${rvm_usr_path:-"$rvm_path/usr"}/lib --prefix=${rvm_usr_path:-"$rvm_path/usr"} zlib no-asm no-krb5 shared"
158
+ configure="$configure_command $openssl_os -I$usr_path/include -L$usr_path/lib --prefix=$usr_path zlib no-asm no-krb5 shared"
140
159
  install_package
141
160
  }
142
161
 
@@ -147,7 +166,7 @@ zlib() {
147
166
 
148
167
  autoconf() {
149
168
  package="autoconf" ; version="2.65" ; archive_format="tar.gz"
150
- prefix_path="${rvm_usr_path:-"$rvm_path/usr"}"
169
+ prefix_path="$usr_path"
151
170
  install_package
152
171
  }
153
172
 
@@ -170,7 +189,7 @@ gettext() {
170
189
  libxml2() {
171
190
  package="libxml2" ; version="2.7.3" ; archive_format="tar.gz"
172
191
  if [[ "Darwin" = "$(uname)" ]] ; then
173
- configure="./configure --prefix=${rvm_usr_path:-"$rvm_path/usr"} --build=i686-apple-darwin$(uname -r) --host=i686-apple-darwin$(uname -r)"
192
+ configure="./configure --prefix=$usr_path --build=i686-apple-darwin$(uname -r) --host=i686-apple-darwin$(uname -r)"
174
193
  fi
175
194
  install_package
176
195
  unset prefix_path
@@ -180,7 +199,7 @@ glib() {
180
199
  pkgconfig
181
200
  gettext
182
201
  package="glib" ; version="2.23.1" ; archive_format="tar.gz"
183
- configure="CC=\"cc -L${rvm_usr_path:-"$rvm_path/usr"}/lib -I${rvm_usr_path:-"$rvm_path/usr"}/include\" PKG_CONFIG=\"${rvm_usr_path:-"$rvm_path/usr"}/bin/pkg-config\" ./configure --prefix=${rvm_usr_path:-"$rvm_path/usr"}"
202
+ configure="CC=\"cc -L$usr_path/lib -I$usr_path/include\" PKG_CONFIG=\"$usr_path/bin/pkg-config\" ./configure --prefix=$usr_path"
184
203
 
185
204
  install_package
186
205
  }
@@ -197,12 +216,12 @@ llvm() {
197
216
  package="llvm" ; version="89156"
198
217
  if [[ ! -z "$rvm_make_flags_flag" ]] ; then __rvm_make_flags ; fi
199
218
  (
200
- builtin cd ${rvm_src_path:-"$rvm_path/src"}
201
- if [[ ! -d "${rvm_src_path:-"$rvm_path/src"}/llvm/.svn" ]] ; then
219
+ builtin cd $src_path
220
+ if [[ ! -d "$src_path/llvm/.svn" ]] ; then
202
221
  __rvm_db "${package}_url" "package_url"
203
- \rm -rf "${rvm_src_path:-"$rvm_path/src"}/llvm"
222
+ \rm -rf "$src_path/llvm"
204
223
  svn co -r "$version" "$package_url" llvm
205
- builtin cd "${rvm_src_path:-"$rvm_path/src"}/llvm"
224
+ builtin cd "$src_path/llvm"
206
225
  ./configure --enable-bindings=none
207
226
  UNIVERSAL=1 UNIVERSAL_ARCH="i386 x86_64" ENABLE_OPTIMIZED=1 make -j2
208
227
  sudo env UNIVERSAL=1 UNIVERSAL_ARCH="i386 x86_64" ENABLE_OPTIMIZED=1 make install
@@ -210,6 +229,16 @@ llvm() {
210
229
  )
211
230
  }
212
231
 
232
+ # Tools to make managing ruby dependencies inside of rvm easier.
233
+ args=($*)
234
+ action="${args[0]:-""}"
235
+ library="${args[1]:-""}"
236
+ args="$(echo ${args[@]:2})"
237
+
238
+ archives_path="${rvm_archives_path:-"$rvm_path/archives"}"
239
+ src_path="${rvm_src_path:-"$rvm_path/src"}"
240
+ usr_path="${rvm_usr_path:-"$rvm_path/usr"}"
241
+
213
242
  if [[ -n "$library" ]] ; then
214
243
 
215
244
  case $library in