rvm 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/binscripts/rvm-prompt +15 -16
- data/contrib/gemset_snapshot +1 -1
- data/install +19 -20
- data/lib/VERSION.yml +1 -1
- data/rvm.gemspec +2 -3
- data/scripts/alias +28 -20
- data/scripts/base +1 -1
- data/scripts/cleanup +1 -1
- data/scripts/cli +83 -104
- data/scripts/completion +28 -1
- data/scripts/docs +11 -11
- data/scripts/fetch +15 -15
- data/scripts/gemsets +72 -75
- data/scripts/help +9 -10
- data/scripts/hook +3 -1
- data/scripts/info +8 -6
- data/scripts/install +19 -20
- data/scripts/list +31 -40
- data/scripts/maglev +18 -18
- data/scripts/manage +190 -193
- data/scripts/match +1 -0
- data/scripts/migrate +10 -11
- data/scripts/monitor +4 -4
- data/scripts/package +14 -14
- data/scripts/patches +3 -4
- data/scripts/repair +5 -5
- data/scripts/rubygems +11 -11
- data/scripts/rvm +3 -3
- data/scripts/rvm-install +19 -20
- data/scripts/selector +68 -64
- data/scripts/set +10 -10
- data/scripts/snapshot +29 -28
- data/scripts/tools +7 -9
- data/scripts/update +19 -20
- data/scripts/upgrade +7 -7
- data/scripts/utility +96 -93
- data/scripts/wrapper +13 -18
- metadata +4 -5
- data/scripts/manpages +0 -8
data/scripts/completion
CHANGED
@@ -33,6 +33,20 @@ __rvm_gemsets ()
|
|
33
33
|
echo "$(rvm gemset list | \grep -v gemset 2>/dev/null)"
|
34
34
|
}
|
35
35
|
|
36
|
+
__rvm_help_pages ()
|
37
|
+
{
|
38
|
+
ls "$rvm_path/help"
|
39
|
+
}
|
40
|
+
|
41
|
+
__rvm_known ()
|
42
|
+
{
|
43
|
+
# Strips comments and expands known patterns into each variation
|
44
|
+
rvm list known | sed 's/#.*$//' | sed '\
|
45
|
+
s/^(\([^)]*\))\(.*\)(\([^)]*\))$/\1\2\3 \1\2 \2\3 \2/\
|
46
|
+
s/^(\([^)]*\))\(.*\)$/\1\2 \2/\
|
47
|
+
s/^\(.*\)(\([^)]*\))$/\1\2 \1/'
|
48
|
+
}
|
49
|
+
|
36
50
|
_rvm_commands ()
|
37
51
|
{
|
38
52
|
local cur=${COMP_WORDS[COMP_CWORD]}
|
@@ -41,7 +55,8 @@ _rvm_commands ()
|
|
41
55
|
version use reload implode update reset info debug\
|
42
56
|
install uninstall remove\
|
43
57
|
ruby gem rake tests specs monitor gemset\
|
44
|
-
gemdir srcdir fetch list package notes snapshot
|
58
|
+
gemdir srcdir fetch list package notes snapshot\
|
59
|
+
help'
|
45
60
|
|
46
61
|
case "${cur}" in
|
47
62
|
-*) _rvm_opts ;;
|
@@ -105,6 +120,16 @@ _rvm_gemset ()
|
|
105
120
|
fi
|
106
121
|
}
|
107
122
|
|
123
|
+
_rvm_help ()
|
124
|
+
{
|
125
|
+
__rvm_comp "$(__rvm_help_pages)"
|
126
|
+
}
|
127
|
+
|
128
|
+
_rvm_install ()
|
129
|
+
{
|
130
|
+
__rvm_comp "$(__rvm_known)"
|
131
|
+
}
|
132
|
+
|
108
133
|
_rvm ()
|
109
134
|
{
|
110
135
|
local prev=${COMP_WORDS[COMP_CWORD-1]}
|
@@ -112,6 +137,8 @@ _rvm ()
|
|
112
137
|
case "${prev}" in
|
113
138
|
use) _rvm_use ;;
|
114
139
|
gemset) _rvm_gemset ;;
|
140
|
+
help) _rvm_help ;;
|
141
|
+
install) _rvm_install ;;
|
115
142
|
*) _rvm_commands ;;
|
116
143
|
esac
|
117
144
|
|
data/scripts/docs
CHANGED
@@ -4,7 +4,7 @@ source "$rvm_scripts_path/base"
|
|
4
4
|
|
5
5
|
rvm_docs_ruby_string="$(__rvm_environment_identifier | awk -F"$rvm_gemset_separator" '{print $1}')"
|
6
6
|
if [[ "$rvm_docs_ruby_string" = "system" || -z "$rvm_docs_ruby_string" ]]; then
|
7
|
-
$rvm_scripts_path/log "error" "Currently 'rvm docs ...' does not work with non-rvm rubies."
|
7
|
+
"$rvm_scripts_path"/log "error" "Currently 'rvm docs ...' does not work with non-rvm rubies."
|
8
8
|
exit 1
|
9
9
|
fi
|
10
10
|
|
@@ -23,22 +23,22 @@ usage() {
|
|
23
23
|
open_docs() {
|
24
24
|
if [[ -s "$rvm_docs_path/$rvm_docs_ruby_string/$rvm_docs_type/index.html" ]] ; then
|
25
25
|
if command -v open >/dev/null ; then
|
26
|
-
open $rvm_docs_path/$rvm_docs_ruby_string/$rvm_docs_type/index.html
|
26
|
+
open "$rvm_docs_path/$rvm_docs_ruby_string/$rvm_docs_type/index.html"
|
27
27
|
elif command -v xdg-open >/dev/null ; then
|
28
|
-
xdg-open $rvm_docs_path/$rvm_docs_ruby_string/$rvm_docs_type/index.html
|
28
|
+
xdg-open "$rvm_docs_path/$rvm_docs_ruby_string/$rvm_docs_type/index.html"
|
29
29
|
else
|
30
|
-
$rvm_scripts_path/log "error" "Neither open nor xdg-open were found, in order to open the docs one of these two are required. \n(OR you can let me know how else to open the html in your browser from comand line on your OS :) )"
|
30
|
+
"$rvm_scripts_path"/log "error" "Neither open nor xdg-open were found, in order to open the docs one of these two are required. \n(OR you can let me know how else to open the html in your browser from comand line on your OS :) )"
|
31
31
|
fi
|
32
32
|
else
|
33
|
-
$rvm_scripts_path/log "error" "$rvm_docs_type docs are missing, perhaps run 'rvm docs generate' first?"
|
33
|
+
"$rvm_scripts_path"/log "error" "$rvm_docs_type docs are missing, perhaps run 'rvm docs generate' first?"
|
34
34
|
fi
|
35
35
|
}
|
36
36
|
|
37
37
|
generate_ri() {
|
38
38
|
# Generate ri docs
|
39
39
|
__rvm_pushpop "$rvm_src_path/$rvm_docs_ruby_string/"
|
40
|
-
$rvm_scripts_path/log "info" "Generating ri documentation, be aware that this could take a *long* time, and depends heavily on your system resources..."
|
41
|
-
$rvm_scripts_path/log "info" "( Errors will be logged to $rvm_log_path/$rvm_docs_ruby_string/docs.error.log )"
|
40
|
+
"$rvm_scripts_path"/log "info" "Generating ri documentation, be aware that this could take a *long* time, and depends heavily on your system resources..."
|
41
|
+
"$rvm_scripts_path"/log "info" "( Errors will be logged to $rvm_log_path/$rvm_docs_ruby_string/docs.error.log )"
|
42
42
|
rdoc -a --ri --ri-site > /dev/null 2>> $rvm_log_path/$rvm_docs_ruby_string/docs.error.log
|
43
43
|
__rvm_pushpop
|
44
44
|
}
|
@@ -46,12 +46,12 @@ generate_ri() {
|
|
46
46
|
generate_rdoc() {
|
47
47
|
__rvm_pushpop "$rvm_src_path/$rvm_docs_ruby_string/"
|
48
48
|
\rm -rf "$rvm_docs_path/$rvm_docs_ruby_string/$rvm_docs_type/"
|
49
|
-
$rvm_scripts_path/log "info" "Generating rdoc documentation, be aware that this could take a *long* time, and depends heavily on your system resources..."
|
50
|
-
$rvm_scripts_path/log "info" "( Errors will be logged to $rvm_log_path/$rvm_docs_ruby_string/docs.error.log )"
|
49
|
+
"$rvm_scripts_path"/log "info" "Generating rdoc documentation, be aware that this could take a *long* time, and depends heavily on your system resources..."
|
50
|
+
"$rvm_scripts_path"/log "info" "( Errors will be logged to $rvm_log_path/$rvm_docs_ruby_string/docs.error.log )"
|
51
51
|
if gem list | \grep -q ^hanna ; then
|
52
|
-
hanna -o $rvm_docs_path/$rvm_docs_ruby_string/$rvm_docs_type --inline-source --line-numbers --fmt=html > /dev/null 2>> $rvm_log_path/$rvm_docs_ruby_string/docs.error.log
|
52
|
+
hanna -o "$rvm_docs_path/$rvm_docs_ruby_string/$rvm_docs_type" --inline-source --line-numbers --fmt=html > /dev/null 2>> "$rvm_log_path/$rvm_docs_ruby_string/docs.error.log"
|
53
53
|
else
|
54
|
-
rdoc -a -o $rvm_docs_path/$rvm_docs_ruby_string/$rvm_docs_type > /dev/null 2>> $rvm_log_path/$rvm_docs_ruby_string/docs.error.log
|
54
|
+
rdoc -a -o "$rvm_docs_path/$rvm_docs_ruby_string/$rvm_docs_type" > /dev/null 2>> "$rvm_log_path/$rvm_docs_ruby_string/docs.error.log"
|
55
55
|
fi
|
56
56
|
__rvm_pushpop
|
57
57
|
}
|
data/scripts/fetch
CHANGED
@@ -17,17 +17,17 @@ record_md5() {
|
|
17
17
|
else
|
18
18
|
archive_md5="$(md5sum "${archive}" | awk '{print $1}')"
|
19
19
|
fi
|
20
|
-
$rvm_scripts_path/db "$rvm_config_path/md5" "$archive" "$archive_md5"
|
20
|
+
"$rvm_scripts_path/db" "$rvm_config_path/md5" "$archive" "$archive_md5"
|
21
21
|
}
|
22
22
|
|
23
23
|
builtin cd "$rvm_archives_path"
|
24
24
|
|
25
|
-
if [[ -z "$1" ]] ; then $rvm_scripts_path/log "fail" "BUG: $0 called without an argument :/" ; exit 1 ; fi
|
25
|
+
if [[ -z "$1" ]] ; then "$rvm_scripts_path/log" "fail" "BUG: $0 called without an argument :/" ; exit 1 ; fi
|
26
26
|
|
27
27
|
url="$1"; download=1 ; package_name="$2"
|
28
28
|
|
29
29
|
if ! command -v curl > /dev/null ; then
|
30
|
-
$rvm_scripts_path/log "fail" "rvm requires curl. curl was not found in your active path."
|
30
|
+
"$rvm_scripts_path/log" "fail" "rvm requires curl. curl was not found in your active path."
|
31
31
|
exit 1
|
32
32
|
elif [[ ! -z ${rvm_proxy} ]] ; then
|
33
33
|
fetch_command="curl -x${rvm_proxy} -L --create-dirs -C - " # -s for silent
|
@@ -43,22 +43,22 @@ else
|
|
43
43
|
archive=$(basename "$url")
|
44
44
|
fi
|
45
45
|
|
46
|
-
if [[ ! -z "$rvm_debug_flag" ]] ; then $rvm_scripts_path/log "debug" "Fetching $archive" ; fi
|
46
|
+
if [[ ! -z "$rvm_debug_flag" ]] ; then "$rvm_scripts_path/log" "debug" "Fetching $archive" ; fi
|
47
47
|
|
48
48
|
# Check first if we have the correct archive
|
49
49
|
archive_md5="$($rvm_scripts_path/db "$rvm_config_path/md5" "$archive" | head -n1)"
|
50
50
|
if [[ -e "$archive" ]] && [[ ! -z "$archive_md5" ]] ; then
|
51
|
-
if [[ ! -z "$rvm_debug_flag" ]] ; then $rvm_scripts_path/log "debug" "Found archive and its md5, testing correctness" ; fi
|
52
|
-
if ! $rvm_scripts_path/md5 "${rvm_archives_path}/${archive}" "$archive_md5" ; then
|
53
|
-
if [[ ! -z "$rvm_debug_flag" ]] ; then $rvm_scripts_path/log "debug" "Archive is bad, downloading" ; fi
|
51
|
+
if [[ ! -z "$rvm_debug_flag" ]] ; then "$rvm_scripts_path/log" "debug" "Found archive and its md5, testing correctness" ; fi
|
52
|
+
if ! "$rvm_scripts_path"/md5 "${rvm_archives_path}/${archive}" "$archive_md5" ; then
|
53
|
+
if [[ ! -z "$rvm_debug_flag" ]] ; then "$rvm_scripts_path/log" "debug" "Archive is bad, downloading" ; fi
|
54
54
|
download=1
|
55
55
|
else
|
56
|
-
if [[ ! -z "$rvm_debug_flag" ]] ; then $rvm_scripts_path/log "debug" "Archive is good, not downloading" ; fi
|
56
|
+
if [[ ! -z "$rvm_debug_flag" ]] ; then "$rvm_scripts_path/log" "debug" "Archive is good, not downloading" ; fi
|
57
57
|
download=0
|
58
58
|
result=0
|
59
59
|
fi ; unset archive_md5
|
60
60
|
else
|
61
|
-
if [[ ! -z "$rvm_debug_flag" ]] ; then $rvm_scripts_path/log "debug" "No archive or no MD5, downloading" ; fi
|
61
|
+
if [[ ! -z "$rvm_debug_flag" ]] ; then "$rvm_scripts_path/log" "debug" "No archive or no MD5, downloading" ; fi
|
62
62
|
download=1
|
63
63
|
fi
|
64
64
|
|
@@ -73,18 +73,18 @@ if [[ $download -gt 0 ]] ; then
|
|
73
73
|
retry=0
|
74
74
|
try_http=0
|
75
75
|
if [[ $result -eq 78 ]] ; then
|
76
|
-
$rvm_scripts_path/log "error" "The requested url does not exist: '$url'"
|
76
|
+
"$rvm_scripts_path/log" "error" "The requested url does not exist: '$url'"
|
77
77
|
try_http=1
|
78
78
|
elif [[ $result -eq 18 ]] ; then
|
79
|
-
$rvm_scripts_path/log "error" "Partial file. Only a part of the file was transferred. Removing partial and re-trying."
|
79
|
+
"$rvm_scripts_path/log" "error" "Partial file. Only a part of the file was transferred. Removing partial and re-trying."
|
80
80
|
\rm -f "$archive"
|
81
81
|
retry=1
|
82
82
|
elif [[ $result -eq 33 ]] ; then
|
83
|
-
if [[ ! -z "$rvm_debug_flag" ]] ; then $rvm_scripts_path/log "debug" "Server does not support 'range' command, removing '$archive'" ; fi
|
83
|
+
if [[ ! -z "$rvm_debug_flag" ]] ; then "$rvm_scripts_path/log" "debug" "Server does not support 'range' command, removing '$archive'" ; fi
|
84
84
|
\rm -f "$archive"
|
85
85
|
retry=1
|
86
86
|
else
|
87
|
-
$rvm_scripts_path/log "error" "There was an error, please check $rvm_ruby_log_path/*.error.log. Next we'll try to fetch via http."
|
87
|
+
"$rvm_scripts_path/log" "error" "There was an error, please check $rvm_ruby_log_path/*.error.log. Next we'll try to fetch via http."
|
88
88
|
try_http=1
|
89
89
|
fi
|
90
90
|
|
@@ -92,7 +92,7 @@ if [[ $download -gt 0 ]] ; then
|
|
92
92
|
eval $fetch_command "$url"
|
93
93
|
result=$?
|
94
94
|
if [[ $result -gt 0 ]] ; then
|
95
|
-
$rvm_scripts_path/log "error" "There was an error, please check $rvm_ruby_log_path/*.error.log"
|
95
|
+
"$rvm_scripts_path/log" "error" "There was an error, please check $rvm_ruby_log_path/*.error.log"
|
96
96
|
else
|
97
97
|
record_md5
|
98
98
|
fi
|
@@ -102,7 +102,7 @@ if [[ $download -gt 0 ]] ; then
|
|
102
102
|
eval $fetch_command "$http_url"
|
103
103
|
result=$?
|
104
104
|
if [[ $result -gt 0 ]] ; then
|
105
|
-
$rvm_scripts_path/log "error" "There was an error, please check $rvm_ruby_log_path/*.error.log"
|
105
|
+
"$rvm_scripts_path/log" "error" "There was an error, please check $rvm_ruby_log_path/*.error.log"
|
106
106
|
else
|
107
107
|
record_md5
|
108
108
|
fi
|
data/scripts/gemsets
CHANGED
@@ -15,13 +15,13 @@ usage() {
|
|
15
15
|
|
16
16
|
gemset_update() {
|
17
17
|
if [[ -z "$rvm_ruby_strings" ]]; then
|
18
|
-
$rvm_scripts_path/log "info" "Running gem update for all rubies and gemsets."
|
18
|
+
"$rvm_scripts_path/log" "info" "Running gem update for all rubies and gemsets."
|
19
19
|
rvm_ruby_strings="$(\ls "$rvm_gems_path" | \grep -v '^\(doc\|cache\|@\|system\)' | \tr '\n' ',')"
|
20
20
|
else
|
21
|
-
$rvm_scripts_path/log "info" "Running gem update for the specified rubies."
|
21
|
+
"$rvm_scripts_path/log" "info" "Running gem update for the specified rubies."
|
22
22
|
fi
|
23
23
|
export rvm_ruby_strings
|
24
|
-
$rvm_scripts_path/set "gem" "update"
|
24
|
+
"$rvm_scripts_path/set" "gem" "update"
|
25
25
|
return $?
|
26
26
|
}
|
27
27
|
|
@@ -35,32 +35,32 @@ gemset_globalcache() {
|
|
35
35
|
else
|
36
36
|
gc_status="Disabled"
|
37
37
|
fi
|
38
|
-
$rvm_scripts_path/log "info" "Gemset global cache is currently: $gc_status"
|
38
|
+
"$rvm_scripts_path/log" "info" "Gemset global cache is currently: $gc_status"
|
39
39
|
return "$globalcache_enabled"
|
40
40
|
elif [[ "$1" == "disable" ]]; then
|
41
|
-
$rvm_scripts_path/log "info" "Removing the global cache (note: this will empty the caches)"
|
41
|
+
"$rvm_scripts_path/log" "info" "Removing the global cache (note: this will empty the caches)"
|
42
42
|
for directory_name in $(\ls "$rvm_gems_path"); do
|
43
43
|
current_cache_path="$rvm_gems_path/$directory_name/cache"
|
44
44
|
if [[ -L "$current_cache_path" && "$(readlink "$current_cache_path")" == "$rvm_gems_cache_path" ]]; then
|
45
|
-
$rvm_scripts_path/log "info" "Reverting the gem cache for $directory_name to an empty directory."
|
45
|
+
"$rvm_scripts_path/log" "info" "Reverting the gem cache for $directory_name to an empty directory."
|
46
46
|
\rm -f "$current_cache_path" 2>/dev/null
|
47
47
|
\mkdir -p "$current_cache_path" 2>/dev/null
|
48
48
|
fi
|
49
49
|
done; unset full_directory_path directory_name
|
50
|
-
$rvm_scripts_path/db "$rvm_config_path/user" "use_gemset_globalcache" "delete"
|
50
|
+
"$rvm_scripts_path/db" "$rvm_config_path/user" "use_gemset_globalcache" "delete"
|
51
51
|
elif [[ "$1" == "enable" ]]; then
|
52
|
-
$rvm_scripts_path/log "info" "Enabling global cache for gems."
|
52
|
+
"$rvm_scripts_path/log" "info" "Enabling global cache for gems."
|
53
53
|
\mkdir -p "$rvm_gems_cache_path"
|
54
54
|
for directory_name in $(\ls "$rvm_gems_path"); do
|
55
55
|
current_cache_path="$rvm_gems_path/$directory_name/cache"
|
56
56
|
if [[ -d "$current_cache_path" && ! -L "$current_cache_path" ]]; then
|
57
|
-
$rvm_scripts_path/log "info" "Moving the gem cache for $directory_name to the global cache."
|
57
|
+
"$rvm_scripts_path/log" "info" "Moving the gem cache for $directory_name to the global cache."
|
58
58
|
mv "$current_cache_path/"*.gem "$rvm_gems_cache_path/" 2>/dev/null
|
59
59
|
\rm -rf "$current_cache_path"
|
60
60
|
ln -nfs "$rvm_gems_cache_path" "$current_cache_path"
|
61
61
|
fi
|
62
62
|
done; unset full_directory_path directory_name
|
63
|
-
$rvm_scripts_path/db "$rvm_config_path/user" "use_gemset_globalcache" "true"
|
63
|
+
"$rvm_scripts_path/db" "$rvm_config_path/user" "use_gemset_globalcache" "true"
|
64
64
|
else
|
65
65
|
printf "Usage: 'rvm gemset globalcache {enable,disable}\n"
|
66
66
|
printf " Enable / Disable the use of a global gem cachedir.\n"
|
@@ -80,7 +80,7 @@ gemset_create() {
|
|
80
80
|
rvm_ruby_gem_prefix=$(echo $rvm_ruby_gem_home | sed 's/'${rvm_gemset_separator}'.*$//')
|
81
81
|
for gemset in $(echo $gems_args) ; do
|
82
82
|
if [[ "$gemset" == *"${rvm_gemset_separator}"* ]]; then
|
83
|
-
$rvm_scripts_path/log "error" "Can't do that, it contains a \"${rvm_gemset_separator}\"."
|
83
|
+
"$rvm_scripts_path/log" "error" "Can't do that, it contains a \"${rvm_gemset_separator}\"."
|
84
84
|
continue
|
85
85
|
fi
|
86
86
|
gem_home="${rvm_ruby_gem_prefix}${rvm_gemset_separator}${gemset}"
|
@@ -93,23 +93,23 @@ gemset_create() {
|
|
93
93
|
fi
|
94
94
|
ln -nfs "$rvm_gems_cache_path" "$gem_home/cache"
|
95
95
|
fi
|
96
|
-
$rvm_scripts_path/log "info" "Gemset '$gemset' created."
|
96
|
+
"$rvm_scripts_path/log" "info" "Gemset '$gemset' created."
|
97
97
|
done ; unset gem_home
|
98
98
|
}
|
99
99
|
|
100
100
|
gemset_list() {
|
101
101
|
if [[ -z "$rvm_ruby_selected_flag" ]] ; then __rvm_select ; fi
|
102
102
|
|
103
|
-
$rvm_scripts_path/log "info" "gemsets : for $rvm_ruby_string (found in $rvm_gems_path/)"
|
103
|
+
"$rvm_scripts_path/log" "info" "gemsets : for $rvm_ruby_string (found in $rvm_gems_path/)"
|
104
104
|
|
105
105
|
if [[ ! -z "$rvm_gems_path" ]] ; then
|
106
|
-
if [[ ! -z $rvm_ruby_string ]] ; then
|
107
|
-
\ls ${rvm_gems_path}/ | awk -F"${rvm_gemset_separator}" "/${rvm_ruby_string}${rvm_gemset_separator}/{print \$2}" 2>/dev/null
|
106
|
+
if [[ ! -z "$rvm_ruby_string" ]] ; then
|
107
|
+
\ls "${rvm_gems_path}/" | awk -F"${rvm_gemset_separator}" "/${rvm_ruby_string}${rvm_gemset_separator}/{print \$2}" 2>/dev/null
|
108
108
|
else
|
109
|
-
$rvm_scripts_path/log "error" "\$rvm_ruby_string is not set!"
|
109
|
+
"$rvm_scripts_path/log" "error" "\$rvm_ruby_string is not set!"
|
110
110
|
fi
|
111
111
|
else
|
112
|
-
$rvm_scripts_path/log "error" "\$rvm_gems_path is not set!"
|
112
|
+
"$rvm_scripts_path/log" "error" "\$rvm_gems_path is not set!"
|
113
113
|
fi
|
114
114
|
}
|
115
115
|
|
@@ -120,20 +120,20 @@ gemset_delete() {
|
|
120
120
|
if [[ -d "$gemdir" ]] && [[ "$gemdir" != '/' ]] && [[ ! -z "$rvm_force_flag" ]] ; then
|
121
121
|
\rm -rf "$gemdir"
|
122
122
|
elif [[ -d "$gemdir" ]] ; then
|
123
|
-
$rvm_scripts_path/log "warn" "Are you SURE you wish to remove the entire gemset directory '$rvm_gemset_name' ($gemdir)?"
|
123
|
+
"$rvm_scripts_path/log" "warn" "Are you SURE you wish to remove the entire gemset directory '$rvm_gemset_name' ($gemdir)?"
|
124
124
|
echo -n "(anything other than 'yes' will cancel) > "
|
125
125
|
read response
|
126
126
|
if [[ "yes" = "$response" ]] ; then
|
127
127
|
\rm -f $gemdir/cache 2>/dev/null
|
128
128
|
\rm -rf $gemdir
|
129
129
|
else
|
130
|
-
$rvm_scripts_path/log "info" "Not doing anything, phew... close call that one eh?"
|
130
|
+
"$rvm_scripts_path/log" "info" "Not doing anything, phew... close call that one eh?"
|
131
131
|
fi
|
132
132
|
else
|
133
|
-
$rvm_scripts_path/log "info" "$gemdir already does not exist."
|
133
|
+
"$rvm_scripts_path/log" "info" "$gemdir already does not exist."
|
134
134
|
fi ; unset gemdir
|
135
135
|
else
|
136
|
-
$rvm_scripts_path/log "error" "A gemset name must be specified in order to delete a gems."
|
136
|
+
"$rvm_scripts_path/log" "error" "A gemset name must be specified in order to delete a gems."
|
137
137
|
fi
|
138
138
|
}
|
139
139
|
|
@@ -141,28 +141,28 @@ gemset_empty() {
|
|
141
141
|
if [[ -z "$rvm_ruby_gem_home" ]] ; then __rvm_select ; fi
|
142
142
|
gemdir="$rvm_ruby_gem_home"
|
143
143
|
if [[ -d "$gemdir" ]] && [[ "$gemdir" != '/' ]] && [[ ! -z "$rvm_force_flag" ]] ; then
|
144
|
-
builtin cd $gemdir && \rm -rf ./bin/* ./doc/* ./gems/* ./specifications/*
|
144
|
+
builtin cd "$gemdir" && \rm -rf ./bin/* ./doc/* ./gems/* ./specifications/*
|
145
145
|
elif [[ -d "$gemdir" ]] ; then
|
146
|
-
$rvm_scripts_path/log "warn" "Are you SURE you wish to remove the installed gemset for gemset '$(basename $gemdir)' ($gemdir)?"
|
146
|
+
"$rvm_scripts_path/log" "warn" "Are you SURE you wish to remove the installed gemset for gemset '$(basename "$gemdir")' ($gemdir)?"
|
147
147
|
echo -n "(anything other than 'yes' will cancel) > "
|
148
148
|
read response
|
149
149
|
if [[ "yes" = "$response" ]] ; then
|
150
|
-
builtin cd $gemdir && \rm -rf ./bin/* ./doc/* ./gems/* ./specifications/*
|
150
|
+
builtin cd "$gemdir" && \rm -rf ./bin/* ./doc/* ./gems/* ./specifications/*
|
151
151
|
else
|
152
|
-
$rvm_scripts_path/log "info" "Not doing anything, phew... close call that one eh?"
|
152
|
+
"$rvm_scripts_path/log" "info" "Not doing anything, phew... close call that one eh?"
|
153
153
|
fi
|
154
154
|
else
|
155
|
-
$rvm_scripts_path/log "info" "$gemdir already does not exist."
|
155
|
+
"$rvm_scripts_path/log" "info" "$gemdir already does not exist."
|
156
156
|
fi ; unset gemdir
|
157
157
|
}
|
158
158
|
|
159
159
|
# Migrate gemsets from ruby X to ruby Y
|
160
160
|
gemset_copy() {
|
161
|
-
local source_ruby="$
|
162
|
-
local destination_ruby="$
|
161
|
+
local source_ruby="${gems_args/ */}"
|
162
|
+
local destination_ruby="${gems_args/* /}"
|
163
163
|
|
164
164
|
if [[ -z "$destination_ruby" || -z "$source_ruby" ]] ; then
|
165
|
-
$rvm_scripts_path/log "error" "Source and destination must be specified: 'rvm gemset copy X Y'"
|
165
|
+
"$rvm_scripts_path/log" "error" "Source and destination must be specified: 'rvm gemset copy X Y'"
|
166
166
|
return 1
|
167
167
|
fi
|
168
168
|
|
@@ -170,26 +170,26 @@ gemset_copy() {
|
|
170
170
|
local destination_path="$(rvm_silence_logging=1 rvm "$destination_ruby" gem env gemdir)"
|
171
171
|
|
172
172
|
if [[ -z "$source_path" ]]; then
|
173
|
-
$rvm_scripts_path/log "error" "Unable to expand ruby '$source_ruby'"
|
173
|
+
"$rvm_scripts_path/log" "error" "Unable to expand ruby '$source_ruby'"
|
174
174
|
return 1
|
175
175
|
fi
|
176
176
|
|
177
177
|
if [[ -z "$destination_path" ]]; then
|
178
|
-
$rvm_scripts_path/log "error" "Unable to expand ruby '$destination_ruby'"
|
178
|
+
"$rvm_scripts_path/log" "error" "Unable to expand ruby '$destination_ruby'"
|
179
179
|
return 1
|
180
180
|
fi
|
181
181
|
|
182
182
|
if [[ -d "$source_path" ]] ; then
|
183
183
|
[[ ! -d "$destination_path" ]] && \mkdir -p "$destination_path"
|
184
|
-
$rvm_scripts_path/log "info" "Copying gemset from $source_ruby to $destination_ruby"
|
184
|
+
"$rvm_scripts_path/log" "info" "Copying gemset from $source_ruby to $destination_ruby"
|
185
185
|
for dir in bin doc gems specifications cache ; do
|
186
186
|
\mkdir -p "$destination_path/$dir"
|
187
187
|
\cp -Rf "$source_path/$dir" "$destination_path/"
|
188
188
|
done
|
189
|
-
$rvm_scripts_path/log "info" "Making gemset for $destination_ruby pristine."
|
189
|
+
"$rvm_scripts_path/log" "info" "Making gemset for $destination_ruby pristine."
|
190
190
|
__rvm_run_with_env "gemset.pristine" "$destination_ruby" "rvm gemset pristine"
|
191
191
|
else
|
192
|
-
$rvm_scripts_path/log "error" "Gems directory does not exist for $source_path ($source_path)"
|
192
|
+
"$rvm_scripts_path/log" "error" "Gems directory does not exist for $source_path ($source_path)"
|
193
193
|
return 1
|
194
194
|
fi
|
195
195
|
}
|
@@ -211,14 +211,14 @@ gemset_export() {
|
|
211
211
|
fi
|
212
212
|
fi
|
213
213
|
|
214
|
-
$rvm_scripts_path/log "info" "Exporting current environments gemset to $rvm_file_name"
|
214
|
+
"$rvm_scripts_path/log" "info" "Exporting current environments gemset to $rvm_file_name"
|
215
215
|
|
216
|
-
\touch $rvm_file_name
|
217
|
-
echo "# $rvm_file_name generated gem export file. Note that any env variable settings will be missing. Append these after using a ';' field separator" > $rvm_file_name
|
216
|
+
\touch "$rvm_file_name"
|
217
|
+
echo "# $rvm_file_name generated gem export file. Note that any env variable settings will be missing. Append these after using a ';' field separator" > "$rvm_file_name"
|
218
218
|
for gem in $(gem list | sed 's#[\(|\)]##g' | sed 's#, #,#g' | \tr ' ' ';') ; do
|
219
|
-
name="$
|
219
|
+
name="${gem/;*/}"
|
220
220
|
if [[ -z "$rvm_latest_flag" ]] ; then
|
221
|
-
versions="$
|
221
|
+
versions="${gem/*;/}" ; versions="${versions//,/ }"
|
222
222
|
for version in $versions ; do
|
223
223
|
echo "$name -v$version" >> $rvm_file_name
|
224
224
|
done ; unset version versions
|
@@ -236,11 +236,8 @@ gemset_import() {
|
|
236
236
|
export BUNDLE_PATH="$rvm_ruby_gem_home"
|
237
237
|
fi
|
238
238
|
|
239
|
-
|
240
|
-
|
241
|
-
else
|
242
|
-
rvm_gemset_name="$(echo "$gems_args" | sed 's# ##g')"
|
243
|
-
fi
|
239
|
+
rvm_gemset_name="${gems_args//.gem*/}"
|
240
|
+
rvm_gemset_name="${gems_args// /}"
|
244
241
|
|
245
242
|
if [[ -s "$rvm_gemset_name.gems" ]] ; then
|
246
243
|
rvm_file_name="$rvm_gemset_name.gems"
|
@@ -251,7 +248,7 @@ gemset_import() {
|
|
251
248
|
elif [[ -s ".gems" ]] ; then
|
252
249
|
rvm_file_name=".gems"
|
253
250
|
else
|
254
|
-
$rvm_scripts_path/log "error" "No *.gems file found."
|
251
|
+
"$rvm_scripts_path/log" "error" "No *.gems file found."
|
255
252
|
return 1
|
256
253
|
fi
|
257
254
|
|
@@ -259,34 +256,34 @@ gemset_import() {
|
|
259
256
|
|
260
257
|
if [[ -s "$rvm_file_name" ]] ; then
|
261
258
|
echo "Importing $rvm_file_name file..."
|
262
|
-
rvm_ruby_gem_list=$(\ls $rvm_ruby_gem_home/specifications/ 2> /dev/null | sed 's#.gems.*$##' 2> /dev/null)
|
259
|
+
rvm_ruby_gem_list=$(\ls "$rvm_ruby_gem_home/specifications/" 2> /dev/null | sed 's#.gems.*$##' 2> /dev/null)
|
263
260
|
|
264
261
|
while read -r line
|
265
262
|
do # Keep this on 2nd line :(
|
266
|
-
if [[
|
263
|
+
if [[ -n "${line// /}" ]] ; then
|
267
264
|
gems_args="$line" ; gem_install
|
268
265
|
fi
|
269
266
|
done < <(awk '/^[^#]+/{print}' "${rvm_file_name}")
|
270
267
|
else
|
271
|
-
$rvm_scripts_path/log "error" "${rvm_file_name} does not exist to import from."
|
268
|
+
"$rvm_scripts_path/log" "error" "${rvm_file_name} does not exist to import from."
|
272
269
|
fi
|
273
270
|
}
|
274
271
|
|
275
272
|
__rvm_parse_gems_args() {
|
276
|
-
gem="$
|
277
|
-
gem_prefix="$
|
278
|
-
if $rvm_scripts_path/match "$gem" "
|
279
|
-
gem_name="$(basename $gem
|
280
|
-
gem_version="$(basename $gem
|
281
|
-
gem_postfix="$(basename $gem
|
273
|
+
gem="${gems_args/;*}"
|
274
|
+
gem_prefix="${gems_args/*;}"
|
275
|
+
if "$rvm_scripts_path/match" "$gem" ".gem$" ; then
|
276
|
+
gem_name="$(basename "${gem/.gem/}" | awk -F'-' '{$NF=NULL;print}')"
|
277
|
+
gem_version="$(basename "${gem/.gem/}" | awk -F'-' '{print $NF}' )"
|
278
|
+
gem_postfix="$(basename "${gem/*.gem/}")"
|
282
279
|
else
|
283
|
-
gem_name="$
|
284
|
-
if $rvm_scripts_path/match "$gem" "--version" ; then
|
285
|
-
gem_version="$(echo $gem | sed 's#.*--version[=]*[ ]*##' | awk '{print $1}')"
|
286
|
-
gem_postfix="$(echo $gem | sed "s#${gem_name/ /}##"
|
287
|
-
elif $rvm_scripts_path/match "$gem" "-v" ; then
|
288
|
-
gem_version="$(echo $gem | sed 's#.*-v[=]*[ ]*##' | awk '{print $1}')"
|
289
|
-
gem_postfix="$(echo $gem | sed "s#${gem_name/ /}##"
|
280
|
+
gem_name="${gem/ */}"
|
281
|
+
if "$rvm_scripts_path/match" "$gem" "--version" ; then
|
282
|
+
gem_version="$(echo "$gem" | sed -e 's#.*--version[=]*[ ]*##' | awk '{print $1}')"
|
283
|
+
gem_postfix="$(echo "$gem" | sed -e "s#${gem_name/ /}##" -e "s#--version[=]*[ ]*${gem_version/ /}##")"
|
284
|
+
elif "$rvm_scripts_path/match" "$gem" "-v" ; then
|
285
|
+
gem_version="$(echo "$gem" | sed -e 's#.*-v[=]*[ ]*##' | awk '{print $1}')"
|
286
|
+
gem_postfix="$(echo "$gem" | sed -e "s#${gem_name/ /}##" -e "s#-v[=]*[ ]*${gem_version/ /}##")"
|
290
287
|
else
|
291
288
|
unset gem_version # no version
|
292
289
|
fi
|
@@ -294,7 +291,7 @@ __rvm_parse_gems_args() {
|
|
294
291
|
|
295
292
|
if [[ -s "$gem" ]] ; then
|
296
293
|
gem_file_name="$gem"
|
297
|
-
elif $rvm_scripts_path/match "$gem" ".gem$" ; then
|
294
|
+
elif "$rvm_scripts_path/match" "$gem" ".gem$" ; then
|
298
295
|
gem_file_name="$gem"
|
299
296
|
elif [[ -z "${gem_version/ /}" ]] ; then
|
300
297
|
gem_file_name="${gem_name/ /}*.gem"
|
@@ -310,9 +307,9 @@ gem_install() {
|
|
310
307
|
__rvm_parse_gems_args
|
311
308
|
|
312
309
|
# Now we determine if a .gem cache file is already installed
|
313
|
-
if [[ -z "$rvm_force_flag" ]] && [[ -f "${rvm_ruby_gem_home}/specifications/$(basename $gem_file_name)spec" ]] ; then
|
310
|
+
if [[ -z "$rvm_force_flag" ]] && [[ -f "${rvm_ruby_gem_home}/specifications/$(basename "$gem_file_name")spec" ]] ; then
|
314
311
|
unset gem
|
315
|
-
$rvm_scripts_path/log "info" "$gem_name $gem_version exists, skipping (--force to re-install)"
|
312
|
+
"$rvm_scripts_path/log" "info" "$gem_name $gem_version exists, skipping (--force to re-install)"
|
316
313
|
else
|
317
314
|
if [[ -s "$gem" ]] ; then
|
318
315
|
cache_file="$gem"
|
@@ -336,7 +333,7 @@ gem_install() {
|
|
336
333
|
|
337
334
|
if [[ -z "$rvm_force_flag" ]] && [[ -s "${rvm_ruby_gem_home}/specifications/$(basename $gem_file_name)spec" ]] ; then
|
338
335
|
unset gem # already installed, not forcing reinstall.
|
339
|
-
$rvm_scripts_path/log "info" "$gem_name $gem_version exists, skipping (--force to re-install)"
|
336
|
+
"$rvm_scripts_path/log" "info" "$gem_name $gem_version exists, skipping (--force to re-install)"
|
340
337
|
else
|
341
338
|
if [[ -s "$(__rvm_current_gemcache_dir)/$(basename $gem_file_name)" ]] ; then
|
342
339
|
\mkdir -p "$rvm_tmp_path/$$/"
|
@@ -363,9 +360,9 @@ gem_install() {
|
|
363
360
|
__rvm_run "gem.install" "$command" "installing ${gem_name} ${gem_version}..."
|
364
361
|
result=$?
|
365
362
|
if [[ $result -eq 0 ]] ; then
|
366
|
-
$rvm_scripts_path/log "info" "$gem_name $gem_version installed, output logged to:\n$rvm_path/log/$rvm_ruby_string/gem.install.log"
|
363
|
+
"$rvm_scripts_path/log" "info" "$gem_name $gem_version installed, output logged to:\n$rvm_path/log/$rvm_ruby_string/gem.install.log"
|
367
364
|
else
|
368
|
-
$rvm_scripts_path/log "error" "$gem_name $gem_version failed to install, output logged to:\n$rvm_path/log/$rvm_ruby_string/gem.install.error.log"
|
365
|
+
"$rvm_scripts_path/log" "error" "$gem_name $gem_version failed to install, output logged to:\n$rvm_path/log/$rvm_ruby_string/gem.install.error.log"
|
369
366
|
fi
|
370
367
|
fi ; unset gem gem_prefix gem_name gem_version gem_file_name gem_postfix cache_file gem_file_name gem_string gem_action
|
371
368
|
|
@@ -391,10 +388,10 @@ gemset_prune() {
|
|
391
388
|
temporary_cache_path="$GEM_HOME/temporary-cache"
|
392
389
|
live_cache_path="$GEM_HOME/cache"
|
393
390
|
\mkdir -p "$temporary_cache_path"
|
394
|
-
$rvm_scripts_path/log "info" "Moving active gems into temporary cache..."
|
391
|
+
"$rvm_scripts_path/log" "info" "Moving active gems into temporary cache..."
|
395
392
|
while read -r used_gem; do
|
396
393
|
gem_name="$(echo "$used_gem" | sed -e 's/ .*//')"
|
397
|
-
versions="$(echo "$used_gem" | sed -e 's/.* (//' -e 's/)//'
|
394
|
+
versions="$(echo "${used_gem//, / }" | sed -e 's/.* (//' -e 's/)//')"
|
398
395
|
for version in $versions; do
|
399
396
|
cached_gem_name="${gem_name}-${version}.gem"
|
400
397
|
cached_file_path="${live_cache_path}/${cached_gem_name}"
|
@@ -403,7 +400,7 @@ gemset_prune() {
|
|
403
400
|
fi
|
404
401
|
done
|
405
402
|
done < <(gem list --versions)
|
406
|
-
$rvm_scripts_path/log "info" "Removing live cache and restoring temporary cache..."
|
403
|
+
"$rvm_scripts_path/log" "info" "Removing live cache and restoring temporary cache..."
|
407
404
|
# Switch the cache back.
|
408
405
|
\rm -rf "$live_cache_path"
|
409
406
|
mv "$temporary_cache_path" "$live_cache_path"
|
@@ -415,7 +412,7 @@ gemset_pristine() {
|
|
415
412
|
|
416
413
|
# Loads the default gemsets for the current interpreter and gemset.
|
417
414
|
gemset_initial() {
|
418
|
-
$rvm_scripts_path/log "info" "Importing initial gemsets for $(__rvm_environment_identifier)."
|
415
|
+
"$rvm_scripts_path/log" "info" "Importing initial gemsets for $(__rvm_environment_identifier)."
|
419
416
|
\mkdir -p "$rvm_gemsets_path/$(echo "$rvm_ruby_string" | \tr '-' '/')" 2>/dev/null
|
420
417
|
for gemsets_path in $(__rvm_ruby_string_paths_under "$rvm_gemsets_path") ; do
|
421
418
|
if [[ -n "$rvm_gemset_name" ]] ; then
|
@@ -431,17 +428,17 @@ gemset_initial() {
|
|
431
428
|
fi
|
432
429
|
fi
|
433
430
|
done
|
434
|
-
$rvm_scripts_path/log "info" "Installation of gems for $(__rvm_environment_identifier) is complete."
|
431
|
+
"$rvm_scripts_path/log" "info" "Installation of gems for $(__rvm_environment_identifier) is complete."
|
435
432
|
}
|
436
433
|
|
437
434
|
unset GEM_PATH
|
438
435
|
|
439
436
|
if ! command -v gem > /dev/null ; then
|
440
|
-
$rvm_scripts_path/log "error" "'gem' was not found, cannot perform gem actions (Do you have an RVM ruby selected?)"
|
437
|
+
"$rvm_scripts_path/log" "error" "'gem' was not found, cannot perform gem actions (Do you have an RVM ruby selected?)"
|
441
438
|
exit 1
|
442
439
|
fi
|
443
440
|
|
444
|
-
action="$(echo $* | awk '{print $1}')"
|
441
|
+
action="$(echo "$*" | awk '{print $1}')"
|
445
442
|
gems_args="$(echo "$*" | awk '{$1="" ; print}' | __rvm_strip)"
|
446
443
|
export rvm_gemset_name
|
447
444
|
|
@@ -488,7 +485,7 @@ elif [[ "update" = "$action" ]]; then
|
|
488
485
|
elif [[ "globalcache" = "$action" ]]; then
|
489
486
|
gemset_globalcache "$2"
|
490
487
|
elif [[ "clear" = "$action" ]] ; then
|
491
|
-
$rvm_scripts_path/log "info" "gemset cleared."
|
488
|
+
"$rvm_scripts_path/log" "info" "gemset cleared."
|
492
489
|
exit 0
|
493
490
|
else
|
494
491
|
usage
|