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,6 @@
1
+ #!/usr/bin/env bash
2
+
3
+ if [[ -z "${1:-""}" ]] || [[ -z "${2:-""}" ]] ; then exit 1 ; fi
4
+
5
+ if [[ -n "$(echo "${1}" | awk "/${2//\//\/}/")" ]] ; then exit 0 ; else exit 1 ; fi
6
+
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/env bash
2
+
3
+ if [[ "$rvm_trace_flag" -eq 2 ]] ; then set -x ; export rvm_trace_flag ; fi
4
+
5
+ args=($*)
6
+ file="${args[0]}"
7
+ md5="${args[1]}"
8
+ args="$(echo ${args[@]:2}) " # Strip trailing / leading / extra spacing.
9
+
10
+ if [[ "Linux" = "$(uname)" ]] ; then
11
+ command="md5sum"
12
+ elif [[ "Darwin" = "$(uname)" ]] ; then
13
+ command="/sbin/md5 -q"
14
+ fi
15
+
16
+ file_md5=$($command "$file" | awk '{print $1}')
17
+
18
+ if [[ "$file_md5" = "$md5" ]] ; then
19
+ exit 0
20
+ else
21
+ exit 1
22
+ fi
@@ -0,0 +1,175 @@
1
+ #!/usr/bin/env bash
2
+
3
+ unset GREP_OPTIONS
4
+
5
+ source "$rvm_path/scripts/base"
6
+
7
+ usage()
8
+ {
9
+ printf "
10
+
11
+ Usage:
12
+
13
+ rvm migrate {source-ruby} {destination-ruby}
14
+
15
+ Description:
16
+
17
+ Moves all gemsets from {source-ruby} ruby to {destination-ruby}.
18
+
19
+ " >&2
20
+ }
21
+
22
+ confirm()
23
+ {
24
+ local confirmation_response
25
+
26
+ printf "$1 (Y/n): "
27
+
28
+ read -r confirmation_response
29
+
30
+ [[ -z "$confirmation_response" ]] || echo "$confirmation_response" | \grep -qi '^y'
31
+ }
32
+
33
+ die_with_error()
34
+ {
35
+ "$rvm_path/scripts/log" "fail" "$1"
36
+
37
+ exit "${2:-1}"
38
+ }
39
+
40
+ expand_ruby_name()
41
+ {
42
+ "$rvm_path/scripts/tools" strings "$1" | awk -F"${rvm_gemset_separator:-"@"}" '{print $1}'
43
+ }
44
+
45
+ migrate_rubies()
46
+ {
47
+ local origin_gemset destination_gemset gemset_name migrate_ruby_name migrate_alias_name migrate_new_alias_name binaries origin_wrappers_path full_bin_path expanded_symlink linked_binary_name new_wrapper_destination
48
+
49
+ expanded_source="$(expand_ruby_name "$source_ruby")"
50
+ expanded_destination="$(expand_ruby_name "$destination_ruby")"
51
+
52
+ if [[ -z "$expanded_source" ]]; then
53
+ die_with_error "Could not expand source ruby '$source_ruby'"
54
+
55
+ elif [[ -z "$expanded_destination" ]]; then
56
+ die_with_error "Could not expand destination ruby '$destination_ruby'"
57
+
58
+ elif [[ "$expanded_destination" = "$expanded_source" ]]; then
59
+ die_with_error "Source and Destination Ruby are the same ($expanded_destination)"
60
+
61
+ elif [[ ! -d "$rvm_path/rubies/$expanded_source" ]]; then
62
+ die_with_error "Ruby '$expanded_source' is not installed - please install it first."
63
+
64
+ elif [[ ! -d "$rvm_path/rubies/$expanded_destination" ]]; then
65
+ die_with_error "Ruby '$expanded_destination' is not installed - please install it first."
66
+ fi
67
+
68
+ echo "Are you sure you wish to MOVE gems from $expanded_source to $expanded_destination?"
69
+
70
+ confirm "This will overwrite existing gems in $expanded_destination and remove them from $expanded_source" || return 1
71
+
72
+ echo "Moving gemsets..."
73
+
74
+ while read -r origin_gemset; do
75
+ [[ "$origin_gemset" = "$expanded_source" || "$origin_gemset" = "${expanded_source}${rvm_gemset_separator:-"@"}"* ]] || continue
76
+
77
+ gemset_name="${origin_gemset/*${rvm_gemset_separator:-"@"}/}"
78
+
79
+ destination_gemset="$expanded_destination"
80
+
81
+ if [[ -n "$gemset_name" ]]; then
82
+ destination_gemset="${destination_gemset}${rvm_gemset_separator:-"@"}${gemset_name}"
83
+ fi
84
+
85
+ echo "Moving $origin_gemset to $destination_gemset"
86
+
87
+ rm -rf "${rvm_gems_path:-"$rvm_path/gems"}/$destination_gemset"
88
+ result="$?"
89
+
90
+ [[ $result -gt 0 ]] && die_with_error "Unable to remove gem directory '${rvm_gems_path:-"$rvm_path/gems"}/$destination_gemset'" "$result"
91
+
92
+ mv "${rvm_gems_path:-"$rvm_path/gems"}/$origin_gemset" "${rvm_gems_path:-"$rvm_path/gems"}/$destination_gemset"
93
+ result="$?"
94
+
95
+ [[ $result -gt 0 ]] && die_with_error "Unable to move '${rvm_gems_path:-"$rvm_path/gems"}/$origin_gemset' to '${rvm_gems_path:-"$rvm_path/gems"}/$destination_gemset'" "$result"
96
+
97
+ echo "Making gemset $destination_gemset pristine."
98
+
99
+ __rvm_run_with_env "gemset.pristine" "$destination_gemset" "rvm gemset pristine"
100
+
101
+ done < <("$rvm_path/scripts/list" gemsets strings | \grep "^$expanded_source")
102
+
103
+
104
+ if confirm 'Do you wish to move over aliases?' ; then
105
+
106
+ while read -r alias_pair; do
107
+
108
+ migrate_ruby_name="${alias_pair/*=/}"
109
+
110
+ migrate_alias_name="${alias_pair/=*/}"
111
+
112
+ if [[ "$migrate_ruby_name" = "$expanded_source" || "$migrate_ruby_name" = "${expanded_source}${rvm_gemset_separator:-"@"}"* ]]; then
113
+
114
+ migrate_new_alias_name="${migrate_ruby_name/$expanded_source/$expanded_destination}"
115
+
116
+ echo "Updating alias $migrate_alias_name to point to $migrate_new_alias_name"
117
+
118
+ "$rvm_path/scripts/alias" delete "$migrate_alias_name" >/dev/null 2>&1
119
+
120
+ "$rvm_path/scripts/alias" create "$migrate_alias_name" "$migrate_new_alias_name" >/dev/null 2>&1
121
+ fi
122
+
123
+ done < "$rvm_path/config/alias"
124
+
125
+ fi
126
+
127
+ if confirm "Do you wish to move over wrappers?" ; then
128
+
129
+ origin_wrappers_path="$rvm_path/wrappers/$expanded_source"
130
+
131
+ binaries=($(cd "${rvm_bin_path:-"$rvm_path/bin"}" ; find . -maxdepth 1 -mindepth 1 -type f))
132
+
133
+ for binary_name in "${binaries[@]//.\/}" ; do
134
+
135
+ full_bin_path="${rvm_bin_path:-"$rvm_path/bin"}/$binary_name"
136
+
137
+ [[ ! -L "$full_bin_path" ]] && continue
138
+
139
+ expanded_symlink="$(readlink "$full_bin_path")"
140
+
141
+ [[ "$expanded_symlink" != "$origin_wrappers_path/"* ]] && continue
142
+
143
+ linked_binary_name="$(basename "$expanded_symlink")"
144
+
145
+ [[ "$binary_name" = "$linked_binary_name-$expanded_source" || "$binary_name" = "$expanded_source" ]] && continue
146
+
147
+ new_wrapper_destination="${expanded_symlink/$expanded_source/$expanded_destination}"
148
+
149
+ ln -sf "$new_wrapper_destination" "$full_bin_path"
150
+ done
151
+ fi
152
+
153
+ if confirm "Do you also wish to completely remove $expanded_source (inc. archive)?" ; then
154
+
155
+ __rvm_run_with_env "rvm.remove" "$expanded_source" "rvm remove $expanded_source --archive --gems"
156
+
157
+ fi
158
+
159
+ echo "Successfully migrated $expanded_source to $expanded_destination"
160
+
161
+ }
162
+
163
+ args=($*)
164
+ source_ruby="${args[0]}"
165
+ destination_ruby="${args[1]}"
166
+ args="$(echo ${args[@]:2}) " # Strip trailing / leading / extra spacing.
167
+
168
+ if [[ -z "$source_ruby" || -z "$destination_ruby" ]]; then
169
+ usage ; exit 1
170
+ fi
171
+
172
+ source_ruby="$1"; shift
173
+ destination_ruby="$1"; shift
174
+
175
+ migrate_rubies
@@ -0,0 +1,105 @@
1
+ #!/usr/bin/env bash
2
+
3
+ original_ruby_strings=$rvm_ruby_strings
4
+ original_ruby_string=$rvm_ruby_string
5
+
6
+ source "$rvm_path/scripts/base"
7
+
8
+ rvm_monitor_sleep="${rvm_monitor_sleep:-2}"
9
+
10
+ timestamp()
11
+ {
12
+ if [[ "Darwin" = "$(uname)" ]] ; then
13
+ echo $(stat -f "%m" $1)
14
+ else
15
+ echo $(stat -c "%Y" $1)
16
+ fi
17
+ }
18
+
19
+ push_if_timestamp_changed()
20
+ {
21
+ local file=$1
22
+
23
+ local file_timestamp=$(timestamp "$file")
24
+
25
+ eval "time=\$${framework}_timestamp"
26
+
27
+ if [[ "$file_timestamp" -gt $time ]] ; then
28
+
29
+ array_push "changed_${framework}_files" $file
30
+
31
+ fi
32
+ }
33
+
34
+ update_timestamp()
35
+ {
36
+ if [[ -d "${1}/" ]] ; then
37
+
38
+ \touch "$rvm_path/${$}_${1}_timestamp"
39
+
40
+ eval "${1}_timestamp=\$(timestamp \"$rvm_path/${$}_${1}_timestamp\")"
41
+
42
+ fi
43
+ }
44
+
45
+ update_timestamp "test"
46
+ update_timestamp "spec"
47
+
48
+ while : ; do
49
+ changed_test_files=() ; changed_spec_files=() ; changed_code_files=()
50
+
51
+ for file in lib/**/*.rb lib/*.rb app/**/*.rb app/*.rb ; do
52
+ if [[ -f "$file" ]] ; then push_if_timestamp_changed $file "code" ; fi
53
+ done
54
+
55
+ for framework in test spec ; do
56
+
57
+ if [[ -d "$framework/" ]] ; then
58
+
59
+ for file in ${framework}/**/*_${framework}.rb ${framework}/*_${framework}.rb ; do
60
+ if [[ -f "$file" ]] ; then
61
+ push_if_timestamp_changed $file $framework
62
+ fi
63
+ done
64
+
65
+ if [[ "$(array_length "changed_${framework}_files")" -gt 0 ]] ; then
66
+ rvm_ruby_strings=$original_ruby_strings
67
+ rvm_ruby_string=$original_ruby_string
68
+ if [[ "spec" = "$framework" ]] ; then
69
+ rvm_action="spec"
70
+ rvm_ruby_args="spec/spec_helper.rb ${changed_spec_files[*]}"
71
+ "$rvm_path/scripts/set" $rvm_action $rvm_ruby_args
72
+ elif [[ "test" = "$framework" ]] ; then
73
+ rvm_action="ruby"
74
+ rvm_ruby_args=" -r$(echo "${changed_test_files[*]}" | sed 's/ / -r/g') test/test_helper.rb"
75
+ "$rvm_path/scripts/set" $rvm_action $rvm_ruby_args
76
+ fi
77
+ update=1
78
+ fi
79
+
80
+ if [[ "$(array_length "changed_code_files")" -gt 0 ]] ; then
81
+ rvm_ruby_strings=$original_ruby_strings
82
+ rvm_ruby_string=$original_ruby_string
83
+ if [[ "spec" = "$framework" ]] ; then
84
+ rvm_action="spec"
85
+ rvm_ruby_args="spec/"
86
+ "$rvm_path/scripts/set" $rvm_action $rvm_ruby_args
87
+ elif [[ "test" = "$framework" ]] ; then
88
+ rvm_action="rake"
89
+ rvm_ruby_args="test"
90
+ "$rvm_path/scripts/set" "$rvm_action" $rvm_ruby_args
91
+ fi
92
+ update=1
93
+ fi
94
+ fi
95
+
96
+ if [[ "$update" -eq 1 ]] ; then
97
+ update_timestamp $framework
98
+ fi
99
+ done
100
+
101
+ unset update changed_test_files changed_spec_files
102
+
103
+ sleep $rvm_monitor_sleep
104
+ done
105
+
@@ -0,0 +1,121 @@
1
+ #!/usr/bin/env bash
2
+
3
+ system="$(uname)"
4
+
5
+ if [[ "Linux" = "$system" ]] ; then
6
+ for file in /etc/*-release ; do
7
+ release="( $(cat $file) )" ; break
8
+ done
9
+ printf "\n\nNotes for ${system} $release\n"
10
+
11
+ rvm_aptitude_binary="$(command -v aptitude || command -v apt-get)"
12
+ rvm_emerge_binary="$(command -v emerge)"
13
+ rvm_pacman_binary="$(command -v pacman)"
14
+ rvm_yum_binary="$(command -v yum)"
15
+
16
+ printf "
17
+ # NOTE: MRI stands for Matz's Ruby Interpreter (1.8.X, 1.9.X), ree stands for Ruby Enterprise Edition and rbx stands for Rubinius.
18
+ # curl is required.
19
+ # git is required.
20
+ # patch is required (for ree, some ruby head's).
21
+ # If you wish to install rbx and/or any MRI head (eg. 1.9.2-head) then you must install and use rvm 1.8.7 first.
22
+ # If you wish to have the 'pretty colors' again, set 'export rvm_pretty_print_flag=1' in ~/.rvmrc.
23
+ "
24
+
25
+ if [[ ! -z "$rvm_aptitude_binary" ]] ; then
26
+ printf "
27
+ dependencies:
28
+ # For RVM
29
+ rvm: bash curl git-core
30
+
31
+ # For JRuby (if you wish to use it) you will need:
32
+ jruby: aptitude install curl sun-java6-bin sun-java6-jre sun-java6-jdk
33
+
34
+ # For MRI & ree (if you wish to use it) you will need (depending on what you are installing):
35
+ ruby: aptitude install build-essential bison openssl libreadline5 libreadline-dev curl git-core zlib1g zlib1g-dev libssl-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev
36
+ ruby-head: git subversion autoconf
37
+
38
+ # For IronRuby (if you wish to use it) you will need:
39
+ ironruby: aptitude install curl mono-2.0-devel
40
+ "
41
+
42
+ elif [[ ! -z "$rvm_emerge_binary" ]] ; then
43
+ printf "
44
+ dependencies:
45
+ # For RVM
46
+ rvm: bash curl git
47
+
48
+ # For MRI based rubies you will need:
49
+ ruby: # TODO: tell Wayne what goes here :)
50
+ ruby-head: # TODO: tell Wayne what goes here :)
51
+
52
+ # For JRuby (if you wish to use it) you will need:
53
+ jruby: emerge dev-java/sun-jdk dev-java/sun-jre-bin
54
+
55
+ # For IronRuby (if you wish to use it) you will need:
56
+ ironruby: emerge dev-lang/mono
57
+ "
58
+
59
+ elif [[ ! -z "$rvm_pacman_binary" ]] ; then
60
+ printf "
61
+ dependencies:
62
+ # For RVM itself
63
+ rvm: bash curl git
64
+
65
+ # For MRI based rubies you will need:
66
+ ruby: pacman -Sy --noconfirm patch curl bison zlib readline libxml2 git make
67
+ ruby-head: pacman -Sy --noconfirm subversion autoconf diffutils patch bison make
68
+
69
+ # For JRuby (if you wish to use it) you will need:
70
+ jruby: pacman -Sy --noconfirm jdk jre curl
71
+
72
+ # For IronRuby (if you wish to use it) you will need:
73
+ ironruby: pacman -Sy --noconfirm mono
74
+ "
75
+
76
+ elif [[ ! -z "$rvm_yum_binary" ]] ; then
77
+ printf "
78
+ dependencies:
79
+ # For RVM
80
+ rvm: yum install -y bash curl git
81
+
82
+ # For MRI/ree (if you wish to use it) you will need:
83
+ ruby: yum install -y gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel ; \\
84
+ yum install -y iconv-devel # NOTE: For centos 5.4 final iconv-devel might not be available :(
85
+
86
+ # For JRuby (if you wish to use it) you will need:
87
+ jruby: yum install -y java
88
+ "
89
+
90
+ else
91
+ printf "
92
+ dependencies:
93
+ # RVM
94
+ rvm: bash curl git
95
+
96
+ # FOR MRI Ruby, recommended system packages are
97
+ ruby: # gcc-c++ patch readline zlib libyaml iconv libxml2 libxslt
98
+
99
+ # For JRuby (if you wish to use it) you will need:
100
+ jruby: #The SUN java runtime environment and development kit.
101
+
102
+ # For IronRuby (if you wish to use it) you will need:
103
+ ironruby: #The Mono Runtime and Development Platform (version 2.6 or greater is recommended).
104
+ "
105
+ fi
106
+ elif [[ "Darwin" = "$system" ]] ; then
107
+
108
+ release="( $(sw_vers -productName) )"
109
+
110
+ printf "
111
+ Notes for ${system} $release
112
+ # For Snow Leopard be sure to have XCode Tools Version 3.2.1 (1613) or later (there were bugs with the dvd release version).
113
+ # You should download the latest XCode tools from developer.apple.com. This is necessary since the dvd install for Snow Leopard has bugs.
114
+ # If you intend on installing MacRuby you must install LLVM first.
115
+ # If you intend on installing JRuby you must install the JDK.
116
+ # If you intend on installing IronRuby you must install Mono (version 2.6 or greater is recommended).
117
+ "
118
+ fi
119
+
120
+ echo
121
+
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env bash
2
+
3
+ if [[ ${rvm_leave_gem_alone:-0} -eq 0 ]]; then
4
+ gem()
5
+ {
6
+ local result
7
+
8
+ command gem "$@" ; result="$?"
9
+
10
+ hash -r
11
+
12
+ return $result
13
+ }
14
+ fi