rvm 0.1.42 → 0.1.43
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.
- data/README +5 -0
- data/install +1 -1
- data/lib/VERSION.yml +1 -1
- data/lib/rvm/environment/tools.rb +21 -0
- data/lib/rvm/install_command_dumper.rb +51 -0
- data/rvm.gemspec +4 -2
- data/scripts/cli +12 -16
- data/scripts/disk-usage +0 -1
- data/scripts/install +1 -1
- data/scripts/list +14 -7
- data/scripts/manage +20 -1
- data/scripts/rvm-install +1 -1
- data/scripts/snapshot +189 -0
- data/scripts/tools +16 -1
- data/scripts/update +1 -1
- data/scripts/utility +44 -4
- metadata +6 -4
data/README
CHANGED
@@ -68,6 +68,9 @@ Action
|
|
68
68
|
specified ruby and gemset combination. Used under the hood for
|
69
69
|
passenger support and the like.
|
70
70
|
|
71
|
+
cleanup - Lets you remove stale source folders / archives and other miscellaneous
|
72
|
+
data associated with rvm.
|
73
|
+
|
71
74
|
ruby - runs a named ruby file against specified and/or all rubies
|
72
75
|
gem - runs a gem command using selected ruby's 'gem'
|
73
76
|
rake - runs a rake task against specified and/or all rubies
|
@@ -87,6 +90,8 @@ Action
|
|
87
90
|
http://rvm.beginrescueend.com/packages/
|
88
91
|
notes - Display notes, with operating system specifics.
|
89
92
|
|
93
|
+
snapshot - Let's your backup / restore an rvm installation in a lightweight manner.
|
94
|
+
|
90
95
|
Implementation
|
91
96
|
|
92
97
|
* ruby - MRI/YARV Ruby (The Gold Standard) {1.8.6,1.8.7,1.9.1,1.9.2...}
|
data/install
CHANGED
@@ -114,7 +114,7 @@ fi
|
|
114
114
|
|
115
115
|
spinner
|
116
116
|
|
117
|
-
mkdir -p $rvm_archives_path $rvm_src_path $rvm_log_path $rvm_bin_path $rvm_gems_path $rvm_rubies_path $rvm_config_path $rvm_hooks_path $
|
117
|
+
mkdir -p $rvm_archives_path $rvm_src_path $rvm_log_path $rvm_bin_path $rvm_gems_path $rvm_rubies_path $rvm_config_path $rvm_hooks_path $rvm_tmp_path
|
118
118
|
|
119
119
|
for file in README LICENCE ; do
|
120
120
|
spinner
|
data/lib/VERSION.yml
CHANGED
@@ -11,6 +11,19 @@ module RVM
|
|
11
11
|
normalize rvm(:tools, "path-identifier", path.to_s).stdout
|
12
12
|
end
|
13
13
|
|
14
|
+
def tools_strings(*rubies)
|
15
|
+
rubies = rubies.flatten.join(",").split(",").uniq
|
16
|
+
names = {}
|
17
|
+
value = rvm(:tools, :strings, *rubies)
|
18
|
+
if value.successful?
|
19
|
+
parts = value.stdout.split("\n").map { |l| l.split }
|
20
|
+
rubies.each_with_index do |key, index|
|
21
|
+
names[key] = normalize(parts[index])
|
22
|
+
end
|
23
|
+
end
|
24
|
+
names
|
25
|
+
end
|
26
|
+
|
14
27
|
# Return the tools wrapper.
|
15
28
|
def tools
|
16
29
|
@tools_wrapper ||= ToolsWrapper.new(self)
|
@@ -35,6 +48,14 @@ module RVM
|
|
35
48
|
end
|
36
49
|
alias identifier_for_path path_identifier
|
37
50
|
|
51
|
+
def strings(*rubies)
|
52
|
+
@parent.tools_strings(*rubies)
|
53
|
+
end
|
54
|
+
|
55
|
+
def expand_string(ruby)
|
56
|
+
strings(ruby)[ruby]
|
57
|
+
end
|
58
|
+
|
38
59
|
end
|
39
60
|
|
40
61
|
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# Prints out the rvm command (minus rvm install) to install this ruby.
|
2
|
+
|
3
|
+
RUBY_NAME = File.basename(ENV['MY_RUBY_HOME'])
|
4
|
+
RVM_HOME = ENV['rvm_path']
|
5
|
+
|
6
|
+
def ruby?(*names)
|
7
|
+
names.map { |n| n.to_s }.include?(RUBY_NAME.split("-").first)
|
8
|
+
end
|
9
|
+
|
10
|
+
def quote(value)
|
11
|
+
value = value.to_s.strip
|
12
|
+
value.empty? ? "" : "'#{value.gsub("'", "'\'\'")}'"
|
13
|
+
end
|
14
|
+
|
15
|
+
def normalize_argument(arg)
|
16
|
+
real_value, arg_value = arg.split("=", 2)
|
17
|
+
if !arg_value.nil?
|
18
|
+
real_value << "=#{quote(arg_value)}"
|
19
|
+
end
|
20
|
+
real_value.gsub("'#{RVM_HOME}", "'\"$rvm_path\"'")
|
21
|
+
end
|
22
|
+
|
23
|
+
def arguments_for_install
|
24
|
+
if ruby?(:ruby, :mput, :ree)
|
25
|
+
begin
|
26
|
+
require 'rbconfig'
|
27
|
+
require 'shellwords'
|
28
|
+
# Get the full arguments
|
29
|
+
config_args = Shellwords.shellwords(Config::CONFIG['configure_args'].to_s.strip)
|
30
|
+
real_arguments = []
|
31
|
+
config_args.each do |arg|
|
32
|
+
if ruby?(:ree) && arg == "--enable-mbari-api"
|
33
|
+
next
|
34
|
+
elsif arg =~ /^--prefix/
|
35
|
+
next
|
36
|
+
elsif arg =~ /^[^\-]/
|
37
|
+
next
|
38
|
+
else
|
39
|
+
real_arguments << normalize_argument(arg)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
config_args = real_arguments.join(",")
|
43
|
+
return "-C #{quote(config_args)}" unless config_args.strip.empty?
|
44
|
+
rescue LoadError
|
45
|
+
end
|
46
|
+
end
|
47
|
+
return ""
|
48
|
+
end
|
49
|
+
|
50
|
+
# Finally, print the string to install it.
|
51
|
+
puts "rvm install #{RUBY_NAME} #{arguments_for_install.gsub(/''+/, "'")}".strip
|
data/rvm.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{rvm}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.43"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Wayne E. Seguin"]
|
12
|
-
s.date = %q{2010-07-
|
12
|
+
s.date = %q{2010-07-21}
|
13
13
|
s.default_executable = %q{rvm-install}
|
14
14
|
s.description = %q{Manages Ruby interpreter environments and switching between them.}
|
15
15
|
s.email = %q{wayneeseguin@gmail.com}
|
@@ -78,6 +78,7 @@ Gem::Specification.new do |s|
|
|
78
78
|
"lib/rvm/environment/utility.rb",
|
79
79
|
"lib/rvm/environment/wrapper.rb",
|
80
80
|
"lib/rvm/errors.rb",
|
81
|
+
"lib/rvm/install_command_dumper.rb",
|
81
82
|
"lib/rvm/shell.rb",
|
82
83
|
"lib/rvm/shell/abstract_wrapper.rb",
|
83
84
|
"lib/rvm/shell/result.rb",
|
@@ -127,6 +128,7 @@ Gem::Specification.new do |s|
|
|
127
128
|
"scripts/rvm-install",
|
128
129
|
"scripts/selector",
|
129
130
|
"scripts/set",
|
131
|
+
"scripts/snapshot",
|
130
132
|
"scripts/tools",
|
131
133
|
"scripts/update",
|
132
134
|
"scripts/utility",
|
data/scripts/cli
CHANGED
@@ -10,6 +10,12 @@ __rvm_usage() { cat "${rvm_path:-$HOME/.rvm}/README" | ${PAGER:-less} ; }
|
|
10
10
|
#fi
|
11
11
|
#}
|
12
12
|
|
13
|
+
__rvm_run_script() {
|
14
|
+
local rvm_script_name="${1:-"$rvm_action"}"
|
15
|
+
eval "$rvm_scripts_path/$rvm_script_name $rvm_ruby_args"
|
16
|
+
return $?
|
17
|
+
}
|
18
|
+
|
13
19
|
__rvm_parse_args() {
|
14
20
|
|
15
21
|
# TODO:
|
@@ -44,6 +50,7 @@ __rvm_parse_args() {
|
|
44
50
|
install|uninstall)
|
45
51
|
export ${rvm_token}_flag=1
|
46
52
|
rvm_action=$rvm_token
|
53
|
+
export rvm_install_arguments="$(__rvm_quote_args_with_shift 1 "$@")"
|
47
54
|
;;
|
48
55
|
|
49
56
|
rm|remove)
|
@@ -125,7 +132,7 @@ __rvm_parse_args() {
|
|
125
132
|
rvm_parse_break=1
|
126
133
|
;;
|
127
134
|
|
128
|
-
exec|cleanup|tools|disk-usage)
|
135
|
+
exec|cleanup|tools|disk-usage|snapshot)
|
129
136
|
rvm_action="$rvm_token"
|
130
137
|
rvm_ruby_args="$(__rvm_quote_args "$@")"
|
131
138
|
rvm_parse_break=1
|
@@ -137,7 +144,6 @@ __rvm_parse_args() {
|
|
137
144
|
rvm_parse_break=1
|
138
145
|
;;
|
139
146
|
|
140
|
-
|
141
147
|
do|ruby|rake|gem|rubydo|rakedo|gemdo)
|
142
148
|
if [[ "do" = "$rvm_action" ]] ; then rvm_action="ruby" ; fi
|
143
149
|
rvm_action=$(echo $rvm_token | sed 's#do##g')
|
@@ -466,7 +472,7 @@ rvm() {
|
|
466
472
|
__rvm_initialize
|
467
473
|
__rvm_parse_args "$@"
|
468
474
|
|
469
|
-
export BUNDLE_PATH GEM_HOME GEM_PATH rvm_ruby_string rvm_action rvm_bin_flag rvm_debug_flag rvm_delete_flag rvm_docs_type rvm_file_name rvm_gemset_name rvm_head_flag rvm_install_on_use_flag rvm_interactive rvm_llvm_flag rvm_make_flags rvm_proxy rvm_remove_flag rvm_ruby_args rvm_ruby_configure_flags rvm_ruby_file rvm_ruby_gem_home rvm_ruby_interpreter rvm_ruby_name rvm_ruby_version rvm_system_flag rvm_trace_flag rvm_use_flag rvm_user_flag rvm_verbose_flag rvm_patch_names rvm_patch_original_pwd rvm_clang_flag
|
475
|
+
export BUNDLE_PATH GEM_HOME GEM_PATH rvm_ruby_string rvm_action rvm_bin_flag rvm_debug_flag rvm_delete_flag rvm_docs_type rvm_file_name rvm_gemset_name rvm_head_flag rvm_install_on_use_flag rvm_interactive rvm_llvm_flag rvm_make_flags rvm_proxy rvm_remove_flag rvm_ruby_args rvm_ruby_configure_flags rvm_ruby_file rvm_ruby_gem_home rvm_ruby_interpreter rvm_ruby_name rvm_ruby_version rvm_system_flag rvm_trace_flag rvm_use_flag rvm_user_flag rvm_verbose_flag rvm_patch_names rvm_patch_original_pwd rvm_clang_flag rvm_install_arguments
|
470
476
|
export rvm_path rvm_rubies_path rvm_scripts_path rvm_archives_path rvm_src_path rvm_patches_path rvm_patches_path rvm_patchsets_path rvm_log_path rvm_bin_path rvm_gems_path rvm_config_path rvm_tmp_path rvm_hooks_path rvm_gems_cache_path rvm_gemset_separator
|
471
477
|
|
472
478
|
result=0
|
@@ -530,18 +536,8 @@ rvm() {
|
|
530
536
|
unset old_rvm_ruby_string
|
531
537
|
;;
|
532
538
|
|
533
|
-
cleanup)
|
534
|
-
|
535
|
-
result=$?
|
536
|
-
;;
|
537
|
-
|
538
|
-
tools)
|
539
|
-
eval "$rvm_scripts_path/tools $rvm_ruby_args"
|
540
|
-
result=$?
|
541
|
-
;;
|
542
|
-
|
543
|
-
disk-usage)
|
544
|
-
eval "$rvm_scripts_path/disk-usage $rvm_ruby_args"
|
539
|
+
cleanup|tools|snapshot|disk-usage)
|
540
|
+
__rvm_run_script "$rvm_action"
|
545
541
|
result=$?
|
546
542
|
;;
|
547
543
|
|
@@ -620,7 +616,7 @@ rvm() {
|
|
620
616
|
if [[ ! -z "$rvm_reload_flag" ]] ; then
|
621
617
|
source "$rvm_scripts_path/rvm"
|
622
618
|
# Note: Not using builtin on purpose. Done so we can trigger a reload the rvmrc.
|
623
|
-
|
619
|
+
__rvm_project_rvmrc
|
624
620
|
fi
|
625
621
|
|
626
622
|
if [[ ! -z "$rvm_trace_flag" ]] ; then set +x ; unset rvm_trace_flag ; fi
|
data/scripts/disk-usage
CHANGED
data/scripts/install
CHANGED
@@ -114,7 +114,7 @@ fi
|
|
114
114
|
|
115
115
|
spinner
|
116
116
|
|
117
|
-
mkdir -p $rvm_archives_path $rvm_src_path $rvm_log_path $rvm_bin_path $rvm_gems_path $rvm_rubies_path $rvm_config_path $rvm_hooks_path $
|
117
|
+
mkdir -p $rvm_archives_path $rvm_src_path $rvm_log_path $rvm_bin_path $rvm_gems_path $rvm_rubies_path $rvm_config_path $rvm_hooks_path $rvm_tmp_path
|
118
118
|
|
119
119
|
for file in README LICENCE ; do
|
120
120
|
spinner
|
data/scripts/list
CHANGED
@@ -5,17 +5,19 @@ if [[ "$rvm_trace_flag" -eq 2 ]] ; then set -x ; export rvm_trace_flag ; fi
|
|
5
5
|
source "$rvm_scripts_path/utility"
|
6
6
|
|
7
7
|
list_gemsets() {
|
8
|
-
if [[ "$
|
8
|
+
if [[ "$1" = "strings" ]]; then
|
9
9
|
list_gemset_strings
|
10
10
|
return 0
|
11
11
|
fi
|
12
12
|
echo
|
13
13
|
|
14
14
|
current_ruby="$(__rvm_environment_identifier)"
|
15
|
+
local all_rubies="$(list_strings)"
|
15
16
|
|
16
17
|
printf "rvm gemsets\n"
|
17
18
|
for version in $(\ls $rvm_gems_path/ 2> /dev/null | awk '/[a-z]*-.*/ {print $NF}') ; do
|
18
19
|
ruby_version_name="$(echo "$version" | awk -F"$rvm_gemset_separator" '{print $1}')"
|
20
|
+
[[ "$all_rubies" != *"$ruby_version_name"* ]] && continue
|
19
21
|
if [[ -n "$(echo $version | awk '/^jruby-/')" ]] ; then
|
20
22
|
string="[ $($rvm_rubies_path/$ruby_version_name/bin/ruby -v | awk '{print $NF}' | sed -e 's/\[//' -e 's/\]//') ]"
|
21
23
|
elif [[ -n "$(echo $version | awk '/^maglev-|^macruby-/')" ]] ; then
|
@@ -48,8 +50,7 @@ list_gemsets() {
|
|
48
50
|
}
|
49
51
|
|
50
52
|
list_default() {
|
51
|
-
|
52
|
-
if [[ "$strings" = "string" ]] ; then
|
53
|
+
if [[ "$1" = "string" ]] ; then
|
53
54
|
$rvm_scripts_path/alias show default 2>/dev/null | awk -F"$rvm_gemset_separator" '{print $1}' | xargs basename
|
54
55
|
else
|
55
56
|
if [[ -L "$rvm_rubies_path/default" ]]; then
|
@@ -80,7 +81,12 @@ list_strings() {
|
|
80
81
|
|
81
82
|
# This is meant to be used with scripting.
|
82
83
|
list_gemset_strings() {
|
83
|
-
|
84
|
+
local all_rubies="$(list_strings)"
|
85
|
+
for gemset in $(\ls $rvm_gems_path/ 2>/dev/null | xargs -- basename | grep -v '^\(@\|doc$\|cache$\|system$\)' | sort); do
|
86
|
+
local ruby_name="$(echo "$gemset" | awk -F$rvm_gemset_separator '{print $1}')"
|
87
|
+
[[ "$all_rubies" != *"$ruby_name"* ]] && continue
|
88
|
+
echo "$gemset"
|
89
|
+
done
|
84
90
|
}
|
85
91
|
|
86
92
|
# This is meant to be used with scripting.
|
@@ -137,18 +143,19 @@ list_rubies() {
|
|
137
143
|
# List all rvm installed rubies, default ruby and system ruby.
|
138
144
|
# Display the rubies, indicate their architecture and indicate which is currently used.
|
139
145
|
# This is not meant to be used with scripting. This is for interactive mode usage only.
|
140
|
-
action="$
|
146
|
+
action="$1"
|
147
|
+
[[ $# -gt 0 ]] && shift
|
141
148
|
|
142
149
|
if [[ "known" = "$action" ]] ; then
|
143
150
|
list_known
|
144
151
|
elif [[ "known_strings" = "$action" ]] ; then
|
145
152
|
list_known_strings
|
146
153
|
elif [[ "gemsets" = "$action" ]] ; then
|
147
|
-
list_gemsets
|
154
|
+
list_gemsets "$@"
|
148
155
|
elif [[ "default" = "$action" ]] ; then
|
149
156
|
list_default
|
150
157
|
elif [[ -z "$action" ]] || [[ "rubies" = "$action" ]] ; then
|
151
|
-
list_rubies
|
158
|
+
list_rubies "$@"
|
152
159
|
elif [[ "strings" = "$action" ]] ; then
|
153
160
|
list_strings
|
154
161
|
elif [[ "ruby_svn_tags" = "$action" ]] ; then
|
data/scripts/manage
CHANGED
@@ -867,6 +867,9 @@ __rvm_uninstall_ruby() {
|
|
867
867
|
rm -f $rvm_bin_path/$rvm_ruby_string
|
868
868
|
fi
|
869
869
|
done ; unset dir
|
870
|
+
|
871
|
+
__rvm_remove_install_record "$rvm_ruby_string"
|
872
|
+
|
870
873
|
__rvm_remove_gemsets
|
871
874
|
|
872
875
|
__rvm_check_default
|
@@ -895,6 +898,7 @@ __rvm_remove_ruby() {
|
|
895
898
|
__rvm_check_default
|
896
899
|
|
897
900
|
done ; unset dir
|
901
|
+
__rvm_remove_install_record "$rvm_ruby_string"
|
898
902
|
__rvm_remove_gemsets
|
899
903
|
__rvm_remove_archives
|
900
904
|
__rvm_remove_aliases
|
@@ -1152,7 +1156,14 @@ __rvm_manage_rubies() {
|
|
1152
1156
|
|
1153
1157
|
if [[ -n "$rubies_string" ]] ;then
|
1154
1158
|
for rvm_ruby_string in $(echo "$rubies_string" | tr ',' ' ') ; do
|
1159
|
+
current_manage_ruby_string="$rvm_ruby_string"
|
1155
1160
|
eval "__rvm_${rvm_action}_ruby"
|
1161
|
+
result="$?"
|
1162
|
+
if [[ "$result" -gt 0 && "$manage_result" = 0 ]]; then
|
1163
|
+
manage_result="$result"
|
1164
|
+
fi
|
1165
|
+
[[ "$result" = 0 && "$rvm_action" = "install" ]] && __rvm_record_install "$current_manage_ruby_string"
|
1166
|
+
unset current_manage_ruby_string
|
1156
1167
|
__rvm_unset_ruby_variables
|
1157
1168
|
done
|
1158
1169
|
else # all
|
@@ -1160,8 +1171,16 @@ __rvm_manage_rubies() {
|
|
1160
1171
|
while read -r bin_line
|
1161
1172
|
do # Keep this on second line damnit!
|
1162
1173
|
if [[ -x "$bin_line" ]] ; then
|
1163
|
-
|
1174
|
+
current_manage_ruby_string="$(dirname "$bin_line" | xargs dirname | xargs basename)"
|
1175
|
+
rvm_ruby_string="$current_manage_ruby_string"
|
1164
1176
|
eval "__rvm_${rvm_action}_ruby"
|
1177
|
+
result="$?"
|
1178
|
+
if [[ "$result" -gt 0 && "$manage_result" = 0 ]]; then
|
1179
|
+
manage_result="$result"
|
1180
|
+
fi
|
1181
|
+
# record as current_manage_string to prevent it being overridden.
|
1182
|
+
[[ "$result" = 0 && "$rvm_action" = "install" ]] && __rvm_record_install "$current_manage_ruby_string"
|
1183
|
+
unset current_manage_ruby_string
|
1165
1184
|
__rvm_unset_ruby_variables
|
1166
1185
|
fi
|
1167
1186
|
done < <(\ls $rvm_rubies_path/*/bin/ruby 2> /dev/null)
|
data/scripts/rvm-install
CHANGED
@@ -114,7 +114,7 @@ fi
|
|
114
114
|
|
115
115
|
spinner
|
116
116
|
|
117
|
-
mkdir -p $rvm_archives_path $rvm_src_path $rvm_log_path $rvm_bin_path $rvm_gems_path $rvm_rubies_path $rvm_config_path $rvm_hooks_path $
|
117
|
+
mkdir -p $rvm_archives_path $rvm_src_path $rvm_log_path $rvm_bin_path $rvm_gems_path $rvm_rubies_path $rvm_config_path $rvm_hooks_path $rvm_tmp_path
|
118
118
|
|
119
119
|
for file in README LICENCE ; do
|
120
120
|
spinner
|
data/scripts/snapshot
ADDED
@@ -0,0 +1,189 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
|
3
|
+
unset GREP_COLOR
|
4
|
+
unset GREP_OPTIONS
|
5
|
+
|
6
|
+
source "$rvm_scripts_path/base"
|
7
|
+
|
8
|
+
__error_on_result() {
|
9
|
+
if [[ "$1" -gt 0 ]]; then
|
10
|
+
$rvm_scripts_path/log "fail" "$2 - Aborting now."
|
11
|
+
return 0
|
12
|
+
else
|
13
|
+
return 1
|
14
|
+
fi
|
15
|
+
}
|
16
|
+
|
17
|
+
snapshot_save() {
|
18
|
+
|
19
|
+
if [[ -z "$1" ]]; then
|
20
|
+
echo "Usage: rvm snapshot save name" >&2
|
21
|
+
echo "Saves a snapshot to <name>.tar.gz in the current directory." >&2
|
22
|
+
return 1
|
23
|
+
fi
|
24
|
+
|
25
|
+
# Create the temporary directory.
|
26
|
+
local snapshot_temp_path="$rvm_tmp_path/$$-snapshot"
|
27
|
+
rm -rf "$snapshot_temp_path"
|
28
|
+
mkdir -p "$snapshot_temp_path"
|
29
|
+
|
30
|
+
$rvm_scripts_path/log "info" "Backing up a list of aliases"
|
31
|
+
cp "$rvm_config_path/alias" "$snapshot_temp_path/"
|
32
|
+
|
33
|
+
$rvm_scripts_path/log "info" "Backing up your user preferences"
|
34
|
+
cp "$rvm_config_path/user" "$snapshot_temp_path/"
|
35
|
+
|
36
|
+
$rvm_scripts_path/log "info" "Backing up your installed packages"
|
37
|
+
cat "$rvm_config_path/packages" | sed -e 's/-//' -e 's/^lib//' | awk -F= '{print $1}' | sort | uniq > "$snapshot_temp_path/packages"
|
38
|
+
|
39
|
+
$rvm_scripts_path/log "info" "Backing up all of your gemsets"
|
40
|
+
mkdir -p "$snapshot_temp_path/gems"
|
41
|
+
__rvm_pushpop "$snapshot_temp_path/gems"
|
42
|
+
for snapshot_gemset in $($rvm_scripts_path/list gemsets strings) ; do
|
43
|
+
__rvm_become "$snapshot_gemset"
|
44
|
+
result="$?"
|
45
|
+
__error_on_result "$result" "Error becoming ruby $snapshot_gemset" && return "$result"
|
46
|
+
$rvm_scripts_path/gemsets export "${snapshot_gemset}.gems" >/dev/null
|
47
|
+
result="$?"
|
48
|
+
__error_on_result "$result" "Error exporting gemset contents for $snapshot_gemset" && return "$result"
|
49
|
+
mkdir -p "./$snapshot_gemset/"
|
50
|
+
[[ -d "$GEM_HOME/cache/" ]] && cp -R "$GEM_HOME/cache/" "./$snapshot_gemset/"
|
51
|
+
done; unset snapshot_gemset
|
52
|
+
__rvm_pushpop
|
53
|
+
|
54
|
+
$rvm_scripts_path/log "info" "Backing up all of your installed rubies"
|
55
|
+
echo '#!/usr/bin/env bash -e' > "$snapshot_temp_path/install-rubies.sh"
|
56
|
+
echo "source \"\$rvm_scripts_path/rvm\" || true" >> "$snapshot_temp_path/install-rubies.sh"
|
57
|
+
local snapshot_ruby_name_file="$rvm_tmp_path/$$-rubies"
|
58
|
+
local snapshot_alias_name_file="$rvm_tmp_path/$$-aliases"
|
59
|
+
local snapshot_installable_file="$rvm_tmp_path/$$-installable"
|
60
|
+
|
61
|
+
$rvm_scripts_path/alias list | awk -F ' => ' '{print $1}' | sort | uniq 2>/dev/null > "$snapshot_alias_name_file"
|
62
|
+
$rvm_scripts_path/list strings | tr ' ' '\n' | sort | uniq > "$snapshot_ruby_name_file"
|
63
|
+
comm -2 -3 "$snapshot_ruby_name_file" "$snapshot_alias_name_file" > "$snapshot_installable_file"
|
64
|
+
rm -rf "$snapshot_ruby_name_file" "$snapshot_alias_name_file"
|
65
|
+
|
66
|
+
local snapshot_primary_ruby="$(cat "$snapshot_installable_file" | grep '^\(ree\|ruby-1.8.7\)' | grep -v '-head$' | sort -r | head -n1)"
|
67
|
+
local snapshot_ruby_order="$snapshot_primary_ruby $(cat "$snapshot_installable_file" | grep -v "$snapshot_primary_ruby")"
|
68
|
+
for snapshot_ruby_name in $snapshot_ruby_order ; do
|
69
|
+
snapshot_install_command="$(__rvm_recorded_install_command "$snapshot_ruby_name")"
|
70
|
+
if [[ -n "$snapshot_install_command" ]]; then
|
71
|
+
echo "rvm install $snapshot_install_command" | sed "s#$rvm_path#'\\\"\$rvm_path\\\"'#" >> "$snapshot_temp_path/install-rubies.sh"
|
72
|
+
else
|
73
|
+
__rvm_become "$snapshot_ruby_name"
|
74
|
+
ruby "$rvm_path/lib/rvm/install_command_dumper.rb" >> "$snapshot_temp_path/install-rubies.sh"
|
75
|
+
fi
|
76
|
+
unset snapshot_install_command
|
77
|
+
done; unset snapshot_ruby_name snapshot_primary_ruby
|
78
|
+
|
79
|
+
rm -rf "$snapshot_installable_file"
|
80
|
+
|
81
|
+
$rvm_scripts_path/log "info" "Compressing snapshotting"
|
82
|
+
local destination_path="$PWD"
|
83
|
+
__rvm_pushpop "$snapshot_temp_path"
|
84
|
+
rm -rf "$destination_path/$1.tar.gz"
|
85
|
+
tar czf "$destination_path/$1.tar.gz" .
|
86
|
+
result="$?"
|
87
|
+
__error_on_result "$result" "Error creating archive $destination_path/$1.tar.gz" && return "$result"
|
88
|
+
__rvm_pushpop
|
89
|
+
|
90
|
+
$rvm_scripts_path/log "info" "Cleaning up"
|
91
|
+
rm -rf "$snapshot_temp_path"
|
92
|
+
|
93
|
+
$rvm_scripts_path/log "info" "Snapshot complete"
|
94
|
+
|
95
|
+
}
|
96
|
+
|
97
|
+
snapshot_load() {
|
98
|
+
if [[ -z "$1" ]]; then
|
99
|
+
echo "Usage: rvm snapshot load name" >&2
|
100
|
+
echo "Loads a snapshot from <name>.tar.gz in the current directory." >&2
|
101
|
+
return 1
|
102
|
+
fi
|
103
|
+
|
104
|
+
local snapshot_archive="$PWD/$(echo "$1" | sed 's/.tar.gz$//').tar.gz"
|
105
|
+
|
106
|
+
if ! [[ -s "$snapshot_archive" ]]; then
|
107
|
+
echo "The provides snapshot '$(basename "$snapshot_archive")' doesn't exist." >&2
|
108
|
+
return 1
|
109
|
+
fi
|
110
|
+
|
111
|
+
local snapshot_temp_path="$rvm_tmp_path/$$-snapshot"
|
112
|
+
|
113
|
+
rm -rf "$snapshot_temp_path"
|
114
|
+
mkdir -p "$snapshot_temp_path"
|
115
|
+
|
116
|
+
$rvm_scripts_path/log "info" "Extracting snapshot"
|
117
|
+
__rvm_pushpop "$snapshot_temp_path"
|
118
|
+
tar xzf "$snapshot_archive"
|
119
|
+
result="$?"
|
120
|
+
__error_on_result "$result" "Error extracting the archive '$snapshot_archive'" && return "$result"
|
121
|
+
__rvm_pushpop
|
122
|
+
|
123
|
+
$rvm_scripts_path/log "info" "Restoring user settings"
|
124
|
+
cp -f "$snapshot_temp_path/user" "$rvm_config_path/user"
|
125
|
+
|
126
|
+
$rvm_scripts_path/log "info" "Installing rvm-managed packages"
|
127
|
+
for snapshot_package in $(cat "$snapshot_temp_path/packages"); do
|
128
|
+
$rvm_scripts_path/package install "$snapshot_package"
|
129
|
+
result="$?"
|
130
|
+
__error_on_result "$result" "Error installing package '$snapshot_package'" && return "$result"
|
131
|
+
done; unset snapshot_package
|
132
|
+
|
133
|
+
$rvm_scripts_path/log "info" "Installing rubies"
|
134
|
+
chmod +x "$snapshot_temp_path/install-rubies.sh"
|
135
|
+
$snapshot_temp_path/install-rubies.sh
|
136
|
+
result="$?"
|
137
|
+
__error_on_result "$result" "Error importing rubies." && return "$result"
|
138
|
+
|
139
|
+
export rvm_create_flag=1
|
140
|
+
$rvm_scripts_path/log "info" "Setting up gemsets"
|
141
|
+
__rvm_pushpop "$snapshot_temp_path/gems"
|
142
|
+
for snapshot_gemset in $(\ls | grep '\.gems$' | sed 's/.gems$//'); do
|
143
|
+
__rvm_become "$snapshot_gemset"
|
144
|
+
result="$?"
|
145
|
+
__error_on_result "$result" "Error becoming '$snapshot_gemset'" && return "$result"
|
146
|
+
mkdir -p "$GEM_HOME/cache/"
|
147
|
+
cp -Rf "$snapshot_gemset/" "$GEM_HOME/cache/"
|
148
|
+
result="$?"
|
149
|
+
__error_on_result "$result" "Error copying across cache for $snapshot_gemset" && return "$result"
|
150
|
+
$rvm_scripts_path/gemsets import "$snapshot_gemset" >/dev/null 2>&1
|
151
|
+
result="$?"
|
152
|
+
__error_on_result "$result" "Error importing gemset for $snapshot_gemset" && return "$result"
|
153
|
+
done; unset snapshot_gemset
|
154
|
+
__rvm_pushpop
|
155
|
+
|
156
|
+
$rvm_scripts_path/log "info" "Restoring aliases"
|
157
|
+
while read -r package_info; do
|
158
|
+
local alias_name="$(echo "$package_info" | awk -F= '{print $1}')"
|
159
|
+
local alias_ruby="$(echo "$package_info" | awk -F= '{print $2}')"
|
160
|
+
$rvm_scripts_path/alias create "$alias_name" "$alias_ruby"
|
161
|
+
if [[ "$alias_name" = "default" ]]; then
|
162
|
+
(source "$rvm_scripts_path/rvm" && rvm use "$alias_ruby" --default) >/dev/null 2>&1
|
163
|
+
result="$?"
|
164
|
+
__error_on_result "$result" "Error setting default to $alias_ruby" && return "$result"
|
165
|
+
fi
|
166
|
+
done < "$snapshot_temp_path/alias"
|
167
|
+
unset package_info
|
168
|
+
|
169
|
+
$rvm_scripts_path/log "info" "Cleaning up load process"
|
170
|
+
rm -rf "$snapshot_temp_path"
|
171
|
+
|
172
|
+
$rvm_scripts_path/log "info" "Loaded snapshot from $(basename "$snapshot_archive")"
|
173
|
+
}
|
174
|
+
|
175
|
+
snapshot_usage() {
|
176
|
+
echo "Usage: rvm snapshot {save,load} file" >&2
|
177
|
+
return 1
|
178
|
+
}
|
179
|
+
|
180
|
+
action="$1"
|
181
|
+
[[ "$#" -gt 0 ]] && shift
|
182
|
+
|
183
|
+
case "$action" in
|
184
|
+
save) snapshot_save "$@" ;;
|
185
|
+
load) snapshot_load "$@" ;;
|
186
|
+
*) snapshot_usage ;;
|
187
|
+
esac
|
188
|
+
|
189
|
+
exit $?
|
data/scripts/tools
CHANGED
@@ -1,7 +1,9 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
|
1
3
|
source "$rvm_scripts_path/base"
|
2
4
|
|
3
5
|
usage() {
|
4
|
-
echo "Usage: rvm tools {identifier,path-identifier}" 1>&2
|
6
|
+
echo "Usage: rvm tools {identifier,path-identifier,strings}" 1>&2
|
5
7
|
exit 1
|
6
8
|
}
|
7
9
|
|
@@ -21,6 +23,18 @@ tools_path_identifier() {
|
|
21
23
|
__rvm_environment_identifier)
|
22
24
|
}
|
23
25
|
|
26
|
+
tools_strings() {
|
27
|
+
for ruby_name in "$@"; do
|
28
|
+
__rvm_unset_ruby_variables
|
29
|
+
rvm_ruby_string="$ruby_name"
|
30
|
+
if { __rvm_ruby_string && __rvm_select; } >/dev/null 2>&1; then
|
31
|
+
basename "$rvm_ruby_gem_home"
|
32
|
+
else
|
33
|
+
echo ""
|
34
|
+
fi
|
35
|
+
done
|
36
|
+
}
|
37
|
+
|
24
38
|
[[ -z "$1" ]] && usage
|
25
39
|
|
26
40
|
action="$1"; shift
|
@@ -28,6 +42,7 @@ action="$1"; shift
|
|
28
42
|
case "$action" in
|
29
43
|
identifier) tools_identifier ;;
|
30
44
|
path-identifier) tools_path_identifier "$@" ;;
|
45
|
+
strings) tools_strings "$@" ;;
|
31
46
|
*) usage ;;
|
32
47
|
esac
|
33
48
|
|
data/scripts/update
CHANGED
@@ -114,7 +114,7 @@ fi
|
|
114
114
|
|
115
115
|
spinner
|
116
116
|
|
117
|
-
mkdir -p $rvm_archives_path $rvm_src_path $rvm_log_path $rvm_bin_path $rvm_gems_path $rvm_rubies_path $rvm_config_path $rvm_hooks_path $
|
117
|
+
mkdir -p $rvm_archives_path $rvm_src_path $rvm_log_path $rvm_bin_path $rvm_gems_path $rvm_rubies_path $rvm_config_path $rvm_hooks_path $rvm_tmp_path
|
118
118
|
|
119
119
|
for file in README LICENCE ; do
|
120
120
|
spinner
|
data/scripts/utility
CHANGED
@@ -85,6 +85,12 @@ __rvm_quote_args() {
|
|
85
85
|
echo "$quoted_string" | sed -e 's/^ *//g' -e 's/ *$//g'
|
86
86
|
}
|
87
87
|
|
88
|
+
__rvm_quote_args_with_shift() {
|
89
|
+
local shift_value="$1"; shift
|
90
|
+
local program_args=( "$@" )
|
91
|
+
__rvm_quote_args "${program_args[@]:$shift_value}"
|
92
|
+
}
|
93
|
+
|
88
94
|
__rvm_warn_on_rubyopt() {
|
89
95
|
if [[ -n "$RUBYOPT" ]]; then
|
90
96
|
$rvm_scripts_path/log "warn" "Please note: You have the RUBYOPT environment variable set and this may interfere with normal rvm operations. We sugges unsetting it."
|
@@ -180,7 +186,7 @@ __rvm_cleanup_variables() {
|
|
180
186
|
|
181
187
|
if [[ "$rvm_sticky_flag" = "1" ]] ; then export rvm_gemset_name ; else unset rvm_gemset_name ; fi
|
182
188
|
|
183
|
-
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
|
189
|
+
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
|
184
190
|
}
|
185
191
|
|
186
192
|
# Unset ruby-specific variables
|
@@ -217,9 +223,9 @@ __rvm_ensure_has_18_compat_ruby() {
|
|
217
223
|
if [[ -z "$(__rvm_18_compat_ruby)" ]]; then
|
218
224
|
# TODO: install currently doesn't return the correct status.
|
219
225
|
local compat_result=0
|
220
|
-
if ! (
|
221
|
-
$rvm_scripts_path/log "
|
222
|
-
$rvm_scripts_path/log "
|
226
|
+
if ! ( $rvm_scripts_path/manage install 1.8.7 ); then
|
227
|
+
$rvm_scripts_path/log "fail" "To proceed rvm requires a 1.8-compatible ruby is installed. We attempted to install 1.8.7 automatically but it failed."
|
228
|
+
$rvm_scripts_path/log "fail" "Please install it manually (or a compatible alternative) to proceed."
|
223
229
|
compat_result=1
|
224
230
|
fi
|
225
231
|
unset original_ruby
|
@@ -786,3 +792,37 @@ __rvm_project_rvmrc() {
|
|
786
792
|
fi
|
787
793
|
done
|
788
794
|
}
|
795
|
+
|
796
|
+
__rvm_record_install() {
|
797
|
+
[[ -z "$1" ]] && return
|
798
|
+
local recorded_ruby_name="$($rvm_scripts_path/tools strings "$1")"
|
799
|
+
local rvm_install_record_file="$rvm_config_path/installs"
|
800
|
+
local rvm_install_command="$(echo "$recorded_ruby_name $rvm_install_arguments" | __rvm_strip)"
|
801
|
+
touch "$rvm_install_record_file"
|
802
|
+
rm -f "$rvm_install_record_file.tmp"
|
803
|
+
cat "$rvm_install_record_file" | grep -v "^$recorded_ruby_name " > "$rvm_install_record_file.tmp"
|
804
|
+
echo "$rvm_install_command" >> "$rvm_install_record_file.tmp"
|
805
|
+
rm -f "$rvm_install_record_file"
|
806
|
+
mv "$rvm_install_record_file.tmp" "$rvm_install_record_file"
|
807
|
+
}
|
808
|
+
|
809
|
+
__rvm_remove_install_record() {
|
810
|
+
local recorded_ruby_name="$($rvm_scripts_path/tools strings "$1")"
|
811
|
+
local rvm_install_record_file="$rvm_config_path/installs"
|
812
|
+
if [[ -s "$rvm_install_record_file" ]]; then
|
813
|
+
mv "$rvm_install_record_file" "$rvm_install_record_file.tmp"
|
814
|
+
cat "$rvm_install_record_file.tmp" | grep -v "^$recorded_ruby_name " > "$rvm_install_record_file"
|
815
|
+
rm -f "$rvm_install_record_file.tmp"
|
816
|
+
fi
|
817
|
+
}
|
818
|
+
|
819
|
+
__rvm_recorded_install_command() {
|
820
|
+
local recorded_ruby_name="$($rvm_scripts_path/tools strings "$1" | awk -F"$rvm_gemset_separator" '{print $1}')"
|
821
|
+
[[ -z "$recorded_ruby_name" ]] && return 1
|
822
|
+
local recorded_ruby_match="^$recorded_ruby_name "
|
823
|
+
if [[ -s "$rvm_config_path/installs" ]] && grep -q "$recorded_ruby_match" "$rvm_config_path/installs" ; then
|
824
|
+
cat "$rvm_config_path/installs" | grep "$recorded_ruby_match" | head -n1
|
825
|
+
else
|
826
|
+
return 1
|
827
|
+
fi
|
828
|
+
}
|
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:
|
4
|
+
hash: 77
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 43
|
10
|
+
version: 0.1.43
|
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-07-
|
18
|
+
date: 2010-07-21 00:00:00 -04:00
|
19
19
|
default_executable: rvm-install
|
20
20
|
dependencies: []
|
21
21
|
|
@@ -88,6 +88,7 @@ files:
|
|
88
88
|
- lib/rvm/environment/utility.rb
|
89
89
|
- lib/rvm/environment/wrapper.rb
|
90
90
|
- lib/rvm/errors.rb
|
91
|
+
- lib/rvm/install_command_dumper.rb
|
91
92
|
- lib/rvm/shell.rb
|
92
93
|
- lib/rvm/shell/abstract_wrapper.rb
|
93
94
|
- lib/rvm/shell/result.rb
|
@@ -137,6 +138,7 @@ files:
|
|
137
138
|
- scripts/rvm-install
|
138
139
|
- scripts/selector
|
139
140
|
- scripts/set
|
141
|
+
- scripts/snapshot
|
140
142
|
- scripts/tools
|
141
143
|
- scripts/update
|
142
144
|
- scripts/utility
|