convert __rvm_gmeset to boolean parameter

Signed-off-by: Nico Schottelius <nico@brief.schottelius.org>
This commit is contained in:
Nico Schottelius 2012-11-15 17:47:06 +01:00
parent f834352e88
commit e6bf226036
3 changed files with 8 additions and 11 deletions

View file

@ -24,7 +24,6 @@ ruby="$(echo "$gemset" | cut -d '@' -f 1)"
gemsetname="$(echo "$gemset" | cut -d '@' -f 2)"
state_is="$(cat "$__object/explorer/state")"
user="$(cat "$__object/parameter/user")"
default="$(cat "$__object/parameter/default" 2>/dev/null || true)"
state_should="$(cat "$__object/parameter/state")"
[ "$state_is" = "$state_should" ] && exit 0
@ -34,15 +33,12 @@ case "$state_should" in
cat << DONE
su - "$user" -c "source ~/.rvm/scripts/rvm; rvm $gemset --create"
DONE
case "$default" in
no)
;;
*)
cat << DONE
if -f "$__object/parameter/default"; then
cat << DONE
su - "$user" -c "source ~/.rvm/scripts/rvm; rvm use --default $gemset"
DONE
;;
esac
fi
;;
absent)
cat << DONE

View file

@ -20,10 +20,11 @@ user::
state::
Either "present" or "absent".
OPTIONAL PARAMETERS
BOOLEAN PARAMETERS
-------------------
default::
If set to anything but "no" (the default), set the given gemset as default.
If present, set the given gemset as default.
EXAMPLES
--------
@ -33,7 +34,7 @@ EXAMPLES
__rvm_gemset ruby-1.9.3-p0@myset --user charles --state present
# Do the same and make ruby-1.9.3-p0@myset the default gemset
__rvm_gemset ruby-1.9.3-p0@myset --user charles --state present --default yes
__rvm_gemset ruby-1.9.3-p0@myset --user charles --state present --default
# Remove the gemset @myset for user john
__rvm_ruby ruby-1.9.3-p0@myset --user john --state absent