gemrage 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +2 -0
- data/Gemfile.lock +5 -0
- data/VERSION +1 -1
- data/gemrage.gemspec +148 -3
- data/lib/rubygems/commands/scan_command.rb +77 -4
- data/vendor/ruby/1.8/bin/rvm-install +19 -0
- data/vendor/ruby/1.8/cache/macaddr-1.0.0.gem +0 -0
- data/vendor/ruby/1.8/cache/rvm-1.0.14.gem +0 -0
- data/vendor/ruby/1.8/gems/macaddr-1.0.0/README +33 -0
- data/vendor/ruby/1.8/gems/macaddr-1.0.0/gemspec.rb +27 -0
- data/vendor/ruby/1.8/gems/macaddr-1.0.0/install.rb +210 -0
- data/vendor/ruby/1.8/gems/macaddr-1.0.0/lib/macaddr.rb +69 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/LICENCE +18 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/README +127 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/bin/rvm-install +5 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/binscripts/rvm +76 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/binscripts/rvm-auto-ruby +24 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/binscripts/rvm-prompt +204 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/binscripts/rvm-shell +35 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/binscripts/rvm-update-head +35 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/binscripts/rvm-update-latest +27 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/binscripts/rvmsudo +24 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/config/db +71 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/config/known +55 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/config/md5 +87 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/contrib/gemset_snapshot +25 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/contrib/install-system-wide +191 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/contrib/r +44 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/examples/rvmrc +47 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/gemsets/default.gems +1 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/gemsets/global.gems +1 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/help/alias +46 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/help/benchmark +17 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/help/cleanup +23 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/help/debug +8 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/help/disk-usage +15 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/help/docs +22 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/help/exec +33 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/help/fetch +5 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/help/gem +0 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/help/gemdir +0 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/help/gemset +0 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/help/implode +0 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/help/info +64 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/help/install +0 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/help/list +0 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/help/migrate +15 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/help/monitor +0 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/help/notes +0 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/help/package +0 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/help/rake +14 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/help/remove +0 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/help/repair +23 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/help/reset +0 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/help/ruby +84 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/help/rubygems +11 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/help/rvmrc +34 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/help/snapshot +15 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/help/specs +0 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/help/srcdir +0 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/help/tests +0 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/help/tools +22 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/help/uninstall +0 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/help/update +0 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/help/upgrade +18 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/help/use +0 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/help/wrapper +41 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/install +631 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/lib/VERSION.yml +4 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/lib/rvm/capistrano.rb +45 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/lib/rvm/environment/alias.rb +69 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/lib/rvm/environment/cleanup.rb +54 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/lib/rvm/environment/configuration.rb +60 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/lib/rvm/environment/env.rb +52 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/lib/rvm/environment/gemset.rb +222 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/lib/rvm/environment/info.rb +13 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/lib/rvm/environment/list.rb +124 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/lib/rvm/environment/rubies.rb +50 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/lib/rvm/environment/sets.rb +123 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/lib/rvm/environment/tools.rb +68 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/lib/rvm/environment/utility.rb +173 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/lib/rvm/environment/wrapper.rb +23 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/lib/rvm/environment.rb +64 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/lib/rvm/errors.rb +31 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/lib/rvm/install_command_dumper.rb +51 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/lib/rvm/shell/abstract_wrapper.rb +145 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/lib/rvm/shell/calculate_rvm_path.sh +26 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/lib/rvm/shell/result.rb +42 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/lib/rvm/shell/shell_wrapper.sh +10 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/lib/rvm/shell/single_shot_wrapper.rb +56 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/lib/rvm/shell/utility.rb +37 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/lib/rvm/shell.rb +25 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/lib/rvm/version.rb +19 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/lib/rvm.rb +156 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/man/man1/rvm.1 +385 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/man/man1/rvm.1.gz +0 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/rvm.gemspec +184 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/alias +225 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/aliases +4 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/array +32 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/base +49 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/cd +87 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/cleanup +58 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/cli +781 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/color +49 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/completion +151 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/db +87 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/default +64 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/disk-usage +60 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/docs +115 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/env +46 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/environment-convertor +74 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/fetch +229 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/gemsets +950 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/hash +37 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/help +46 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/hook +23 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/info +214 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/initialize +29 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/install +631 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/irbrc +9 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/irbrc.rb +63 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/list +315 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/log +38 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/maglev +193 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/manage +2094 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/match +6 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/md5 +22 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/migrate +175 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/monitor +105 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/notes +121 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/override_gem +14 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/package +301 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/patches +64 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/patchsets +87 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/repair +199 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/rubygems +157 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/rvm +120 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/rvm-install +631 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/selector +818 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/set +301 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/snapshot +262 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/tools +58 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/update +631 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/upgrade +144 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/utility +1557 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/version +17 -0
- data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/wrapper +210 -0
- data/vendor/ruby/1.8/specifications/macaddr-1.0.0.gemspec +27 -0
- data/vendor/ruby/1.8/specifications/rvm-1.0.14.gemspec +42 -0
- metadata +149 -4
@@ -0,0 +1,301 @@
|
|
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
|
+
if [[ "$action" = "exec" ]]; then
|
25
|
+
# Exec is a special case.
|
26
|
+
rvm_command="${args[@]}"
|
27
|
+
|
28
|
+
else
|
29
|
+
|
30
|
+
binary="$(echo $action | sed 's#do$##')"
|
31
|
+
|
32
|
+
if [[ -x "$rvm_ruby_home/bin/$binary" ]] ; then
|
33
|
+
|
34
|
+
binary="$rvm_ruby_home/bin/$binary"
|
35
|
+
|
36
|
+
|
37
|
+
elif [[ -x "$rvm_ruby_global_gems_path/bin/$binary" ]] ; then
|
38
|
+
|
39
|
+
binary="$rvm_ruby_global_gems_path/bin/$binary"
|
40
|
+
|
41
|
+
elif [[ -x "$rvm_ruby_gem_home/bin/$binary" ]] ; then
|
42
|
+
|
43
|
+
binary="$rvm_ruby_gem_home/bin/$binary"
|
44
|
+
|
45
|
+
elif [[ "system" = "$rvm_ruby_string" ]] && [[ -x "$(command -v $binary)" ]] ; then
|
46
|
+
|
47
|
+
binary="$(basename $(command -v $binary) 2>/dev/null)"
|
48
|
+
|
49
|
+
else
|
50
|
+
|
51
|
+
"$rvm_path/scripts/log" "warn" \
|
52
|
+
"'$binary not found for $rvm_ruby_string' either does not exist or is not executable? :("
|
53
|
+
|
54
|
+
__rvm_unset_ruby_variables
|
55
|
+
|
56
|
+
return 1
|
57
|
+
|
58
|
+
fi
|
59
|
+
|
60
|
+
if [[ ! -z "$rvm_ruby_mode" ]] ; then
|
61
|
+
|
62
|
+
rvm_ruby_string="${rvm_ruby_string}-${rvm_ruby_mode}"
|
63
|
+
|
64
|
+
rvm_ruby_mode="--$(echo "$rvm_ruby_mode" | sed 's/^m//')"
|
65
|
+
|
66
|
+
fi
|
67
|
+
|
68
|
+
load_path="$(dirname $(command -v $binary) 2>/dev/null):$rvm_ruby_load_path"
|
69
|
+
|
70
|
+
# TODO: the else case below should be run if $args =~ /\.rb$/
|
71
|
+
if [[ "ruby" = "$(basename $binary)" && "$rvm_benchmark_flag" -ne 1 ]] ; then
|
72
|
+
|
73
|
+
if "$rvm_path/scripts/match" "${args[@]}" "\.rb$" ; then
|
74
|
+
|
75
|
+
if [[ -z "$prefix" ]] ; then prefix="-S" ; fi
|
76
|
+
|
77
|
+
if ! "$rvm_path/scripts/match" "${args[@]}" "$prefix" ; then
|
78
|
+
|
79
|
+
args=($prefix ${args[@]})
|
80
|
+
|
81
|
+
fi
|
82
|
+
fi
|
83
|
+
|
84
|
+
rvm_command="$binary $rvm_ruby_mode $rvm_ruby_require -I$load_path ${args[@]}"
|
85
|
+
|
86
|
+
else
|
87
|
+
|
88
|
+
rvm_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 ./log/$rvm_ruby_string/$action.error.log
|
101
|
+
|
102
|
+
eval "$rvm_command" \
|
103
|
+
>> ./log/$rvm_ruby_string/$action.log \
|
104
|
+
2>> ./log/$rvm_ruby_string/$action.error.log
|
105
|
+
|
106
|
+
else
|
107
|
+
if [[ ${rvm_verbose_flag:-0} -gt 0 ]] ; then
|
108
|
+
|
109
|
+
current_env="$(__rvm_environment_identifier)"
|
110
|
+
|
111
|
+
if [[ "$current_env" != "$current_set_ruby" ]]; then
|
112
|
+
|
113
|
+
current_env="$current_set_ruby ($current_env)"
|
114
|
+
|
115
|
+
fi
|
116
|
+
|
117
|
+
"$rvm_path/scripts/log" "info" \
|
118
|
+
"$current_env: $(ruby -v $rvm_ruby_mode | \tr "\n" ' ')\n"
|
119
|
+
|
120
|
+
unset current_env
|
121
|
+
fi
|
122
|
+
eval "$rvm_command"
|
123
|
+
fi
|
124
|
+
result=$?
|
125
|
+
|
126
|
+
string=$(basename $rvm_ruby_gem_home)
|
127
|
+
|
128
|
+
if [[ $result -eq 0 ]]; then
|
129
|
+
|
130
|
+
eval "successes=(${successes[*]} $string)"
|
131
|
+
|
132
|
+
else
|
133
|
+
|
134
|
+
eval "errors=(${errors[*]} $string)"
|
135
|
+
|
136
|
+
fi
|
137
|
+
|
138
|
+
eval "rubies=(${rubies[*]} $string)"
|
139
|
+
|
140
|
+
eval "statuses=(${statuses[*]} $result)"
|
141
|
+
|
142
|
+
unset string
|
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[*]}
|
@@ -0,0 +1,262 @@
|
|
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 $?
|
@@ -0,0 +1,58 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
|
3
|
+
source "$rvm_path/scripts/base"
|
4
|
+
|
5
|
+
usage()
|
6
|
+
{
|
7
|
+
echo "Usage: rvm tools {identifier,path-identifier,strings}" 1>&2
|
8
|
+
exit 1
|
9
|
+
}
|
10
|
+
|
11
|
+
# Return the identifier that's current in use.
|
12
|
+
tools_identifier()
|
13
|
+
{
|
14
|
+
__rvm_environment_identifier
|
15
|
+
}
|
16
|
+
|
17
|
+
tools_path_identifier()
|
18
|
+
{
|
19
|
+
if [[ -z "$1" || ! -d "$1" ]]; then
|
20
|
+
echo "Usage: rvm tools path-identifier 'path-to-check'"
|
21
|
+
return 1
|
22
|
+
fi
|
23
|
+
|
24
|
+
source "$rvm_path/scripts/rvm"
|
25
|
+
builtin cd "$1"
|
26
|
+
rvm_promptless=1 __rvm_project_rvmrc
|
27
|
+
rvmrc_result="$?"
|
28
|
+
__rvm_environment_identifier
|
29
|
+
exit $rvmrc_result
|
30
|
+
}
|
31
|
+
|
32
|
+
tools_strings()
|
33
|
+
{
|
34
|
+
for ruby_name in "$@"; do
|
35
|
+
__rvm_unset_ruby_variables
|
36
|
+
rvm_ruby_string="$ruby_name"
|
37
|
+
if { __rvm_ruby_string && __rvm_select; } >/dev/null 2>&1; then
|
38
|
+
basename "$rvm_ruby_gem_home"
|
39
|
+
else
|
40
|
+
echo ""
|
41
|
+
fi
|
42
|
+
done
|
43
|
+
}
|
44
|
+
|
45
|
+
args=($*)
|
46
|
+
action="${args[0]}"
|
47
|
+
args="$(echo ${args[@]:1})" # Strip trailing / leading / extra spacing.
|
48
|
+
|
49
|
+
[[ -z "$action" ]] && usage
|
50
|
+
|
51
|
+
case "$action" in
|
52
|
+
identifier) tools_identifier ;;
|
53
|
+
path-identifier) tools_path_identifier "$args" ;;
|
54
|
+
strings) tools_strings "$args" ;;
|
55
|
+
*) usage ;;
|
56
|
+
esac
|
57
|
+
|
58
|
+
exit $?
|