rvm 1.0.9 → 1.0.10
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/binscripts/rvm +2 -2
- data/contrib/install-system-wide +37 -10
- data/contrib/r +28 -0
- data/install +20 -0
- data/lib/VERSION.yml +1 -1
- data/lib/rvm/environment.rb +3 -2
- data/lib/rvm/environment/env.rb +2 -2
- data/lib/rvm/environment/utility.rb +12 -6
- data/lib/rvm/shell/calculate_rvm_path.sh +26 -0
- data/lib/rvm/shell/shell_wrapper.sh +1 -1
- data/rvm.gemspec +4 -2
- data/scripts/cd +6 -0
- data/scripts/cli +15 -7
- data/scripts/gemsets +9 -2
- data/scripts/help +20 -5
- data/scripts/hook +9 -0
- data/scripts/info +33 -11
- data/scripts/install +20 -0
- data/scripts/irbrc.rb +31 -7
- data/scripts/list +10 -9
- data/scripts/log +1 -1
- data/scripts/manage +6 -2
- data/scripts/match +1 -1
- data/scripts/package +69 -40
- data/scripts/repair +12 -5
- data/scripts/rvm +29 -8
- data/scripts/rvm-install +20 -0
- data/scripts/selector +63 -43
- data/scripts/set +29 -13
- data/scripts/update +20 -0
- data/scripts/utility +86 -36
- data/scripts/wrapper +36 -13
- metadata +6 -4
data/binscripts/rvm
CHANGED
@@ -30,7 +30,7 @@ fi
|
|
30
30
|
# Setup default sandbox value. See scripts/rvm for origin.
|
31
31
|
if [[ ${rvm_selfcontained:-0} -eq 0 ]]; then
|
32
32
|
|
33
|
-
if [[ "root" = "$(whoami)"
|
33
|
+
if [[ "root" = "$(whoami)" || -n "$rvm_prefix" && "$rvm_prefix" != "$HOME"/* ]]; then
|
34
34
|
|
35
35
|
rvm_selfcontained=0
|
36
36
|
|
@@ -71,6 +71,6 @@ fi
|
|
71
71
|
|
72
72
|
source "$rvm_path/scripts/rvm"
|
73
73
|
|
74
|
-
|
74
|
+
export rvm_interactive_flag=0
|
75
75
|
|
76
76
|
rvm "$@"
|
data/contrib/install-system-wide
CHANGED
@@ -33,6 +33,38 @@ __rvm_system_wide_permissions() {
|
|
33
33
|
return 0
|
34
34
|
}
|
35
35
|
|
36
|
+
__rvm_create_user_group() {
|
37
|
+
[[ -z "$1" ]] && return 1
|
38
|
+
|
39
|
+
if \grep -q "$1" /etc/group ; then
|
40
|
+
echo "Group '$1' exists, proceeding with installation."
|
41
|
+
else
|
42
|
+
echo "Creating the group '$1'"
|
43
|
+
|
44
|
+
case "$os_type" in
|
45
|
+
"FreeBSD") pw groupadd -q "$rvm_group_name";;
|
46
|
+
"Linux") groupadd -f "$rvm_group_name";;
|
47
|
+
esac
|
48
|
+
fi
|
49
|
+
|
50
|
+
return 0
|
51
|
+
}
|
52
|
+
|
53
|
+
__rvm_add_user_to_group() {
|
54
|
+
[[ -z "$1" || -z "$2" ]] && return 1
|
55
|
+
|
56
|
+
echo "Adding '$1' to the group '$2'"
|
57
|
+
|
58
|
+
case "$os_type" in
|
59
|
+
"FreeBSD") pw usermod "$1" -G "$2";;
|
60
|
+
"Linux") usermod -a -G "$2" "$1";;
|
61
|
+
esac
|
62
|
+
|
63
|
+
return 0
|
64
|
+
}
|
65
|
+
|
66
|
+
os_type="$(uname)"
|
67
|
+
|
36
68
|
# Require root to install it.
|
37
69
|
if [[ "$(whoami)" != "root" ]]; then
|
38
70
|
echo "Please rerun this installer as root." >&2
|
@@ -43,8 +75,8 @@ elif [[ -z "$(command -v git)" ]] ; then
|
|
43
75
|
echo "Please ensure git is installed and available in PATH to continue." >&2
|
44
76
|
exit 1
|
45
77
|
|
46
|
-
elif [[ "$
|
47
|
-
echo "The rvm system wide installer
|
78
|
+
elif [[ "$os_type" != "Linux" && "$os_type" != "FreeBSD" ]]; then
|
79
|
+
echo "The rvm system wide installer currently only supports Linux and FreeBSD." >&2
|
48
80
|
exit 1
|
49
81
|
fi
|
50
82
|
|
@@ -90,14 +122,9 @@ rvm_path="${rvm_path:-"/usr/local/rvm"}"
|
|
90
122
|
export rvm_selfcontained=0
|
91
123
|
|
92
124
|
rvm_group_name="${rvm_group_name:-"rvm"}"
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
echo "Creating the group '$rvm_group_name'"
|
97
|
-
groupadd -f "$rvm_group_name"
|
98
|
-
fi
|
99
|
-
echo "Adding $(whoami) the '$rvm_group_name'"
|
100
|
-
usermod -a -G "$rvm_group_name" "$(whoami)"
|
125
|
+
|
126
|
+
__rvm_create_user_group "$rvm_group_name"
|
127
|
+
__rvm_add_user_to_group "$(whoami)" "$rvm_group_name"
|
101
128
|
|
102
129
|
echo "Creating the destination dir and making sure the permissions are correct"
|
103
130
|
mkdir -p "$rvm_path"
|
data/contrib/r
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
|
3
|
+
#
|
4
|
+
# r - Rails shortcut command.
|
5
|
+
#
|
6
|
+
r() {
|
7
|
+
local action args
|
8
|
+
|
9
|
+
action="$1" ; shift
|
10
|
+
args="$@"
|
11
|
+
|
12
|
+
case "$action" in
|
13
|
+
c) action=console ;;
|
14
|
+
db) action=dbconsole ;;
|
15
|
+
g) action=generate ;;
|
16
|
+
h|help) action="-h" ;;
|
17
|
+
esac
|
18
|
+
|
19
|
+
if [[ -s config.ru ]] ; then
|
20
|
+
ruby ./script/rails $args
|
21
|
+
else
|
22
|
+
if [[ -s ./script/$action ]] ; then
|
23
|
+
ruby ./script/$action $args
|
24
|
+
else
|
25
|
+
printf "ERROR: Missing script ./script/$action !!!"
|
26
|
+
fi
|
27
|
+
fi
|
28
|
+
}
|
data/install
CHANGED
@@ -40,6 +40,15 @@ check_rubyopt_conditions() {
|
|
40
40
|
fi
|
41
41
|
}
|
42
42
|
|
43
|
+
# Regenerates a users wrappers as part of the update.
|
44
|
+
regenerate_wrappers() {
|
45
|
+
printf "\n"
|
46
|
+
if command -v __rvm_regenerate_wrappers >/dev/null; then
|
47
|
+
__rvm_regenerate_wrappers
|
48
|
+
fi
|
49
|
+
printf "\n"
|
50
|
+
}
|
51
|
+
|
43
52
|
andand_return_instructions() {
|
44
53
|
printf "
|
45
54
|
This means that if you see something like:
|
@@ -493,6 +502,15 @@ for file in rvm rvmsudo rvm-shell rvm-auto-ruby ; do
|
|
493
502
|
|
494
503
|
done
|
495
504
|
|
505
|
+
# Cleanup any .swp files that might have appeared.
|
506
|
+
files=($( find "$rvm_path/" -mindepth 1 -maxdepth 2 -iname '*.swp' -type f ))
|
507
|
+
|
508
|
+
for file in "${files[@]}" ; do
|
509
|
+
|
510
|
+
[[ -f "$file" ]] && rm -f "$file"
|
511
|
+
|
512
|
+
done
|
513
|
+
|
496
514
|
printf "\n Copying manpages into place."
|
497
515
|
|
498
516
|
files=($(builtin cd "$install_source_path/man" ; find . -maxdepth 1 -mindepth 1 -type f -print))
|
@@ -514,6 +532,8 @@ if [[ ${upgrade_flag:-0} -eq 1 ]] ; then
|
|
514
532
|
upgrade_notes
|
515
533
|
|
516
534
|
check_rubyopt_conditions
|
535
|
+
|
536
|
+
regenerate_wrappers
|
517
537
|
|
518
538
|
printf "\nUpgrade of RVM in $rvm_path/ is complete.\n\n"
|
519
539
|
|
data/lib/VERSION.yml
CHANGED
data/lib/rvm/environment.rb
CHANGED
@@ -12,7 +12,8 @@ module RVM
|
|
12
12
|
|
13
13
|
# The default config has rvm_silence_logging so that log doesn't print anything to stdout.
|
14
14
|
merge_config! :rvm_silence_logging => 1,
|
15
|
-
:rvm_promptless => 1
|
15
|
+
:rvm_promptless => 1,
|
16
|
+
:rvm_ruby_api => 1
|
16
17
|
|
17
18
|
attr_reader :environment_name, :shell_wrapper
|
18
19
|
|
@@ -45,7 +46,7 @@ module RVM
|
|
45
46
|
|
46
47
|
# Automatically load rvm config from the multiple sources.
|
47
48
|
def source_rvm_environment
|
48
|
-
rvm_path = config_value_for(:rvm_path,
|
49
|
+
rvm_path = config_value_for(:rvm_path, self.class.default_rvm_path, false)
|
49
50
|
actual_config = defined_config.merge('rvm_path' => rvm_path)
|
50
51
|
config = []
|
51
52
|
actual_config.each_pair do |k, v|
|
data/lib/rvm/environment/env.rb
CHANGED
@@ -3,12 +3,12 @@ module RVM
|
|
3
3
|
|
4
4
|
# Returns the contents of the env file.
|
5
5
|
def env_contents
|
6
|
-
rvm(:env).stdout
|
6
|
+
rvm(:env, environment_name).stdout
|
7
7
|
end
|
8
8
|
|
9
9
|
# Returns the path to the env file
|
10
10
|
def env_path
|
11
|
-
rvm(:env, :path => true).stdout.strip
|
11
|
+
rvm(:env, environment_name, :path => true).stdout.strip
|
12
12
|
end
|
13
13
|
|
14
14
|
# Returns a ruby-like wrapper for the env functions
|
@@ -3,6 +3,11 @@ module RVM
|
|
3
3
|
|
4
4
|
PREFIX_OPTIONS = [:trace, :json, :yaml]
|
5
5
|
|
6
|
+
def self.default_rvm_path
|
7
|
+
value = `bash '#{File.expand_path('../shell/calculate_rvm_path.sh', File.dirname(__FILE__))}'`.strip
|
8
|
+
$?.success? && !value.empty? ? File.expand_path(value) : nil
|
9
|
+
end
|
10
|
+
|
6
11
|
# Returns the environment identifier for the current environment,
|
7
12
|
# as determined from the GEM_HOME.
|
8
13
|
def self.current_environment_id
|
@@ -19,7 +24,7 @@ module RVM
|
|
19
24
|
|
20
25
|
# Returns the ruby string that represents the current environment.
|
21
26
|
def self.current_ruby_string
|
22
|
-
identifier_to_ruby_string
|
27
|
+
identifier_to_ruby_string(current_environment_id)
|
23
28
|
end
|
24
29
|
|
25
30
|
# Converts a ruby identifier (string + gemset) to just the ruby string.
|
@@ -55,10 +60,11 @@ module RVM
|
|
55
60
|
rearrange_options!(args, options)
|
56
61
|
args += hash_to_options(options)
|
57
62
|
args.map! { |a| a.to_s }
|
63
|
+
|
58
64
|
if silent
|
59
|
-
run_silently
|
65
|
+
run_silently('rvm', *args)
|
60
66
|
else
|
61
|
-
run
|
67
|
+
run('rvm', *args)
|
62
68
|
end
|
63
69
|
end
|
64
70
|
|
@@ -89,7 +95,7 @@ module RVM
|
|
89
95
|
if result && result[:rvm_ruby_string]
|
90
96
|
result[:rvm_ruby_string]
|
91
97
|
else
|
92
|
-
self.class.identifier_to_ruby_string
|
98
|
+
self.class.identifier_to_ruby_string(expanded_name)
|
93
99
|
end
|
94
100
|
end
|
95
101
|
|
@@ -116,7 +122,7 @@ module RVM
|
|
116
122
|
|
117
123
|
# Normalizes an array, removing blank lines.
|
118
124
|
def normalize_array(value)
|
119
|
-
value.split("\n").map { |
|
125
|
+
value.split("\n").map { |line| line.strip }.reject { |line| line.empty? }
|
120
126
|
end
|
121
127
|
|
122
128
|
# Extract options from a hash.
|
@@ -146,7 +152,7 @@ module RVM
|
|
146
152
|
def normalize_option_value(value)
|
147
153
|
case value
|
148
154
|
when Array
|
149
|
-
value.map { |
|
155
|
+
value.map { |option| normalize_option_value(option) }.join(",")
|
150
156
|
else
|
151
157
|
value.to_s
|
152
158
|
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
# Calculates a default rvm path
|
4
|
+
|
5
|
+
# Check first.
|
6
|
+
if [[ -n "$rvm_path" ]]; then
|
7
|
+
echo "$rvm_path"
|
8
|
+
exit
|
9
|
+
fi
|
10
|
+
|
11
|
+
# Load extra files.
|
12
|
+
|
13
|
+
[[ -s ~/.rvmrc ]] && source ~/.rvmrc >/dev/null 2>&1
|
14
|
+
[[ -s /etc/.rvmrc ]] && source /etc/rvmrc >/dev/null 2>&1
|
15
|
+
|
16
|
+
if [[ -n "$rvm_path" ]]; then
|
17
|
+
echo "$rvm_path"
|
18
|
+
elif [[ -d ~/.rvm ]]; then
|
19
|
+
echo "~/.rvm"
|
20
|
+
elif [[ -d /usr/local/rvm ]]; then
|
21
|
+
echo "/usr/local/rvm"
|
22
|
+
else
|
23
|
+
exit 1
|
24
|
+
fi
|
25
|
+
|
26
|
+
exit 0
|
@@ -5,6 +5,6 @@ __rvm_show_command_epilog() {
|
|
5
5
|
echo "---"
|
6
6
|
echo " exit_status: \"$last_command_result\""
|
7
7
|
echo " environment:"
|
8
|
-
env | sed "s#'#\\'#" | sed -e 's#"#\\"#' -e "s#\\([^=]*\\)=\\(.*\\)# '\1': \"\2\"#"
|
8
|
+
env | sed "s#'#\\'#g" | sed -e 's#"#\\"#g' -e "s#\\([^=]*\\)=\\(.*\\)# '\1': \"\2\"#"
|
9
9
|
echo "----------------RVM-RESULTS-END----------------"
|
10
10
|
}
|
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 = "1.0.
|
8
|
+
s.version = "1.0.10"
|
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-09-
|
12
|
+
s.date = %q{2010-09-18}
|
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}
|
@@ -32,6 +32,7 @@ Gem::Specification.new do |s|
|
|
32
32
|
"config/md5",
|
33
33
|
"contrib/gemset_snapshot",
|
34
34
|
"contrib/install-system-wide",
|
35
|
+
"contrib/r",
|
35
36
|
"examples/rvmrc",
|
36
37
|
"gemsets/default.gems",
|
37
38
|
"gemsets/global.gems",
|
@@ -92,6 +93,7 @@ Gem::Specification.new do |s|
|
|
92
93
|
"lib/rvm/install_command_dumper.rb",
|
93
94
|
"lib/rvm/shell.rb",
|
94
95
|
"lib/rvm/shell/abstract_wrapper.rb",
|
96
|
+
"lib/rvm/shell/calculate_rvm_path.sh",
|
95
97
|
"lib/rvm/shell/result.rb",
|
96
98
|
"lib/rvm/shell/shell_wrapper.sh",
|
97
99
|
"lib/rvm/shell/single_shot_wrapper.rb",
|
data/scripts/cd
CHANGED
@@ -13,6 +13,9 @@ if [[ ${rvm_project_rvmrc:-1} -ne 0 ]] ; then
|
|
13
13
|
builtin cd "$@"
|
14
14
|
local result=$?
|
15
15
|
__rvm_project_rvmrc
|
16
|
+
|
17
|
+
rvm_hook="after_cd" ; source "$rvm_path/scripts/hook"
|
18
|
+
|
16
19
|
return $result
|
17
20
|
}
|
18
21
|
fi
|
@@ -21,6 +24,9 @@ if [[ ${rvm_project_rvmrc:-1} -ne 0 ]] ; then
|
|
21
24
|
builtin cd "$@"
|
22
25
|
local result=$?
|
23
26
|
__rvm_project_rvmrc
|
27
|
+
|
28
|
+
rvm_hook="after_cd" ; source "$rvm_path/scripts/hook"
|
29
|
+
|
24
30
|
return $result
|
25
31
|
}
|
26
32
|
fi
|
data/scripts/cli
CHANGED
@@ -396,12 +396,14 @@ __rvm_parse_args() {
|
|
396
396
|
if [[ $# -gt 0 ]] ; then next_token="$1" ; shift ; else next_token="" ; fi
|
397
397
|
;;
|
398
398
|
|
399
|
+
--debug)
|
400
|
+
export rvm_debug_flag=1
|
401
|
+
set -o verbose
|
402
|
+
;;
|
403
|
+
|
399
404
|
--trace|--debug)
|
400
405
|
local option
|
401
406
|
|
402
|
-
export rvm_debug_flag=1
|
403
|
-
|
404
|
-
set -o verbose
|
405
407
|
set -o noclobber
|
406
408
|
set -o nounset
|
407
409
|
|
@@ -414,10 +416,10 @@ __rvm_parse_args() {
|
|
414
416
|
|
415
417
|
export rvm_trace_flag=1
|
416
418
|
|
417
|
-
|
419
|
+
set -o xtrace
|
418
420
|
|
419
421
|
if [[ -z "${ZSH_VERSION:-""}" ]] ; then
|
420
|
-
export PS4='
|
422
|
+
export PS4='+[${BASH_SOURCE}] : ${LINENO} : ${FUNCNAME[0]:+${FUNCNAME[0]}() $ }'
|
421
423
|
fi
|
422
424
|
fi
|
423
425
|
;;
|
@@ -667,7 +669,7 @@ rvm() {
|
|
667
669
|
;;
|
668
670
|
|
669
671
|
ruby|gem|rake|exec)
|
670
|
-
old_rvm_ruby_string=$rvm_ruby_string
|
672
|
+
old_rvm_ruby_string=${rvm_ruby_string:-""}
|
671
673
|
unset rvm_ruby_string
|
672
674
|
export rvm_ruby_strings
|
673
675
|
|
@@ -757,8 +759,14 @@ rvm() {
|
|
757
759
|
__rvm_teardown
|
758
760
|
|
759
761
|
if [[ ${rvm_trace_flag:-0} -eq 1 ]] ; then
|
760
|
-
set +x
|
761
762
|
rvm_trace_flag=0
|
763
|
+
set +o verbose
|
764
|
+
set +o noclobber
|
765
|
+
set +o nounset
|
766
|
+
|
767
|
+
if [[ -z "${ZSH_VERSION:-""}" ]] ; then
|
768
|
+
set +o errtrace
|
769
|
+
fi
|
762
770
|
fi
|
763
771
|
|
764
772
|
return ${result:-0}
|
data/scripts/gemsets
CHANGED
@@ -215,8 +215,14 @@ gemset_list() {
|
|
215
215
|
|
216
216
|
gemset_delete() {
|
217
217
|
|
218
|
+
gemsets=(${args[@]})
|
219
|
+
|
218
220
|
if [[ ${rvm_ruby_selected_flag:-0} -eq 0 ]] ; then __rvm_select ; fi
|
219
221
|
|
222
|
+
if [[ -n "${gemsets[__array_start]}" ]] ; then
|
223
|
+
rvm_gemset_name="${gemsets[__array_start]}"
|
224
|
+
fi
|
225
|
+
|
220
226
|
if [[ -n "$rvm_gemset_name" ]] ; then
|
221
227
|
|
222
228
|
gemdir="${rvm_gems_path:-"$rvm_path/gems"}/$rvm_ruby_string${rvm_gemset_separator:-"@"}$rvm_gemset_name"
|
@@ -810,8 +816,9 @@ if ! command -v gem > /dev/null ; then
|
|
810
816
|
fi
|
811
817
|
|
812
818
|
args=($*)
|
813
|
-
action="${args[
|
814
|
-
args
|
819
|
+
action="${args[$__array_start]}"
|
820
|
+
args[$__array_start]=""
|
821
|
+
args=(${args[@]})
|
815
822
|
gems_args="$(echo ${args[@]}) " # Strip trailing / leading / extra spacing.
|
816
823
|
|
817
824
|
export rvm_gemset_name="${args[1]:-""}" # For wherever used.
|
data/scripts/help
CHANGED
@@ -1,22 +1,37 @@
|
|
1
1
|
#!/usr/bin/env bash
|
2
|
+
|
2
3
|
rvm_base_except="selector"
|
4
|
+
|
3
5
|
source "$rvm_path/scripts/base"
|
4
6
|
|
5
7
|
rvm_help_path="${rvm_help_path:-"$rvm_path/help"}"
|
6
8
|
|
7
9
|
args=($*)
|
8
|
-
command="${args[0]}"
|
9
|
-
action="${args[1]}"
|
10
|
-
args="$(echo ${args[@]:2}) " # Strip trailing / leading / extra spacing.
|
11
10
|
|
12
|
-
|
13
|
-
|
11
|
+
command="${args[$__array_start]}"
|
12
|
+
args[$__array_start]=""
|
13
|
+
args=(${args[@]})
|
14
|
+
|
15
|
+
action="${args[$array_start]}"
|
16
|
+
args[$__array_start]=""
|
17
|
+
args=(${args[@]})
|
18
|
+
|
19
|
+
if [[ -n "$command" && -s "${rvm_help_path}/${command}" ]] ; then
|
20
|
+
|
21
|
+
if [[ -n "$action" && -s "${rvm_help_path}/${command}/${action}" ]] ; then
|
22
|
+
|
14
23
|
less "${rvm_help_path}/${command}/${action}"
|
24
|
+
|
15
25
|
else
|
26
|
+
|
16
27
|
less "${rvm_help_path}/${command}"
|
28
|
+
|
17
29
|
fi
|
30
|
+
|
18
31
|
else
|
32
|
+
|
19
33
|
less "${rvm_path:-$HOME/.rvm}/README"
|
34
|
+
|
20
35
|
"$rvm_path/scripts/log" "info" \
|
21
36
|
"Commands available with 'rvm help':\n\n $(builtin cd "${rvm_help_path}" ; find . -maxdepth 1 -mindepth 1 -type f -print | \tr "\n" ' ' | sed -e 's#./##g')"
|
22
37
|
fi
|