gemrage 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (151) hide show
  1. data/Gemfile +2 -0
  2. data/Gemfile.lock +5 -0
  3. data/VERSION +1 -1
  4. data/gemrage.gemspec +148 -3
  5. data/lib/rubygems/commands/scan_command.rb +77 -4
  6. data/vendor/ruby/1.8/bin/rvm-install +19 -0
  7. data/vendor/ruby/1.8/cache/macaddr-1.0.0.gem +0 -0
  8. data/vendor/ruby/1.8/cache/rvm-1.0.14.gem +0 -0
  9. data/vendor/ruby/1.8/gems/macaddr-1.0.0/README +33 -0
  10. data/vendor/ruby/1.8/gems/macaddr-1.0.0/gemspec.rb +27 -0
  11. data/vendor/ruby/1.8/gems/macaddr-1.0.0/install.rb +210 -0
  12. data/vendor/ruby/1.8/gems/macaddr-1.0.0/lib/macaddr.rb +69 -0
  13. data/vendor/ruby/1.8/gems/rvm-1.0.14/LICENCE +18 -0
  14. data/vendor/ruby/1.8/gems/rvm-1.0.14/README +127 -0
  15. data/vendor/ruby/1.8/gems/rvm-1.0.14/bin/rvm-install +5 -0
  16. data/vendor/ruby/1.8/gems/rvm-1.0.14/binscripts/rvm +76 -0
  17. data/vendor/ruby/1.8/gems/rvm-1.0.14/binscripts/rvm-auto-ruby +24 -0
  18. data/vendor/ruby/1.8/gems/rvm-1.0.14/binscripts/rvm-prompt +204 -0
  19. data/vendor/ruby/1.8/gems/rvm-1.0.14/binscripts/rvm-shell +35 -0
  20. data/vendor/ruby/1.8/gems/rvm-1.0.14/binscripts/rvm-update-head +35 -0
  21. data/vendor/ruby/1.8/gems/rvm-1.0.14/binscripts/rvm-update-latest +27 -0
  22. data/vendor/ruby/1.8/gems/rvm-1.0.14/binscripts/rvmsudo +24 -0
  23. data/vendor/ruby/1.8/gems/rvm-1.0.14/config/db +71 -0
  24. data/vendor/ruby/1.8/gems/rvm-1.0.14/config/known +55 -0
  25. data/vendor/ruby/1.8/gems/rvm-1.0.14/config/md5 +87 -0
  26. data/vendor/ruby/1.8/gems/rvm-1.0.14/contrib/gemset_snapshot +25 -0
  27. data/vendor/ruby/1.8/gems/rvm-1.0.14/contrib/install-system-wide +191 -0
  28. data/vendor/ruby/1.8/gems/rvm-1.0.14/contrib/r +44 -0
  29. data/vendor/ruby/1.8/gems/rvm-1.0.14/examples/rvmrc +47 -0
  30. data/vendor/ruby/1.8/gems/rvm-1.0.14/gemsets/default.gems +1 -0
  31. data/vendor/ruby/1.8/gems/rvm-1.0.14/gemsets/global.gems +1 -0
  32. data/vendor/ruby/1.8/gems/rvm-1.0.14/help/alias +46 -0
  33. data/vendor/ruby/1.8/gems/rvm-1.0.14/help/benchmark +17 -0
  34. data/vendor/ruby/1.8/gems/rvm-1.0.14/help/cleanup +23 -0
  35. data/vendor/ruby/1.8/gems/rvm-1.0.14/help/debug +8 -0
  36. data/vendor/ruby/1.8/gems/rvm-1.0.14/help/disk-usage +15 -0
  37. data/vendor/ruby/1.8/gems/rvm-1.0.14/help/docs +22 -0
  38. data/vendor/ruby/1.8/gems/rvm-1.0.14/help/exec +33 -0
  39. data/vendor/ruby/1.8/gems/rvm-1.0.14/help/fetch +5 -0
  40. data/vendor/ruby/1.8/gems/rvm-1.0.14/help/gem +0 -0
  41. data/vendor/ruby/1.8/gems/rvm-1.0.14/help/gemdir +0 -0
  42. data/vendor/ruby/1.8/gems/rvm-1.0.14/help/gemset +0 -0
  43. data/vendor/ruby/1.8/gems/rvm-1.0.14/help/implode +0 -0
  44. data/vendor/ruby/1.8/gems/rvm-1.0.14/help/info +64 -0
  45. data/vendor/ruby/1.8/gems/rvm-1.0.14/help/install +0 -0
  46. data/vendor/ruby/1.8/gems/rvm-1.0.14/help/list +0 -0
  47. data/vendor/ruby/1.8/gems/rvm-1.0.14/help/migrate +15 -0
  48. data/vendor/ruby/1.8/gems/rvm-1.0.14/help/monitor +0 -0
  49. data/vendor/ruby/1.8/gems/rvm-1.0.14/help/notes +0 -0
  50. data/vendor/ruby/1.8/gems/rvm-1.0.14/help/package +0 -0
  51. data/vendor/ruby/1.8/gems/rvm-1.0.14/help/rake +14 -0
  52. data/vendor/ruby/1.8/gems/rvm-1.0.14/help/remove +0 -0
  53. data/vendor/ruby/1.8/gems/rvm-1.0.14/help/repair +23 -0
  54. data/vendor/ruby/1.8/gems/rvm-1.0.14/help/reset +0 -0
  55. data/vendor/ruby/1.8/gems/rvm-1.0.14/help/ruby +84 -0
  56. data/vendor/ruby/1.8/gems/rvm-1.0.14/help/rubygems +11 -0
  57. data/vendor/ruby/1.8/gems/rvm-1.0.14/help/rvmrc +34 -0
  58. data/vendor/ruby/1.8/gems/rvm-1.0.14/help/snapshot +15 -0
  59. data/vendor/ruby/1.8/gems/rvm-1.0.14/help/specs +0 -0
  60. data/vendor/ruby/1.8/gems/rvm-1.0.14/help/srcdir +0 -0
  61. data/vendor/ruby/1.8/gems/rvm-1.0.14/help/tests +0 -0
  62. data/vendor/ruby/1.8/gems/rvm-1.0.14/help/tools +22 -0
  63. data/vendor/ruby/1.8/gems/rvm-1.0.14/help/uninstall +0 -0
  64. data/vendor/ruby/1.8/gems/rvm-1.0.14/help/update +0 -0
  65. data/vendor/ruby/1.8/gems/rvm-1.0.14/help/upgrade +18 -0
  66. data/vendor/ruby/1.8/gems/rvm-1.0.14/help/use +0 -0
  67. data/vendor/ruby/1.8/gems/rvm-1.0.14/help/wrapper +41 -0
  68. data/vendor/ruby/1.8/gems/rvm-1.0.14/install +631 -0
  69. data/vendor/ruby/1.8/gems/rvm-1.0.14/lib/VERSION.yml +4 -0
  70. data/vendor/ruby/1.8/gems/rvm-1.0.14/lib/rvm/capistrano.rb +45 -0
  71. data/vendor/ruby/1.8/gems/rvm-1.0.14/lib/rvm/environment/alias.rb +69 -0
  72. data/vendor/ruby/1.8/gems/rvm-1.0.14/lib/rvm/environment/cleanup.rb +54 -0
  73. data/vendor/ruby/1.8/gems/rvm-1.0.14/lib/rvm/environment/configuration.rb +60 -0
  74. data/vendor/ruby/1.8/gems/rvm-1.0.14/lib/rvm/environment/env.rb +52 -0
  75. data/vendor/ruby/1.8/gems/rvm-1.0.14/lib/rvm/environment/gemset.rb +222 -0
  76. data/vendor/ruby/1.8/gems/rvm-1.0.14/lib/rvm/environment/info.rb +13 -0
  77. data/vendor/ruby/1.8/gems/rvm-1.0.14/lib/rvm/environment/list.rb +124 -0
  78. data/vendor/ruby/1.8/gems/rvm-1.0.14/lib/rvm/environment/rubies.rb +50 -0
  79. data/vendor/ruby/1.8/gems/rvm-1.0.14/lib/rvm/environment/sets.rb +123 -0
  80. data/vendor/ruby/1.8/gems/rvm-1.0.14/lib/rvm/environment/tools.rb +68 -0
  81. data/vendor/ruby/1.8/gems/rvm-1.0.14/lib/rvm/environment/utility.rb +173 -0
  82. data/vendor/ruby/1.8/gems/rvm-1.0.14/lib/rvm/environment/wrapper.rb +23 -0
  83. data/vendor/ruby/1.8/gems/rvm-1.0.14/lib/rvm/environment.rb +64 -0
  84. data/vendor/ruby/1.8/gems/rvm-1.0.14/lib/rvm/errors.rb +31 -0
  85. data/vendor/ruby/1.8/gems/rvm-1.0.14/lib/rvm/install_command_dumper.rb +51 -0
  86. data/vendor/ruby/1.8/gems/rvm-1.0.14/lib/rvm/shell/abstract_wrapper.rb +145 -0
  87. data/vendor/ruby/1.8/gems/rvm-1.0.14/lib/rvm/shell/calculate_rvm_path.sh +26 -0
  88. data/vendor/ruby/1.8/gems/rvm-1.0.14/lib/rvm/shell/result.rb +42 -0
  89. data/vendor/ruby/1.8/gems/rvm-1.0.14/lib/rvm/shell/shell_wrapper.sh +10 -0
  90. data/vendor/ruby/1.8/gems/rvm-1.0.14/lib/rvm/shell/single_shot_wrapper.rb +56 -0
  91. data/vendor/ruby/1.8/gems/rvm-1.0.14/lib/rvm/shell/utility.rb +37 -0
  92. data/vendor/ruby/1.8/gems/rvm-1.0.14/lib/rvm/shell.rb +25 -0
  93. data/vendor/ruby/1.8/gems/rvm-1.0.14/lib/rvm/version.rb +19 -0
  94. data/vendor/ruby/1.8/gems/rvm-1.0.14/lib/rvm.rb +156 -0
  95. data/vendor/ruby/1.8/gems/rvm-1.0.14/man/man1/rvm.1 +385 -0
  96. data/vendor/ruby/1.8/gems/rvm-1.0.14/man/man1/rvm.1.gz +0 -0
  97. data/vendor/ruby/1.8/gems/rvm-1.0.14/rvm.gemspec +184 -0
  98. data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/alias +225 -0
  99. data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/aliases +4 -0
  100. data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/array +32 -0
  101. data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/base +49 -0
  102. data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/cd +87 -0
  103. data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/cleanup +58 -0
  104. data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/cli +781 -0
  105. data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/color +49 -0
  106. data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/completion +151 -0
  107. data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/db +87 -0
  108. data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/default +64 -0
  109. data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/disk-usage +60 -0
  110. data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/docs +115 -0
  111. data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/env +46 -0
  112. data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/environment-convertor +74 -0
  113. data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/fetch +229 -0
  114. data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/gemsets +950 -0
  115. data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/hash +37 -0
  116. data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/help +46 -0
  117. data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/hook +23 -0
  118. data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/info +214 -0
  119. data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/initialize +29 -0
  120. data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/install +631 -0
  121. data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/irbrc +9 -0
  122. data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/irbrc.rb +63 -0
  123. data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/list +315 -0
  124. data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/log +38 -0
  125. data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/maglev +193 -0
  126. data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/manage +2094 -0
  127. data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/match +6 -0
  128. data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/md5 +22 -0
  129. data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/migrate +175 -0
  130. data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/monitor +105 -0
  131. data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/notes +121 -0
  132. data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/override_gem +14 -0
  133. data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/package +301 -0
  134. data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/patches +64 -0
  135. data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/patchsets +87 -0
  136. data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/repair +199 -0
  137. data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/rubygems +157 -0
  138. data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/rvm +120 -0
  139. data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/rvm-install +631 -0
  140. data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/selector +818 -0
  141. data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/set +301 -0
  142. data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/snapshot +262 -0
  143. data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/tools +58 -0
  144. data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/update +631 -0
  145. data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/upgrade +144 -0
  146. data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/utility +1557 -0
  147. data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/version +17 -0
  148. data/vendor/ruby/1.8/gems/rvm-1.0.14/scripts/wrapper +210 -0
  149. data/vendor/ruby/1.8/specifications/macaddr-1.0.0.gemspec +27 -0
  150. data/vendor/ruby/1.8/specifications/rvm-1.0.14.gemspec +42 -0
  151. metadata +149 -4
@@ -0,0 +1,49 @@
1
+ #!/usr/bin/env bash
2
+
3
+ case "$1" in
4
+ # regular colors
5
+ black) tput setaf 0 ;;
6
+ red) tput setaf 1 ;;
7
+ green) tput setaf 2 ;;
8
+ yellow) tput setaf 3 ;;
9
+ blue) tput setaf 4 ;;
10
+ magenta) tput setaf 5 ;;
11
+ cyan) tput setaf 6 ;;
12
+ white) tput setaf 7 ;;
13
+
14
+ # emphasized (bolded) colors
15
+ eblack) tput bold ; tput setaf 0 ;;
16
+ ered) tput bold ; tput setaf 1 ;;
17
+ egreen) tput bold ; tput setaf 2 ;;
18
+ eyellow) tput bold ; tput setaf 3 ;;
19
+ eblue) tput bold ; tput setaf 4 ;;
20
+ emagenta) tput bold ; tput setaf 5 ;;
21
+ ecyan) tput bold ; tput setaf 6 ;;
22
+ ewhite) tput bold ; tput setaf 7 ;;
23
+
24
+ # underlined colors
25
+ ublack) set smul unset rmul ; tput setaf 0 ;;
26
+ ured) set smul unset rmul ; tput setaf 1 ;;
27
+ ugreen) set smul unset rmul ; tput setaf 2 ;;
28
+ uyellow) set smul unset rmul ; tput setaf 3 ;;
29
+ ublue) set smul unset rmul ; tput setaf 4 ;;
30
+ umagenta) set smul unset rmul ; tput setaf 5 ;;
31
+ ucyan) set smul unset rmul ; tput setaf 6 ;;
32
+ uwhite) set smul unset rmul ; tput setaf 7 ;;
33
+
34
+ # background colors
35
+ bblack) tput setab 0 ;;
36
+ bred) tput setab 1 ;;
37
+ bgreen) tput setab 2 ;;
38
+ byellow) tput setab 3 ;;
39
+ bblue) tput setab 4 ;;
40
+ bmagenta) tput setab 5 ;;
41
+ bcyan) tput setab 6 ;;
42
+ bwhite) tput setab 7 ;;
43
+
44
+ # Defaults
45
+ default) tput setaf 9 ;;
46
+ bdefault) tput setab 9 ;;
47
+ none) tput sgr0 ;;
48
+ *) tput sgr0 # Reset
49
+ esac
@@ -0,0 +1,151 @@
1
+ #!/usr/bin/env bash
2
+
3
+ # bash completion for Ruby Version Manager (RVM)
4
+
5
+ __rvm_comp()
6
+ {
7
+ local cur="${COMP_WORDS[COMP_CWORD]}"
8
+ COMPREPLY=($(compgen -W "$1" -- "$cur"))
9
+ return 0
10
+ }
11
+
12
+ __rvm_subcommand()
13
+ {
14
+ local word subcommand c=1
15
+
16
+ while [[ $c -lt $COMP_CWORD ]] ; do
17
+ word="${COMP_WORDS[c]}"
18
+ for subcommand in $1; do
19
+ if [[ "$subcommand" = "$word" ]]; then
20
+ echo "$subcommand"
21
+ return
22
+ fi
23
+ done
24
+ c=$((++c))
25
+ done
26
+ }
27
+
28
+ __rvm_rubies ()
29
+ {
30
+ echo "$(rvm list strings) default system"
31
+ }
32
+
33
+ __rvm_gemsets ()
34
+ {
35
+ echo "$(rvm gemset list | \grep -v gemset 2>/dev/null)"
36
+ }
37
+
38
+ __rvm_help_pages ()
39
+ {
40
+ ls "$rvm_path/help"
41
+ }
42
+
43
+ __rvm_known ()
44
+ {
45
+ # Strips comments and expands known patterns into each variation
46
+ rvm list known | sed 's/#.*$//' | sed '\
47
+ s/^(\([^)]*\))\(.*\)(\([^)]*\))$/\1\2\3 \1\2 \2\3 \2/\
48
+ s/^(\([^)]*\))\(.*\)$/\1\2 \2/\
49
+ s/^\(.*\)(\([^)]*\))$/\1\2 \1/'
50
+ }
51
+
52
+ _rvm_commands ()
53
+ {
54
+ local cur=${COMP_WORDS[COMP_CWORD]}
55
+
56
+ COMMANDS='\
57
+ version use reload implode update reset info debug\
58
+ install uninstall remove\
59
+ ruby gem rake tests specs monitor gemset\
60
+ gemdir srcdir fetch list package notes snapshot\
61
+ help'
62
+
63
+ case "${cur}" in
64
+ -*) _rvm_opts ;;
65
+ *) __rvm_comp "$COMMANDS $(__rvm_rubies)" ;;
66
+ esac
67
+ }
68
+
69
+ _rvm_opts ()
70
+ {
71
+ RVM_OPTS='\
72
+ -h\
73
+ --help\
74
+ -v\
75
+ --version\
76
+ -l --level\
77
+ --prefix\
78
+ --bin\
79
+ --gems\
80
+ --archive\
81
+ --patch
82
+ -S\
83
+ -e\
84
+ -G\
85
+ -C\
86
+ --configure\
87
+ --nice\
88
+ --ree-options\
89
+ --head\
90
+ --rubygems\
91
+ --default\
92
+ --debug\
93
+ --trace\
94
+ --force\
95
+ --summary\
96
+ --latest\
97
+ --docs\
98
+ --reconfigure
99
+ --create'
100
+
101
+ __rvm_comp "$RVM_OPTS"
102
+ }
103
+
104
+ _rvm_use ()
105
+ {
106
+ local command="${COMP_WORDS[COMP_CWORD-2]}"
107
+
108
+ case "${command}" in
109
+ gemset) __rvm_comp "$(__rvm_gemsets)" ;;
110
+ *) __rvm_comp "$(__rvm_rubies)" ;;
111
+ esac
112
+ }
113
+
114
+ _rvm_gemset ()
115
+ {
116
+ local subcommand subcommands
117
+ subcommands="use create"
118
+ subcommand="$(__rvm_subcommand "$subcommands")"
119
+
120
+ if [[ -z "$subcommand" ]]; then
121
+ __rvm_comp "$subcommands"
122
+ return
123
+ fi
124
+ }
125
+
126
+ _rvm_help ()
127
+ {
128
+ __rvm_comp "$(__rvm_help_pages)"
129
+ }
130
+
131
+ _rvm_install ()
132
+ {
133
+ __rvm_comp "$(__rvm_known)"
134
+ }
135
+
136
+ _rvm ()
137
+ {
138
+ local prev=${COMP_WORDS[COMP_CWORD-1]}
139
+
140
+ case "${prev}" in
141
+ use) _rvm_use ;;
142
+ gemset) _rvm_gemset ;;
143
+ help) _rvm_help ;;
144
+ install) _rvm_install ;;
145
+ *) _rvm_commands ;;
146
+ esac
147
+
148
+ return 0
149
+ }
150
+
151
+ complete -o default -o nospace -F _rvm rvm
@@ -0,0 +1,87 @@
1
+ #!/usr/bin/env bash
2
+
3
+ usage()
4
+ {
5
+ printf "
6
+
7
+ Usage:
8
+
9
+ db database_file {{key}} {{value}} # set
10
+ db database_file {{key}} # get
11
+ db database_file {{key}} unset # unset
12
+
13
+ " >&2
14
+ }
15
+
16
+ if [[ -f "$1" ]] ; then
17
+
18
+ database_file="$1" ; shift
19
+
20
+ if [[ ! -f "$database_file" ]] ; then
21
+
22
+ directory=$(dirname "$database_file")
23
+
24
+ if [[ ! -d "$directory" ]] ; then
25
+ mkdir -p "$directory"
26
+ fi
27
+
28
+ touch "$database_file"
29
+
30
+ fi
31
+
32
+ else
33
+
34
+ printf "\n\nDatabase file $1 does not exist.\n\n" >&2
35
+
36
+ exit 1
37
+
38
+ fi
39
+
40
+ key="$1" ; shift
41
+
42
+ if [[ -z "$key" ]] ; then
43
+
44
+ usage
45
+
46
+ exit 1
47
+
48
+ else
49
+
50
+ value="$*"
51
+
52
+ if [[ "unset" = "$value" || "delete" = "$value" ]] ; then
53
+
54
+ sed -e "s#^$key=.*\$##" -e '/^$/d' "$database_file" > "$database_file.new"
55
+
56
+ mv "$database_file.new" "$database_file"
57
+
58
+ else
59
+
60
+ if [[ -z "$value" ]] ; then # get
61
+
62
+ awk -F= '/^'"$key"'=/' "$database_file" | sed -e "s#^$key=##" -e '/^$/d'
63
+
64
+ else # set
65
+
66
+ sed -e "s#^$key=.*\$##" -e '/^$/d' "$database_file" > "$database_file.new"
67
+
68
+ mv "$database_file.new" "$database_file"
69
+
70
+ if [[ -z "$(awk -F= "/^'"$key"'=/{print $2}" "$database_file")" ]] ; then # append
71
+
72
+ echo "$key=$value" >> "$database_file"
73
+
74
+ else # overwrite
75
+
76
+ sed -i.tmp "s#^$key=.*\$#$key=$value#" "$database_file" > "$database_file.new"
77
+
78
+ mv "$database_file.new" "$database_file"
79
+
80
+ fi
81
+
82
+ fi
83
+
84
+ fi
85
+
86
+ fi
87
+
@@ -0,0 +1,64 @@
1
+ #!/usr/bin/env bash
2
+
3
+ source "$rvm_path/scripts/base"
4
+
5
+ rvm_ruby_gem_home="${rvm_ruby_gem_home:-$GEM_HOME}"
6
+
7
+ if [[ ! -d "$rvm_ruby_gem_home" ]] && command -v gem > /dev/null 2>&1; then rvm_ruby_gem_home="$(gem env home)" ; fi
8
+
9
+ usage()
10
+ {
11
+ printf "
12
+
13
+ Usage:
14
+
15
+ rvm default [ruby] [environment_id]
16
+
17
+ Action:
18
+
19
+ {import,export,create,copy,empty,delete,name,dir,list,gemdir,install,pristine,clear,use,update,globalcache}
20
+
21
+ Description:
22
+
23
+ Commands for working with and manipulating gemsets within RVM.
24
+
25
+ Examples:
26
+ rvm default # *uses* the default ruby
27
+ rvm default 1.9.2 # Sets the 'global' default to 1.9.2
28
+ rvm default list 1.9.2 # displays the environment_id for the current 1.9.2 default
29
+ rvm default 1.9.2 1.9.2-p0 # sets the default for 'rvm 1.9.2' to p0
30
+ rvm default clear 1.9.2 # clears the set default for 1.9.2
31
+ rvm default clear # removes the current global default
32
+
33
+ "
34
+ }
35
+
36
+ default_list()
37
+ {
38
+ :
39
+ }
40
+
41
+ default_clear()
42
+ {
43
+ :
44
+ }
45
+
46
+
47
+ args=($*)
48
+ action="${args[0]}"
49
+ args=${args[@]:1}
50
+
51
+ if [[ "list" = "$action" ]] ; then
52
+ default_list
53
+
54
+ elif [[ "clear" = "$action" ]] ; then
55
+ default_clear
56
+
57
+ elif [[ "help" = "$action" ]] ; then
58
+ usage ; exit 0
59
+
60
+ else
61
+ usage ; exit 1
62
+ fi
63
+
64
+ exit $?
@@ -0,0 +1,60 @@
1
+ #!/usr/bin/env bash
2
+
3
+ #!/usr/bin/env bash
4
+ rvm_base_except="selector"
5
+ source "$rvm_path/scripts/base"
6
+
7
+ usage()
8
+ {
9
+ printf "Usage: 'rvm disk-usage {all,archives,repos,sources,logs,packages,rubies,gemsets}'\n"
10
+ printf " Lists the space rvm uses for a given item.\n"
11
+ exit 1
12
+ }
13
+
14
+ disk_usage_for_directory()
15
+ {
16
+ du -hs "$1" | awk '{print $1}'
17
+ }
18
+
19
+ disk_usage()
20
+ {
21
+ local current_path="$rvm_path/$2"
22
+ if [[ -n "$current_path" && -d "$current_path" && "$current_path" != "/" ]]; then
23
+ echo "$1 Usage: $(disk_usage_for_directory "$current_path")"
24
+ fi
25
+ return 0
26
+ }
27
+
28
+ all_disk_usage()
29
+ {
30
+ archives_disk_usage
31
+ repos_disk_usage
32
+ sources_disk_usage
33
+ logs_disk_usage
34
+ packages_disk_usage
35
+ rubies_disk_usage
36
+ gemsets_disk_usage
37
+ total_disk_usage
38
+ }
39
+
40
+ total_disk_usage()
41
+ {
42
+ echo "Total Disk Usage: $(disk_usage_for_directory "$rvm_path")"
43
+ }
44
+
45
+ archives_disk_usage() { disk_usage "Downloaded Archives" "archives"; }
46
+ repos_disk_usage() { disk_usage "Repositories" "repos"; }
47
+ sources_disk_usage() { disk_usage "Extracted Source Code" "src"; }
48
+ logs_disk_usage() { disk_usage "Log Files" "log"; }
49
+ packages_disk_usage() { disk_usage "Packages" "usr"; }
50
+ rubies_disk_usage() { disk_usage "Rubies" "rubies"; }
51
+ gemsets_disk_usage() { disk_usage "Gemsets" "gems"; }
52
+
53
+
54
+ # Exit when there is no argument.
55
+ [[ -z "$1" ]] && usage
56
+
57
+ case "$1" in
58
+ all|archives|repos|sources|logs|total|packages|rubies|gemsets) eval "$1_disk_usage" ;;
59
+ *) usage ;;
60
+ esac
@@ -0,0 +1,115 @@
1
+ #!/usr/bin/env bash
2
+ rvm_base_except="selector"
3
+
4
+ source "$rvm_path/scripts/base"
5
+
6
+ rvm_docs_ruby_string="$(__rvm_environment_identifier | awk -F"${rvm_gemset_separator:-"@"}" '{print $1}')"
7
+
8
+ if [[ "$rvm_docs_ruby_string" = "system" || -z "$rvm_docs_ruby_string" ]]; then
9
+
10
+ "$rvm_path/scripts/log" "error" "Currently 'rvm docs ...' does not work with non-rvm rubies."
11
+
12
+ exit 1
13
+
14
+ fi
15
+
16
+ rvm_docs_type="${rvm_docs_type:-rdoc}"
17
+
18
+ # Ensure we have the doc directories.
19
+ if [[ ! -d "${rvm_docs_path:-"$rvm_path/docs"}" ]] ; then
20
+
21
+ mkdir -p "${rvm_docs_path:-"$rvm_path/docs"}/rdoc" "${rvm_docs_path:-"$rvm_path/docs"}/yard"
22
+
23
+ fi
24
+
25
+ usage()
26
+ {
27
+ printf "
28
+
29
+ Usage:
30
+
31
+ rvm docs {open,generate,generate-ri,generate-rdoc}
32
+
33
+ "
34
+ return 0
35
+ }
36
+
37
+ open_docs()
38
+ {
39
+ if [[ -s "${rvm_docs_path:-"$rvm_path/docs"}/$rvm_docs_ruby_string/$rvm_docs_type/index.html" ]] ; then
40
+
41
+ if command -v open >/dev/null ; then
42
+
43
+ open "${rvm_docs_path:-"$rvm_path/docs"}/$rvm_docs_ruby_string/$rvm_docs_type/index.html"
44
+
45
+ elif command -v xdg-open >/dev/null ; then
46
+
47
+ xdg-open "${rvm_docs_path:-"$rvm_path/docs"}/$rvm_docs_ruby_string/$rvm_docs_type/index.html"
48
+
49
+ else
50
+
51
+ "$rvm_path/scripts"/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 :) )"
52
+
53
+ fi
54
+
55
+ else
56
+
57
+ "$rvm_path/scripts"/log "error" "$rvm_docs_type docs are missing, perhaps run 'rvm docs generate' first?"
58
+
59
+ fi
60
+ }
61
+
62
+ generate_ri()
63
+ {
64
+ # Generate ri docs
65
+ (
66
+ builtin cd "${rvm_src_path:-"$rvm_path/src"}/$rvm_docs_ruby_string/"
67
+
68
+ "$rvm_path/scripts/log" "info" "Generating ri documentation, be aware that this could take a *long* time, and depends heavily on your system resources..."
69
+
70
+ "$rvm_path/scripts/log" "info" "( Errors will be logged to ${rvm_log_path:-"$rvm_path/log"}/$rvm_docs_ruby_string/docs.error.log )"
71
+
72
+ rdoc -a --ri --ri-site > /dev/null 2>> ${rvm_log_path:-"$rvm_path/log"}/$rvm_docs_ruby_string/docs.error.log
73
+ )
74
+ }
75
+
76
+ generate_rdoc()
77
+ {
78
+ (
79
+ builtin cd "${rvm_src_path:-"$rvm_path/src"}/$rvm_docs_ruby_string/"
80
+
81
+ \rm -rf "${rvm_docs_path:-"$rvm_path/docs"}/$rvm_docs_ruby_string/$rvm_docs_type/"
82
+
83
+ "$rvm_path/scripts/log" "info" "Generating rdoc documentation, be aware that this could take a *long* time, and depends heavily on your system resources..."
84
+
85
+ "$rvm_path/scripts/log" "info" "( Errors will be logged to ${rvm_log_path:-"$rvm_path/log"}/$rvm_docs_ruby_string/docs.error.log )"
86
+
87
+ if gem list | \grep -q ^hanna ; then
88
+
89
+ hanna -o "${rvm_docs_path:-"$rvm_path/docs"}/$rvm_docs_ruby_string/$rvm_docs_type" --inline-source --line-numbers --fmt=html > /dev/null 2>> "${rvm_log_path:-"$rvm_path/log"}/$rvm_docs_ruby_string/docs.error.log"
90
+
91
+ else
92
+
93
+ rdoc -a -o "${rvm_docs_path:-"$rvm_path/docs"}/$rvm_docs_ruby_string/$rvm_docs_type" > /dev/null 2>> "${rvm_log_path:-"$rvm_path/log"}/$rvm_docs_ruby_string/docs.error.log"
94
+
95
+ fi
96
+ )
97
+ }
98
+
99
+ args=($*)
100
+ action="${args[0]}"
101
+ args=($(echo ${args[@]:1})) # Strip trailing / leading / extra spacing.
102
+
103
+ case "$action" in
104
+ generate)
105
+ generate_ri
106
+ generate_rdoc
107
+ ;;
108
+ open) open_docs ;;
109
+ generate-ri) generate_ri ;;
110
+ generate-rdoc) generate_rdoc ;;
111
+ help) usage ;;
112
+ *) usage ; exit 1 ;;
113
+ esac
114
+
115
+ exit $?
@@ -0,0 +1,46 @@
1
+ #!/usr/bin/env bash
2
+
3
+ unset rvm_default_flag # Recursive loops, oh my!
4
+
5
+ source "$rvm_path/scripts/base"
6
+
7
+ usage()
8
+ {
9
+ printf "
10
+ Usage:
11
+
12
+ rvm env [ruby_string] [--path]
13
+
14
+ "
15
+ }
16
+
17
+ args=($*)
18
+ environment_name="${args[0]}"
19
+
20
+ if [[ -z "$environment_name" ]]; then
21
+ usage ; exit 1
22
+ fi
23
+
24
+ # Exit when we encounter an unknown environment name.
25
+ __rvm_become "$environment_name"
26
+
27
+ if [[ "$?" = 0 ]]; then
28
+ __rvm_use
29
+ environment_file_path="$rvm_path/environments/$(__rvm_environment_identifier)"
30
+ # Echo the path or environment file.
31
+ if [[ -n "$rvm_path_flag" ]]; then
32
+ echo "$environment_file_path"
33
+ else
34
+ cat "$environment_file_path"
35
+ fi
36
+ unset environment_file_path
37
+ result=0
38
+ else
39
+ result=1
40
+ fi
41
+
42
+ unset rvm_ruby_string environment_name
43
+ __rvm_unset_ruby_variables
44
+
45
+ exit $result
46
+
@@ -0,0 +1,74 @@
1
+ #!/usr/bin/env bash
2
+
3
+ # Usage: $rvm_path/scripts/environment-convertor <shell> <environment>
4
+
5
+ unset GREP_COLOR
6
+ unset GREP_OPTIONS
7
+
8
+ source "$rvm_path/scripts/base"
9
+
10
+ convert_path_to_fish()
11
+ {
12
+ local parts path_parts
13
+
14
+ path_part="$1"
15
+ parts="$(echo "$path_part" | sed -e 's#:\$PATH##' -e "s#:#\" \"#g" -e "s#^export \\([^[:space:]]*\\)=##")"
16
+
17
+ printf "\
18
+ for path_part in $parts
19
+ if test -d $path_part
20
+ set PATH $path_parth $PATH
21
+ end
22
+ end
23
+ "
24
+ return 0
25
+ }
26
+
27
+ convert_unset_to_fish()
28
+ {
29
+ sed 's#^unset #set -e #'
30
+ }
31
+
32
+ convert_exports_to_fish()
33
+ {
34
+ sed -e "s#:#' '#g" -e "s#^\\(export \\)\\{0,1\\}\\([^[:space:]]*\\)=#set -x \\2 #"
35
+ }
36
+
37
+ contents_of_environment_file()
38
+ {
39
+ cat "$rvm_path/environments/$(__rvm_environment_identifier)"
40
+ }
41
+
42
+ convert_to_shell()
43
+ {
44
+ convert_path_to_fish "$(contents_of_environment_file | \grep '^export PATH=')"
45
+ while read -r shell_line; do
46
+ if echo "$shell_line" | \grep -q '^unset '; then
47
+ echo "$shell_line" | convert_unset_to_fish
48
+ else
49
+ echo "$shell_line" | convert_exports_to_fish
50
+ fi
51
+ done < <(contents_of_environment_file | \grep -v '^export [^=]*$' | \grep -v '^export PATH=')
52
+ unset shell_line
53
+ }
54
+
55
+ ensure_has_shell()
56
+ {
57
+ for item in "path" "unset" "exports"; do
58
+ command -v "convert_${item}_to_${1}" >/dev/null || return 1
59
+ done; unset item
60
+ }
61
+
62
+ args=($*)
63
+ shell_name="${args[0]}"
64
+ environment_name="${args[1]:-"$(__rvm_environment_identifier)"}"
65
+ args="$(echo ${args[@]:2}) " # Strip trailing / leading / extra spacing.
66
+
67
+ [[ -n "$shell_name" && -n "$environment_name" ]] || exit 1
68
+ ensure_has_shell "$shell_name" || exit 1
69
+ # Check we're loading a different shell.
70
+ if [[ "$(__rvm_environment_identifier)" != "$environment_name" ]]; then
71
+ __rvm_become "$environment_name" || exit 1
72
+ fi
73
+
74
+ convert_to_shell