Browse files

Feature: rvm_gemset_create_on_use_flag=1 in ~/.rvmrc

  • Loading branch information...
1 parent cad1bbd commit 2f52b4aaa74f01be69fed84c008407128475d778 @wayneeseguin wayneeseguin committed Mar 2, 2010
Showing with 16 additions and 6 deletions.
  1. +5 −1 examples/rvmrc
  2. +1 −1 scripts/gemsets
  3. +10 −4 scripts/utility
View
6 examples/rvmrc
@@ -44,7 +44,11 @@
# Install On Use Flag
# Install rubies when used if are not installed.
-#export ruby_install_on_use=1
+#export rvm_install_on_use_flag=1
+
+# Gemset Creat on use Flag
+# This will create a gemset when the gemset is used if it does not exist
+# export rvm_gemset_create_on_use_flag=1
# Make Flags, I have 8 cpu's so I might use 7 make threads:
#export rvm_make_flags="-j7"
View
2 scripts/gemsets
@@ -34,7 +34,7 @@ __rvm_gemset_create() {
__rvm_gemset_list() {
if [[ -z "$rvm_ruby_selected_flag" ]] ; then __rvm_select ; fi
- $rvm_scripts_path/log "info" "gems(ets) : for $rvm_ruby_string (found in $rvm_gems_path/)"
+ $rvm_scripts_path/log "info" "gemsets : for $rvm_ruby_string (found in $rvm_gems_path/)"
if [[ ! -z "$rvm_gems_path" ]] ; then
if [[ ! -z $rvm_ruby_string ]] ; then
View
14 scripts/utility
@@ -655,9 +655,11 @@ __rvm_gemset_select() {
fi
# If the gemset does not exist, then notify the user as such and abort the action.
- if [[ ! -d "$rvm_ruby_gem_home" ]] && [[ ! -z "$rvm_gemset_name" ]] && [[ -z "$rvm_create_flag" ]]; then
+ if [[ ! -d "$rvm_ruby_gem_home" ]] && [[ ! -z "$rvm_gemset_name" ]] && [[ "$rvm_gemset_create_on_use_flag" -ne 1 ]] ; then
$rvm_scripts_path/log "error" "Gemset '$rvm_gemset_name' does not exist, rvm gemset create '$rvm_gemset_name' first."
return 1
+ else
+ $rvm_scripts_path/gemsets create $rvm_gemset_name
fi
rvm_ruby_gem_path="$rvm_ruby_gem_home:$rvm_ruby_global_gems_path"
@@ -706,11 +708,15 @@ __rvm_gemset_use() {
if [[ ! -z "$rvm_ruby_gem_home" ]] ; then
if [[ ! -d "$rvm_ruby_gem_home" ]] ; then
- $rvm_scripts_path/log "error" "Gemset '$rvm_gemset_name' does not exist, rvm gemset create '$rvm_gemset_name' first."
- return 1
+ if [[ "$rvm_gemset_create_on_use_flag" -eq 1 ]] ; then
+ $rvm_scripts_path/gemsets create $rvm_gemset_name
+ else
+ $rvm_scripts_path/log "error" "Gemset '$rvm_gemset_name' does not exist, rvm gemset create '$rvm_gemset_name' first."
+ return 1
+ fi
fi
- if [[ "$rvm_interactive" = 1 ]] ; then
+ if [[ "$rvm_interactive" -eq 1 ]] || [[ "$rvm_verbose_flag" -eq 1 ]] ; then
$rvm_scripts_path/log "info" "gemset : ${rvm_gemset_name:-default}"
fi

0 comments on commit 2f52b4a

Please sign in to comment.