|
|
|
@ -1,6 +1,7 @@ |
|
|
|
|
#!/bin/sh |
|
|
|
|
# |
|
|
|
|
# 2012 Evax Software <contact@evax.fr> |
|
|
|
|
# 2012 Nico Schottelius (nico-cdist at schottelius.org) |
|
|
|
|
# |
|
|
|
|
# This file is part of cdist. |
|
|
|
|
# |
|
|
|
@ -25,29 +26,27 @@ 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")" |
|
|
|
|
if [ "$state_is" != "$state_should" ]; then |
|
|
|
|
case "$state_should" in |
|
|
|
|
present) |
|
|
|
|
cat << DONE |
|
|
|
|
su - "$user" -c "source \"\\\$HOME/.rvm/scripts/rvm\" |
|
|
|
|
rvm $gemset --create" |
|
|
|
|
|
|
|
|
|
[ "$state_is" = "$state_should" ] && exit 0 |
|
|
|
|
|
|
|
|
|
case "$state_should" in |
|
|
|
|
present) |
|
|
|
|
cat << DONE |
|
|
|
|
su - "$user" -c "source ~/.rvm/scripts/rvm; rvm $gemset --create" |
|
|
|
|
DONE |
|
|
|
|
case "$default" in |
|
|
|
|
case "$default" in |
|
|
|
|
no) |
|
|
|
|
;; |
|
|
|
|
*) |
|
|
|
|
cat << DONE |
|
|
|
|
su - "$user" -c "source \"\\\$HOME/.rvm/scripts/rvm\" |
|
|
|
|
rvm use --default $gemset" |
|
|
|
|
cat << DONE |
|
|
|
|
su - "$user" -c "source ~/.rvm/scripts/rvm; rvm use --default $gemset" |
|
|
|
|
DONE |
|
|
|
|
;; |
|
|
|
|
esac |
|
|
|
|
;; |
|
|
|
|
absent) |
|
|
|
|
cat << DONE |
|
|
|
|
su - "$user" -c "source \"\\\$HOME/.rvm/scripts/rvm\" |
|
|
|
|
rvm use $ruby; rvm --force gemset delete $gemsetname" |
|
|
|
|
esac |
|
|
|
|
;; |
|
|
|
|
absent) |
|
|
|
|
cat << DONE |
|
|
|
|
su - "$user" -c "source ~/.rvm/scripts/rvm; rvm use $ruby; rvm --force gemset delete $gemsetname" |
|
|
|
|
DONE |
|
|
|
|
;; |
|
|
|
|
esac |
|
|
|
|
fi |
|
|
|
|
;; |
|
|
|
|
esac |
|
|
|
|