rvm 1.1.4 → 1.1.5

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.
Files changed (112) hide show
  1. data/lib/VERSION.yml +1 -1
  2. data/lib/rvm/environment.rb +1 -1
  3. data/lib/rvm/shell/shell_wrapper.sh +1 -1
  4. data/rvm.gemspec +3 -110
  5. metadata +4 -111
  6. data/binscripts/rvm +0 -76
  7. data/binscripts/rvm-auto-ruby +0 -24
  8. data/binscripts/rvm-prompt +0 -208
  9. data/binscripts/rvm-shell +0 -35
  10. data/binscripts/rvm-update-head +0 -58
  11. data/binscripts/rvm-update-latest +0 -27
  12. data/binscripts/rvmsudo +0 -20
  13. data/config/db +0 -71
  14. data/config/known +0 -54
  15. data/config/md5 +0 -139
  16. data/contrib/gemset_snapshot +0 -25
  17. data/contrib/install-system-wide +0 -221
  18. data/contrib/r +0 -44
  19. data/examples/rvmrc +0 -49
  20. data/gemsets/default.gems +0 -1
  21. data/gemsets/global.gems +0 -1
  22. data/help/alias +0 -46
  23. data/help/benchmark +0 -17
  24. data/help/cleanup +0 -23
  25. data/help/debug +0 -8
  26. data/help/disk-usage +0 -15
  27. data/help/docs +0 -22
  28. data/help/exec +0 -33
  29. data/help/fetch +0 -5
  30. data/help/gem +0 -0
  31. data/help/gemdir +0 -0
  32. data/help/gemset +0 -14
  33. data/help/implode +0 -0
  34. data/help/info +0 -62
  35. data/help/install +0 -0
  36. data/help/list +0 -0
  37. data/help/migrate +0 -15
  38. data/help/monitor +0 -0
  39. data/help/notes +0 -0
  40. data/help/package +0 -0
  41. data/help/rake +0 -14
  42. data/help/remove +0 -0
  43. data/help/repair +0 -23
  44. data/help/reset +0 -0
  45. data/help/ruby +0 -84
  46. data/help/rubygems +0 -11
  47. data/help/rvmrc +0 -34
  48. data/help/snapshot +0 -15
  49. data/help/specs +0 -0
  50. data/help/srcdir +0 -0
  51. data/help/tests +0 -0
  52. data/help/tools +0 -22
  53. data/help/uninstall +0 -0
  54. data/help/update +0 -0
  55. data/help/upgrade +0 -18
  56. data/help/use +0 -0
  57. data/help/wrapper +0 -41
  58. data/install +0 -667
  59. data/man/man1/rvm.1 +0 -380
  60. data/man/man1/rvm.1.gz +0 -0
  61. data/scripts/alias +0 -226
  62. data/scripts/aliases +0 -4
  63. data/scripts/array +0 -32
  64. data/scripts/base +0 -57
  65. data/scripts/cd +0 -94
  66. data/scripts/cleanup +0 -58
  67. data/scripts/cli +0 -798
  68. data/scripts/color +0 -49
  69. data/scripts/completion +0 -151
  70. data/scripts/db +0 -87
  71. data/scripts/default +0 -64
  72. data/scripts/disk-usage +0 -60
  73. data/scripts/docs +0 -115
  74. data/scripts/env +0 -46
  75. data/scripts/environment-convertor +0 -74
  76. data/scripts/fetch +0 -231
  77. data/scripts/gemsets +0 -1045
  78. data/scripts/get +0 -126
  79. data/scripts/hash +0 -37
  80. data/scripts/help +0 -46
  81. data/scripts/hook +0 -23
  82. data/scripts/info +0 -213
  83. data/scripts/initialize +0 -29
  84. data/scripts/install +0 -667
  85. data/scripts/irbrc +0 -13
  86. data/scripts/irbrc.rb +0 -64
  87. data/scripts/list +0 -315
  88. data/scripts/log +0 -38
  89. data/scripts/maglev +0 -193
  90. data/scripts/manage +0 -2157
  91. data/scripts/match +0 -6
  92. data/scripts/md5 +0 -22
  93. data/scripts/migrate +0 -175
  94. data/scripts/monitor +0 -105
  95. data/scripts/notes +0 -140
  96. data/scripts/override_gem +0 -14
  97. data/scripts/package +0 -302
  98. data/scripts/patches +0 -64
  99. data/scripts/patchsets +0 -87
  100. data/scripts/repair +0 -199
  101. data/scripts/rubygems +0 -157
  102. data/scripts/rvm +0 -128
  103. data/scripts/rvm-install +0 -667
  104. data/scripts/selector +0 -904
  105. data/scripts/set +0 -301
  106. data/scripts/snapshot +0 -262
  107. data/scripts/tools +0 -58
  108. data/scripts/update +0 -667
  109. data/scripts/upgrade +0 -144
  110. data/scripts/utility +0 -1499
  111. data/scripts/version +0 -17
  112. data/scripts/wrapper +0 -210
@@ -1,301 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- source "$rvm_path/scripts/base"
4
-
5
- __rvm_attempt_single_exec()
6
- {
7
- # Return if we have multiple rubies. or we're not running exec.
8
- if [[ "$action" = "exec" && ${#rvm_ruby_strings[@]} -lt 2 ]]; then
9
-
10
- __rvm_become "$rvm_ruby_strings"
11
-
12
- eval "exec ${args[@]}"
13
- fi
14
-
15
- return 1
16
- }
17
-
18
- # Perform an action using one of a selected ruby's specified binaries.
19
- __rvm_ruby_do()
20
- {
21
- # Return on invalid rubies.
22
- __rvm_become "$current_set_ruby" || return 1
23
-
24
- rvm_hook="before_do" ; source "$rvm_path/scripts/hook"
25
-
26
- if [[ "$action" = "exec" ]]; then
27
- # Exec is a special case.
28
- command="${args[@]}"
29
-
30
- else
31
-
32
- binary="$(echo $action | sed 's#do$##')"
33
-
34
- if [[ -x "$rvm_ruby_home/bin/$binary" ]] ; then
35
-
36
- binary="$rvm_ruby_home/bin/$binary"
37
-
38
- elif [[ -x "$rvm_ruby_global_gems_path/bin/$binary" ]] ; then
39
-
40
- binary="$rvm_ruby_global_gems_path/bin/$binary"
41
-
42
- elif [[ -x "$rvm_ruby_gem_home/bin/$binary" ]] ; then
43
-
44
- binary="$rvm_ruby_gem_home/bin/$binary"
45
-
46
- elif [[ "system" = "$rvm_ruby_string" ]] && [[ -x "$(command -v $binary)" ]] ; then
47
-
48
- binary="$(basename $(command -v $binary) 2>/dev/null)"
49
-
50
- else
51
-
52
- "$rvm_path/scripts/log" "warn" \
53
- "'$binary not found for $rvm_ruby_string' either does not exist or is not executable? :("
54
-
55
- __rvm_unset_ruby_variables
56
-
57
- return 1
58
-
59
- fi
60
-
61
- if [[ ! -z "$rvm_ruby_mode" ]] ; then
62
-
63
- rvm_ruby_string="${rvm_ruby_string}-${rvm_ruby_mode}"
64
-
65
- rvm_ruby_mode="--$(echo "$rvm_ruby_mode" | sed 's/^m//')"
66
-
67
- fi
68
-
69
- load_path="$(dirname $(command -v $binary) 2>/dev/null):$rvm_ruby_load_path"
70
-
71
- # TODO: the else case below should be run if $args =~ /\.rb$/
72
- if [[ "ruby" = "$(basename $binary)" && "$rvm_benchmark_flag" -ne 1 ]] ; then
73
-
74
- case "${args[@]}" in
75
-
76
- *[:space:]-S[:space:]*)
77
- command="$binary $rvm_ruby_mode $rvm_ruby_require -I$load_path ${args[@]}"
78
- ;;
79
-
80
- *)
81
- command="$binary $rvm_ruby_mode $rvm_ruby_require -I$load_path -S ${args[@]}"
82
- ;;
83
-
84
- esac
85
-
86
- else
87
-
88
- command="$binary $rvm_ruby_mode ${args[@]}"
89
-
90
- fi
91
-
92
- fi
93
-
94
- if [[ -n "$rvm_json_flag" || -n "$rvm_yaml_flag" || -n "$rvm_summary_flag" ]] ; then
95
-
96
- if [[ ! -d "./log/$rvm_ruby_string/" ]] ; then
97
- mkdir -p "./log/$rvm_ruby_string/"
98
- fi
99
-
100
- touch "./log/$rvm_ruby_string/$action.log"
101
-
102
- eval "$command" >> "./log/$rvm_ruby_string/$action.log" 2>&1
103
-
104
- else
105
- if [[ ${rvm_verbose_flag:-0} -gt 0 ]] ; then
106
-
107
- current_env="$(__rvm_environment_identifier)"
108
-
109
- if [[ "$current_env" != "$current_set_ruby" ]]; then
110
-
111
- current_env="$current_set_ruby ($current_env)"
112
-
113
- fi
114
-
115
- "$rvm_path/scripts/log" "info" \
116
- "$current_env: $(ruby -v $rvm_ruby_mode | \tr "\n" ' ')\n"
117
-
118
- unset current_env
119
- fi
120
- eval "$command"
121
- fi
122
- result=$?
123
-
124
- string=$(basename $rvm_ruby_gem_home)
125
-
126
- if [[ $result -eq 0 ]]; then
127
-
128
- eval "successes=(${successes[*]} $string)"
129
-
130
- else
131
-
132
- eval "errors=(${errors[*]} $string)"
133
-
134
- fi
135
-
136
- eval "rubies=(${rubies[*]} $string)"
137
-
138
- eval "statuses=(${statuses[*]} $result)"
139
-
140
- unset string
141
-
142
- rvm_hook="after_do" ; source "$rvm_path/scripts/hook"
143
-
144
- __rvm_unset_ruby_variables
145
- }
146
-
147
- # Output the summary in a human readable format.
148
- __rvm_summary()
149
- {
150
- export successes errors statuses
151
-
152
- summary="\nSummary:\n\n"
153
-
154
- if [[ ${#successes[*]} -gt 0 ]] ; then
155
-
156
- summary="$summary \033[0;32m${#successes[*]} successful: $(echo "${successes[*]}" | sed 's# #, #g')\033[0m\n"
157
-
158
- fi
159
-
160
- if [[ ${#errors[*]} -gt 0 ]] ; then
161
-
162
- summary="$summary \033[0;31m${#errors[*]} errors: $(echo "${errors[*]}" | sed 's# #, #g')\033[0m\n"
163
-
164
- fi
165
-
166
- total=${#rubies[*]}
167
-
168
- if [[ -n "${ZSH_VERSION:-""}" ]] ; then array_start=1 ; else array_start=0 ; fi
169
-
170
- printf "$summary" | tee -a log/summary.log
171
-
172
- return ${#errors[*]}
173
-
174
- }
175
-
176
- # Output the summary in a yaml format.
177
- __rvm_yaml()
178
- {
179
- export successes errors statuses
180
-
181
- yaml="totals:\n rubies: ${#rubies[*]}\n successes: ${#successes[*]}\n errors: ${#errors[*]}\nsuccesses:"
182
-
183
- for var in ${successes[*]} ; do yaml="$yaml\n - $var" ; done
184
-
185
- yaml="$yaml\nerrors:"
186
-
187
- for var in ${errors[*]} ; do yaml="$yaml\n - $var" ; done
188
-
189
- yaml="$yaml\nrubies:"
190
-
191
- total=${#rubies[*]}
192
-
193
- if [[ -n "${ZSH_VERSION:-""}" ]] ; then array_start=1 ; else array_start=0 ; fi
194
-
195
- for (( index = $array_start ; index < $total + $array_start ; index++ )) ; do
196
-
197
- if [[ ${rvm_debug_flag:-0} -gt 0 ]] ; then
198
-
199
- "$rvm_path/scripts/log" "debug" "${rubies[$index]}: ${statuses[$index]}"
200
-
201
- fi
202
-
203
- yaml="$yaml\n \"${rubies[$index]}\": ${statuses[$index]}"
204
-
205
- done ; unset index array_start
206
-
207
- \mkdir -p log
208
-
209
- printf "$yaml" | tee -a log/summary.yaml
210
-
211
- return ${#errors[*]}
212
- }
213
-
214
- # Output the summary in a json format.
215
- __rvm_json()
216
- {
217
- local index array_start
218
-
219
- json="{
220
- \"totals\": { \"rubies\": ${#rubies[*]}, \"successes\": ${#successes[*]}, \"errors\": ${#errors[*]} },
221
- \"successful\": [$(echo \"${successes[*]}\" | sed 's# #", "#g' | sed 's#\"\"##')],
222
- \"errors\": [$(echo \"${errors[*]}\" | sed 's# #", "#g' | sed 's#\"\"##')],
223
- \"rubies\": { "
224
-
225
- total=${#rubies[*]}
226
- if [[ -n "${ZSH_VERSION:-""}" ]] ; then array_start=1 ; else array_start=0 ; fi
227
-
228
- for (( index = $array_start ; index < $total + $array_start ; index++ )) ; do
229
-
230
- if [[ ${rvm_debug_flag:-0} -gt 0 ]] ; then
231
-
232
- "$rvm_path/scripts/log" "debug" "${rubies[$index]}: ${statuses[$index]}"
233
-
234
- fi
235
-
236
- json="$json\n {\"${rubies[$index]}\": ${statuses[$index]}}"
237
-
238
- if (( $index + 1 < $total + $array_start )) ; then json="$json, " ; fi
239
-
240
- done
241
-
242
- json="$json\n }\n}"
243
-
244
- if [[ ! -d log ]] ; then
245
- mkdir -p log
246
- fi
247
-
248
- printf "$json" | tee -a log/summary.json
249
-
250
- return ${#errors[*]}
251
- }
252
-
253
- # Loop over a set or all rvm installed rubies to perform some action.
254
- # Record the results and report based on CLI selections.
255
-
256
- rubies=() ; successes=() ; errors=() ; statuses=()
257
-
258
- args=($*)
259
- action="${args[$__array_start]}"
260
- args[$__array_start]=""
261
- args=(${args[@]})
262
-
263
- if [[ -z "$action" ]] ; then
264
-
265
- "$rvm_path/scripts/log" "error" \
266
- "Action must be specified."
267
-
268
- exit 1
269
-
270
- fi
271
-
272
- if [[ "$action" == "ruby" ]] && echo "$args" | \grep -q "^'--[^[:space:]]*'$" ; then
273
-
274
- "$rvm_path/scripts/log" "warn" \
275
- "You called rvm ruby with the arguments $args which look like use options."
276
-
277
- "$rvm_path/scripts/log" "warn" \
278
- "Please note that 'rvm ruby' invokes set operations instead."
279
-
280
- fi
281
-
282
- rvm_ruby_strings=$(__rvm_expand_ruby_string "$rvm_ruby_strings")
283
-
284
- rvm_ruby_strings=(${rvm_ruby_strings//default}) # No quotes here is intentional.
285
-
286
- # Check for a single ruby && exec if present.
287
- __rvm_attempt_single_exec
288
-
289
- for current_set_ruby in ${rvm_ruby_strings[@]} ; do
290
- __rvm_ruby_do
291
- done
292
-
293
- if [[ ! -z "$rvm_summary_flag" ]] ; then __rvm_summary ; fi
294
-
295
- if [[ ! -z "$rvm_yaml_flag" ]] ; then __rvm_yaml ; fi
296
-
297
- if [[ ! -z "$rvm_json_flag" ]] ; then __rvm_json ; fi
298
-
299
- rvm_hook="after_do" ; source "$rvm_path/scripts/hook"
300
-
301
- exit ${#errors[*]}
@@ -1,262 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- unset GREP_COLOR
4
- unset GREP_OPTIONS
5
-
6
- source "$rvm_path/scripts/base"
7
-
8
- __error_on_result()
9
- {
10
- if [[ "$1" -gt 0 ]]; then
11
- "$rvm_path/scripts/log" "fail" "$2 - Aborting now."
12
- return 0
13
- else
14
- return 1
15
- fi
16
- }
17
-
18
- snapshot_save()
19
- {
20
- if [[ -z "$1" ]]; then
21
-
22
- printf "
23
-
24
- Usage:
25
-
26
- rvm snapshot save name
27
-
28
- Description:
29
-
30
- Saves a snapshot describing the rvm installation
31
- to <name>.tar.gz in the current working directory.\
32
-
33
- " >&2
34
-
35
- return 1
36
-
37
- fi
38
-
39
- # Create the temporary directory.
40
- local snapshot_temp_path="${rvm_tmp_path:-"$rvm_path/tmp"}/$$-snapshot"
41
-
42
- rm -rf "$snapshot_temp_path"
43
-
44
- mkdir -p "$snapshot_temp_path"
45
-
46
- "$rvm_path/scripts/log" "info" "Backing up a list of aliases"
47
- cp "$rvm_path/config/alias" "$snapshot_temp_path/"
48
-
49
- "$rvm_path/scripts/log" "info" "Backing up your user preferences"
50
- cp "$rvm_path/config/user" "$snapshot_temp_path/"
51
-
52
- "$rvm_path/scripts/log" "info" "Backing up your installed packages"
53
- sed -e 's/-//' -e 's/^lib//' < "$rvm_path/config/packages" | awk -F= '{print $1}' | sort | uniq > "$snapshot_temp_path/packages"
54
-
55
- "$rvm_path/scripts/log" "info" "Backing up all of your gemsets"
56
- mkdir -p "$snapshot_temp_path/gems"
57
-
58
- (
59
- builtin cd "$snapshot_temp_path/gems"
60
-
61
- for snapshot_gemset in $("$rvm_path/scripts/list" gemsets strings) ; do
62
-
63
- __rvm_become "$snapshot_gemset" ; result="$?"
64
-
65
- __error_on_result "$result" "Error becoming ruby $snapshot_gemset" && return "$result"
66
-
67
- "$rvm_path/scripts/gemsets" export "${snapshot_gemset}.gems" >/dev/null ; result="$?"
68
-
69
- __error_on_result "$result" "Error exporting gemset contents for $snapshot_gemset" && return "$result"
70
-
71
- mkdir -p "./$snapshot_gemset/"
72
-
73
- [[ -d "$GEM_HOME/cache/" ]] && \cp -R "$GEM_HOME/cache/" "./$snapshot_gemset/"
74
-
75
- done
76
- )
77
-
78
- "$rvm_path/scripts/log" "info" "Backing up all of your installed rubies"
79
-
80
- echo '#!/usr/bin/env bash -e' > "$snapshot_temp_path/install-rubies.sh"
81
-
82
- echo "source \"\$rvm_path/scripts/rvm\" || true" >> "$snapshot_temp_path/install-rubies.sh"
83
-
84
- local snapshot_ruby_name_file="${rvm_tmp_path:-"$rvm_path/tmp"}/$$-rubies"
85
-
86
- local snapshot_alias_name_file="${rvm_tmp_path:-"$rvm_path/tmp"}/$$-aliases"
87
-
88
- local snapshot_installable_file="${rvm_tmp_path:-"$rvm_path/tmp"}/$$-installable"
89
-
90
- "$rvm_path/scripts/alias" list | awk -F ' => ' '{print $1}' | sort | uniq 2>/dev/null > "$snapshot_alias_name_file"
91
-
92
- "$rvm_path/scripts/list" strings | \tr ' ' '\n' | sort | uniq > "$snapshot_ruby_name_file"
93
-
94
- comm -2 -3 "$snapshot_ruby_name_file" "$snapshot_alias_name_file" > "$snapshot_installable_file"
95
-
96
- rm -rf "$snapshot_ruby_name_file" "$snapshot_alias_name_file"
97
-
98
- local snapshot_primary_ruby="$(\grep '^\(ree\|ruby-1.8.7\)' < "$snapshot_installable_file" | \grep -v '-head$' | sort -r | head -n1)"
99
-
100
- local snapshot_ruby_order="$snapshot_primary_ruby $(\grep -v "$snapshot_primary_ruby" < "$snapshot_installable_file")"
101
-
102
- for snapshot_ruby_name in $snapshot_ruby_order ; do
103
-
104
- snapshot_install_command="$(__rvm_recorded_install_command "$snapshot_ruby_name")"
105
-
106
- if [[ -n "$snapshot_install_command" ]]; then
107
-
108
- echo "rvm install $snapshot_install_command" | sed "s#$rvm_path#'\\\"\$rvm_path\\\"'#" >> "$snapshot_temp_path/install-rubies.sh"
109
-
110
- else
111
-
112
- __rvm_become "$snapshot_ruby_name"
113
-
114
- ruby "$rvm_path/lib/rvm/install_command_dumper.rb" >> "$snapshot_temp_path/install-rubies.sh"
115
-
116
- fi
117
-
118
- unset snapshot_install_command
119
-
120
- done; unset snapshot_ruby_name snapshot_primary_ruby
121
-
122
- rm -rf "$snapshot_installable_file"
123
-
124
- "$rvm_path/scripts/log" "info" "Compressing snapshotting"
125
-
126
- local destination_path="$PWD"
127
- (
128
- builtin cd "$snapshot_temp_path"
129
- rm -rf "$destination_path/$1.tar.gz"
130
- tar czf "$destination_path/$1.tar.gz" .
131
- result="$?"
132
- __error_on_result "$result" "Error creating archive $destination_path/$1.tar.gz" && return "$result"
133
- )
134
-
135
- "$rvm_path/scripts/log" "info" "Cleaning up"
136
-
137
- rm -rf "$snapshot_temp_path"
138
-
139
- "$rvm_path/scripts/log" "info" "Snapshot complete"
140
- }
141
-
142
- snapshot_load()
143
- {
144
- local package_info
145
-
146
- if [[ -z "$1" ]]; then
147
- echo "Usage: rvm snapshot load name" >&2
148
- echo "Loads a snapshot from <name>.tar.gz in the current directory." >&2
149
- return 1
150
- fi
151
-
152
- local snapshot_archive="$PWD/$(echo "$1" | sed 's/.tar.gz$//').tar.gz"
153
-
154
- if ! [[ -s "$snapshot_archive" ]]; then
155
- echo "The provides snapshot '$(basename "$snapshot_archive")' doesn't exist." >&2
156
- return 1
157
- fi
158
-
159
- local snapshot_temp_path="${rvm_tmp_path:-"$rvm_path/tmp"}/$$-snapshot"
160
-
161
- \rm -rf "$snapshot_temp_path"
162
- \mkdir -p "$snapshot_temp_path"
163
-
164
- "$rvm_path/scripts/log" "info" "Extracting snapshot"
165
- (
166
- builtin cd "$snapshot_temp_path"
167
- tar xzf "$snapshot_archive"
168
- result="$?"
169
- __error_on_result "$result" "Error extracting the archive '$snapshot_archive'" && return "$result"
170
- )
171
-
172
- "$rvm_path/scripts/log" "info" "Restoring user settings"
173
- \cp -f "$snapshot_temp_path/user" "$rvm_path/config/user"
174
-
175
- "$rvm_path/scripts/log" "info" "Installing rvm-managed packages"
176
- for snapshot_package in $(cat "$snapshot_temp_path/packages"); do
177
- "$rvm_path/scripts/package" install "$snapshot_package"
178
- result="$?"
179
- __error_on_result "$result" "Error installing package '$snapshot_package'" && return "$result"
180
- done; unset snapshot_package
181
-
182
- "$rvm_path/scripts/log" "info" "Installing rubies"
183
-
184
- chmod +x "$snapshot_temp_path/install-rubies.sh"
185
-
186
- "$snapshot_temp_path/install-rubies.sh"
187
- result="$?"
188
-
189
- __error_on_result "$result" "Error importing rubies." && return "$result"
190
-
191
- export rvm_create_flag=1
192
-
193
- "$rvm_path/scripts/log" "info" "Setting up gemsets"
194
-
195
- (
196
- builtin cd "$snapshot_temp_path/gems"
197
-
198
- gems=($(find . -mindepth 0 -maxdepth 0 -type f -iname '*.gems' | sed 's/.gems$//'))
199
-
200
- for snapshot_gemset in "${gems[@]//.\/}" ; do
201
-
202
- __rvm_become "$snapshot_gemset"
203
- result="$?"
204
-
205
- __error_on_result "$result" \
206
- "Error becoming '$snapshot_gemset'" && return "$result"
207
-
208
- mkdir -p "$GEM_HOME/cache/"
209
-
210
- cp -Rf "$snapshot_gemset/" "$GEM_HOME/cache/"
211
- result="$?"
212
-
213
- __error_on_result "$result" \
214
- "Error copying across cache for $snapshot_gemset" && return "$result"
215
-
216
- "$rvm_path/scripts/gemsets" import "$snapshot_gemset" >/dev/null 2>&1
217
- result="$?"
218
-
219
- __error_on_result "$result" \
220
- "Error importing gemset for $snapshot_gemset" && return "$result"
221
- done
222
- )
223
-
224
- "$rvm_path/scripts/log" "info" "Restoring aliases"
225
-
226
- while read -r package_info; do
227
- # Note: this assumes an '=' int the input...
228
- local alias_name="${package_info/=*}"
229
- local alias_ruby="${package_info/*=}"
230
-
231
- "$rvm_path/scripts/alias" create "$alias_name" "$alias_ruby"
232
- if [[ "$alias_name" = "default" ]]; then
233
- (source "$rvm_path/scripts/rvm" && rvm use "$alias_ruby" --default) >/dev/null 2>&1
234
- result="$?"
235
- __error_on_result "$result" "Error setting default to $alias_ruby" && return "$result"
236
- fi
237
- done < "$snapshot_temp_path/alias"
238
-
239
- "$rvm_path/scripts/log" "info" "Cleaning up load process"
240
- \rm -rf "$snapshot_temp_path"
241
-
242
- "$rvm_path/scripts/log" "info" "Loaded snapshot from $(basename "$snapshot_archive")"
243
- }
244
-
245
- snapshot_usage()
246
- {
247
- echo "Usage: rvm snapshot {save,load} file" >&2
248
- return 1
249
- }
250
-
251
-
252
- args=($*)
253
- action="${args[0]}"
254
- args="$(echo ${args[@]:1}) " # Strip trailing / leading / extra spacing.
255
-
256
- case "$action" in
257
- save) snapshot_save "$args" ;;
258
- load) snapshot_load "$args" ;;
259
- *) snapshot_usage ;;
260
- esac
261
-
262
- exit $?