rconf 0.8.15 → 0.8.16
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/bin/rconf +8 -4
- data/lib/rconf/configurators/ruby_configurator.rb +29 -1
- data/lib/rconf/version.rb +1 -1
- metadata +1 -1
data/bin/rconf
CHANGED
@@ -126,10 +126,14 @@ where [options] are:
|
|
126
126
|
ruby = Regexp.last_match(2)
|
127
127
|
gemsets = Command.execute('rvm', ruby, 'exec', 'rvm', 'gemset', 'list').output.split("\n")
|
128
128
|
i = gemsets.index { |gs| gs =~ /^gemsets for #{ruby} / }
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
129
|
+
if i
|
130
|
+
gemsets = gemsets[i + 1..-1]
|
131
|
+
gemsets.each do |gs|
|
132
|
+
gs = gs.lstrip
|
133
|
+
callback.call(ruby, gs)
|
134
|
+
end
|
135
|
+
else
|
136
|
+
report_fatal 'Failed to retrieve installed gemsets'
|
133
137
|
end
|
134
138
|
end
|
135
139
|
end
|
@@ -232,7 +232,8 @@ module RightConf
|
|
232
232
|
report_check('Setting up .rvmrc')
|
233
233
|
begin
|
234
234
|
File.open('.rvmrc', 'w') do |f|
|
235
|
-
f.puts "
|
235
|
+
f.puts "environment_id=\"#{version}@#{gemset}\""
|
236
|
+
f.puts RVM_HOOK
|
236
237
|
f.puts "type -P rconf &>/dev/null && { rconf; }"
|
237
238
|
f.puts "type -P rconf &>/dev/null || { echo 'rconf not installed, skipping (see .rvmrc)'; }"
|
238
239
|
end
|
@@ -247,6 +248,33 @@ module RightConf
|
|
247
248
|
true
|
248
249
|
end
|
249
250
|
|
251
|
+
# rvm mojo for creating and enabling 'environments'
|
252
|
+
RVM_HOOK = <<-EOF
|
253
|
+
if [[ -d "${rvm_path:-$HOME/.rvm}/environments" \
|
254
|
+
&& -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]]
|
255
|
+
then
|
256
|
+
\. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
|
257
|
+
|
258
|
+
if [[ -s "${rvm_path:-$HOME/.rvm}/hooks/after_use" ]]
|
259
|
+
then
|
260
|
+
. "${rvm_path:-$HOME/.rvm}/hooks/after_use"
|
261
|
+
fi
|
262
|
+
else
|
263
|
+
# If the environment file has not yet been created, use the RVM CLI to select.
|
264
|
+
if ! rvm --create "$environment_id"
|
265
|
+
then
|
266
|
+
echo "Failed to create RVM environment '${environment_id}'."
|
267
|
+
return 1
|
268
|
+
fi
|
269
|
+
fi
|
270
|
+
if [[ $- == *i* ]] # check for interactive shells
|
271
|
+
then
|
272
|
+
echo "Using: $(tput setaf 2)$GEM_HOME$(tput sgr0)" # show the user the ruby and gemset they are using in green
|
273
|
+
else
|
274
|
+
echo "Using: $GEM_HOME" # don't use colors in interactive shells
|
275
|
+
fi
|
276
|
+
EOF
|
277
|
+
|
250
278
|
# Setup .bashrc for rvm support
|
251
279
|
#
|
252
280
|
# === Return
|
data/lib/rconf/version.rb
CHANGED