rvm 0.1.44 → 0.1.45

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,71 @@
1
+ #!/usr/bin/env bash
2
+
3
+ unset GREP_OPTIONS
4
+ source "$rvm_scripts_path/base"
5
+
6
+ usage() {
7
+ echo "Usage: rvm upgrade prefix [existing-ruby]" >&2
8
+ echo "Upgrades the latest installed ruby with a given prefix (e.g. ree) to a new version." >&2
9
+ exit 1
10
+ }
11
+
12
+ confirm() {
13
+ printf "$1 (Y/n): "
14
+ local confirmation_response
15
+ read -r confirmation_response
16
+ [[ -z "$confirmation_response" ]] || echo "$confirmation_response" | grep -qi '^y'
17
+ }
18
+
19
+ die_with_error() {
20
+ $rvm_scripts_path/log "fail" "$1"
21
+ exit "${2:-1}"
22
+ }
23
+
24
+ expand_ruby_name() {
25
+ $rvm_scripts_path/tools strings "$1" | awk -F"$rvm_gemset_separator" '{print $1}'
26
+ }
27
+
28
+ expand_existing_ruby() {
29
+ local prefix="$(expand_ruby_name "$1" | awk -F'-' '{print $1"-"$2}')"
30
+ local ruby_name
31
+ while read -r ruby_name; do
32
+ if [[ "$ruby_name" != "$expanded_destination"* ]]; then
33
+ echo "$ruby_name"
34
+ return 0
35
+ fi
36
+ done < <($rvm_scripts_path/list strings | tr ' ' '\n' | sort -ur | grep "^$prefix" | grep -v '-head$' | head -n1)
37
+ return 1
38
+ }
39
+
40
+ upgrade_ruby() {
41
+ [[ -z "$source_ruby" ]] && die_with_error "Unable to find a source ruby. Please manually provide one."
42
+
43
+ expanded_source="$(expand_ruby_name "$source_ruby")"
44
+ [[ -z "$expanded_source" ]] && die_with_error "The source ruby was not a valid ruby string."
45
+
46
+ confirm "Are you sure you wish to upgrade from $expanded_source to $expanded_destination?" || die_with_error "Cancelling upgrade."
47
+
48
+ if [[ ! -d "$rvm_rubies_path/$expanded_destination" ]]; then
49
+ $rvm_scripts_path/log "info" "Installing new ruby $expanded_destination"
50
+ $rvm_bin_path/rvm install "$expanded_destination"
51
+ result="$?"
52
+ [[ "$result" -gt 0 ]] && die_with_error "Unable to install ruby $expanded_destination. Please install it manually to continue." "$result"
53
+ fi
54
+
55
+ $rvm_scripts_path/log "info" "Migrating gems from $expanded_source to $expanded_destination"
56
+ $rvm_scripts_path/migrate "$expanded_source" "$expanded_destination"
57
+ result="$?"
58
+ [[ "$result" -gt 0 ]] && die_with_error "Error migrating gems." "$result"
59
+
60
+ $rvm_scripts_path/log "info" "Upgrade complete!"
61
+ }
62
+
63
+ [[ -z "$1" ]] && usage
64
+
65
+ destination_ruby="$1"; shift
66
+ expanded_destination="$(expand_ruby_name "$destination_ruby")"
67
+ [[ -z "$expanded_destination" ]] && die_with_error "The destination ruby was not a valid ruby string."
68
+
69
+ source_ruby="${1:-"$(expand_existing_ruby "$destination_ruby")"}"
70
+
71
+ upgrade_ruby
@@ -54,7 +54,7 @@ __rvm_dump_environment() {
54
54
  fi
55
55
  unset rvm_dump_environment_flag
56
56
  }
57
-
57
+
58
58
  # Return a list of directories under a given base path.
59
59
  # Derived from rvm_ruby_string.
60
60
  __rvm_ruby_string_paths_under() {
@@ -214,12 +214,12 @@ __rvm_cleanup_variables() {
214
214
 
215
215
  if [[ "$rvm_sticky_flag" = "1" ]] ; then export rvm_gemset_name ; else unset rvm_gemset_name ; fi
216
216
 
217
- unset rvm_action rvm_irbrc_file rvm_command rvm_error_message rvm_url rvm_force_flag rvm_all_flag rvm_reconfigure_flag rvm_make_flags rvm_bin_flag rvm_import_flag rvm_export_flag rvm_self_flag rvm_gem_flag rvm_rubygems_flag rvm_debug_flag rvm_delete_flag rvm_summary_flag rvm_test_flag _rvm_spec_flag rvm_json_flag rvm_yaml_flag rvm_shebang_flag rvm_env_flag rvm_tail_flag rvm_use_flag rvm_dir_flag rvm_list_flag rvm_empty_flag rvm_file_name rvm_benchmark_flag rvm_clear_flag rvm_name_flag rvm_verbose_flag rvm_user_flag rvm_system_flag rvm_ruby_configure_flags rvm_uninstall_flag rvm_install_flag rvm_llvm_flag rvm_ruby_bits rvm_sticky_flag rvm_rvmrc_flag rvm_gems_flag rvm_only_path_flag rvm_docs_flag rvm_ruby_aliases rvm_ruby_aliases rvm_patch_names rvm_clang_flag rvm_install_arguments rvm_dump_environment_flag
217
+ unset rvm_action rvm_irbrc_file rvm_command rvm_error_message rvm_url rvm_force_flag rvm_all_flag rvm_reconfigure_flag rvm_make_flags rvm_bin_flag rvm_import_flag rvm_export_flag rvm_self_flag rvm_gem_flag rvm_rubygems_flag rvm_debug_flag rvm_delete_flag rvm_summary_flag rvm_test_flag _rvm_spec_flag rvm_json_flag rvm_yaml_flag rvm_shebang_flag rvm_env_flag rvm_tail_flag rvm_use_flag rvm_dir_flag rvm_list_flag rvm_empty_flag rvm_file_name rvm_benchmark_flag rvm_clear_flag rvm_name_flag rvm_verbose_flag rvm_user_flag rvm_system_flag rvm_ruby_configure_flags rvm_uninstall_flag rvm_install_flag rvm_llvm_flag rvm_ruby_bits rvm_sticky_flag rvm_rvmrc_flag rvm_gems_flag rvm_only_path_flag rvm_docs_flag rvm_ruby_aliases rvm_patch_names rvm_clang_flag rvm_install_arguments rvm_dump_environment_flag rvm_ruby_alias
218
218
  }
219
219
 
220
220
  # Unset ruby-specific variables
221
221
  __rvm_unset_ruby_variables() {
222
- unset rvm_ruby_interpreter rvm_ruby_version rvm_url rvm_ruby_repo_url rvm_ruby_package_name rvm_ruby_patch_level rvm_ruby_make rvm_ruby_make_install rvm_ruby_revision rvm_ruby_tag rvm_release_version rvm_major_version rvm_minor_version rvm_ruby_gem_home rvm_ruby_binary rvm_ruby_home rvm_ruby_log_path rvm_ruby_src_path rvm_ruby_irbrc rvm_ruby_selected_flag rvm_ruby_src_path rvm_ruby_repo_url rvm_major_version rvm_minor_version rvm_ruby_gem_home rvm_head_flag rvm_ruby_configure rvm_ruby_mode rvm_ruby_package_file rvm_ruby_package_name rvm_ruby_gem_path rvm_ruby_name rvm_ruby_alias rvm_ruby_strings rvm_ruby_repo_path
222
+ unset rvm_ruby_interpreter rvm_ruby_version rvm_url rvm_ruby_repo_url rvm_ruby_package_name rvm_ruby_patch_level rvm_ruby_make rvm_ruby_make_install rvm_ruby_revision rvm_ruby_tag rvm_release_version rvm_major_version rvm_minor_version rvm_ruby_gem_home rvm_ruby_binary rvm_ruby_home rvm_ruby_log_path rvm_ruby_src_path rvm_ruby_irbrc rvm_ruby_selected_flag rvm_ruby_src_path rvm_ruby_repo_url rvm_major_version rvm_minor_version rvm_ruby_gem_home rvm_head_flag rvm_ruby_configure rvm_ruby_mode rvm_ruby_package_file rvm_ruby_package_name rvm_ruby_gem_path rvm_ruby_name rvm_ruby_strings rvm_ruby_repo_path
223
223
  }
224
224
 
225
225
  # Usage: __rvm_with_env 'env-name' 'command'
@@ -292,7 +292,7 @@ __rvm_set_rvmrc() {
292
292
  fi
293
293
 
294
294
  local identifier=$(__rvm_environment_identifier)
295
- printf "if [[ -s \"$rvm_environments_path/$identifier\" ]] ; then\n . \"$rvm_environments_path/$identifier\"" > .rvmrc
295
+ printf "if [[ -n \"\$rvm_environments_path\" && -s \"\$rvm_environments_path/$identifier\" ]] ; then\n . \"\$rvm_environments_path/$identifier\"" > .rvmrc
296
296
  printf "\nelse\n rvm --create $flags \"$identifier\"\nfi" >> .rvmrc
297
297
 
298
298
  unset flags
@@ -455,7 +455,7 @@ __rvm_update_rvm() {
455
455
  if [[ -d "$rvm_src_path/rvm/.git" ]] ; then
456
456
  builtin cd "$rvm_src_path/rvm/" && git pull origin master && ./scripts/install
457
457
  else
458
- builtin cd "$rvm_src_path" && git clone http://github.com/wayneeseguin/rvm.git && builtin cd rvm/ && ./scripts/install
458
+ builtin cd "$rvm_src_path" && ( git clone --depth 1 git://github.com/wayneeseguin/rvm.git || git clone http://github.com/wayneeseguin/rvm.git ) && builtin cd rvm/ && ./scripts/install
459
459
  fi
460
460
  else
461
461
  stable_version="$(curl -s http://rvm.beginrescueend.com/releases/stable-version.txt)"
@@ -587,15 +587,15 @@ __rvm_become() {
587
587
  { __rvm_ruby_string && __rvm_select && __rvm_use; } > /dev/null 2>&1
588
588
  }
589
589
 
590
- __rvm_ensure_has_enviroment_files() {
590
+ __rvm_ensure_has_environment_files() {
591
591
  local environment_identifier="$(__rvm_environment_identifier)"
592
592
  file_name="${rvm_environments_path}/$environment_identifier"
593
593
 
594
594
  # Ensure system is a blank file.
595
595
  if [[ "$environment_identifier" == "system" ]]; then
596
- rm -f "$file_name"
596
+ rm -f "$file_name" 2>&1 | grep -v 'rm: cannot remove .* Permission denied'
597
597
  mkdir -p "$(dirname "$file_name")"
598
- touch "$file_name"
598
+ touch "$file_name" 2>&1 | grep -v 'touch: cannot touch .* Permission denied'
599
599
  return
600
600
  fi
601
601
 
@@ -724,7 +724,6 @@ __rvm_recorded_install_command() {
724
724
  fi
725
725
  }
726
726
 
727
-
728
727
  __rvm_environment_identifier() {
729
728
  ruby_string="$(command -v ruby)"
730
729
  if [ -n "$ruby_string" ] && echo "$ruby_string" | grep -q -F "$rvm_rubies_path"; then
@@ -733,4 +732,19 @@ __rvm_environment_identifier() {
733
732
  echo "system"
734
733
  fi
735
734
  unset ruby_string
736
- }
735
+ }
736
+
737
+ __rvm_expand_ruby_string() {
738
+ if [[ -z "$1" || "$1" = "all" || "$1" == "all-gemsets" ]]; then
739
+ $rvm_scripts_path/list gemsets strings
740
+ elif [[ "$1" == "all-rubies" || "$1" == "rubies" ]]; then
741
+ $rvm_scripts_path/list strings | tr ' ' "\n"
742
+ elif [[ "$1" == "current" || "$1" == "gemsets" ]]; then
743
+ local current_ruby="$(__rvm_environment_identifier | awk -F"$rvm_gemset_separator" '{print $1}')"
744
+ rvm_silence_logging=1 $rvm_scripts_path/gemsets list | sed "s/^/$current_ruby$rvm_gemset_separator/"
745
+ elif [[ "$1" == "aliases" ]]; then
746
+ cat "$rvm_config_path/alias" | awk -F= '{print $1}'
747
+ else
748
+ echo "$1" | tr "," "\n" | __rvm_strip
749
+ fi
750
+ }
@@ -7,7 +7,7 @@ unset rvm_default_flag rvm_wrapper_name
7
7
  source "$rvm_scripts_path/base"
8
8
 
9
9
  full_binary_name() {
10
- echo "$binary_name" | __rvm_strip
10
+ echo "$binary_name" | __rvm_strip
11
11
  }
12
12
 
13
13
  wrap() {
@@ -80,7 +80,7 @@ fi
80
80
  # Use the correct ruby.
81
81
  __rvm_become "$ruby_string"
82
82
 
83
- __rvm_ensure_has_enviroment_files
83
+ __rvm_ensure_has_environment_files
84
84
 
85
85
  environment_identifier="$(__rvm_environment_identifier)"
86
86
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rvm
3
3
  version: !ruby/object:Gem::Version
4
- hash: 67
4
+ hash: 65
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 44
10
- version: 0.1.44
9
+ - 45
10
+ version: 0.1.45
11
11
  platform: ruby
12
12
  authors:
13
13
  - Wayne E. Seguin
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-08-06 00:00:00 -04:00
18
+ date: 2010-08-11 00:00:00 -04:00
19
19
  default_executable: rvm-install
20
20
  dependencies: []
21
21
 
@@ -130,6 +130,7 @@ files:
130
130
  - scripts/manpages
131
131
  - scripts/match
132
132
  - scripts/md5
133
+ - scripts/migrate
133
134
  - scripts/monitor
134
135
  - scripts/notes
135
136
  - scripts/package
@@ -144,6 +145,7 @@ files:
144
145
  - scripts/snapshot
145
146
  - scripts/tools
146
147
  - scripts/update
148
+ - scripts/upgrade
147
149
  - scripts/utility
148
150
  - scripts/version
149
151
  - scripts/wrapper