forked from ungleich-public/cdist
Merge remote-tracking branch 'evax/rvm-types'
This commit is contained in:
commit
9965dc3da4
8 changed files with 23 additions and 21 deletions
|
@ -23,13 +23,13 @@ gemset="$(cat "$__object/parameter/gemset")"
|
|||
ruby="$(echo "$gemset" | cut -d '@' -f 1)"
|
||||
gemsetname="$(echo "$gemset" | cut -d '@' -f2)"
|
||||
user="$(cat "$__object/parameter/user")"
|
||||
if su - $user -c "[ ! -d \"\$HOME/.rvm\" ]" ; then
|
||||
if su - "$user" -c "[ ! -d \"\$HOME/.rvm\" ]" ; then
|
||||
echo "removed"
|
||||
exit 0
|
||||
fi
|
||||
if su - $user -c "source \"\$HOME/.rvm/scripts/rvm\"
|
||||
if su - "$user" -c "source \"\$HOME/.rvm/scripts/rvm\"
|
||||
rvm list | grep -q $ruby"; then
|
||||
if su - $user -c "source \"\$HOME/.rvm/scripts/rvm\"
|
||||
if su - "$user" -c "source \"\$HOME/.rvm/scripts/rvm\"
|
||||
rvm use $ruby > /dev/null; rvm gemset list | grep -q $gemsetname &&
|
||||
rvm use $gemset > /dev/null && gem list | grep -q $gem"; then
|
||||
echo "installed"
|
||||
|
|
|
@ -29,13 +29,13 @@ if [ "$state_is" != "$state_should" ]; then
|
|||
case "$state_should" in
|
||||
installed)
|
||||
cat << DONE
|
||||
su - $user -c "source \"\\\$HOME/.rvm/scripts/rvm\"
|
||||
su - "$user" -c "source \"\\\$HOME/.rvm/scripts/rvm\"
|
||||
rvm use $gemset; gem install $gem"
|
||||
DONE
|
||||
;;
|
||||
removed)
|
||||
cat << DONE
|
||||
su - $user -c "source \"\\\$HOME/.rvm/scripts/rvm\"
|
||||
su - "$user" -c "source \"\\\$HOME/.rvm/scripts/rvm\"
|
||||
rvm use $gemset; gem uninstall $gem"
|
||||
DONE
|
||||
;;
|
||||
|
|
|
@ -31,8 +31,8 @@ else
|
|||
echo $default > "$__object/parameter/default"
|
||||
fi
|
||||
|
||||
__rvm $user --state installed
|
||||
__rvm "$user" --state installed
|
||||
require="__rvm/$user" \
|
||||
__rvm_ruby $ruby --user $user --state installed --default $default
|
||||
__rvm_ruby $ruby --user "$user" --state installed --default $default
|
||||
require="__rvm_ruby/$ruby" \
|
||||
__rvm_gemset $gemset --user $user --state installed --default $default
|
||||
__rvm_gemset $gemset --user "$user" --state installed --default $default
|
||||
|
|
|
@ -22,13 +22,13 @@ gemset="$__object_id"
|
|||
ruby="$(echo "$gemset" | cut -d '@' -f 1)"
|
||||
gemsetname="$(echo "$gemset" | cut -d '@' -f2)"
|
||||
user="$(cat "$__object/parameter/user")"
|
||||
if su - $user -c "[ ! -d \"\$HOME/.rvm\" ]" ; then
|
||||
if su - "$user" -c "[ ! -d \"\$HOME/.rvm\" ]" ; then
|
||||
echo "removed"
|
||||
exit 0
|
||||
fi
|
||||
if su - $user -c "source \"\$HOME/.rvm/scripts/rvm\"
|
||||
if su - "$user" -c "source \"\$HOME/.rvm/scripts/rvm\"
|
||||
rvm list | grep -q $ruby"; then
|
||||
if su - $user -c "source \"\$HOME/.rvm/scripts/rvm\"
|
||||
if su - "$user" -c "source \"\$HOME/.rvm/scripts/rvm\"
|
||||
rvm use $ruby > /dev/null; rvm gemset list | grep -q $gemsetname"; then
|
||||
echo "installed"
|
||||
exit 0
|
||||
|
|
|
@ -23,12 +23,13 @@ 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")"
|
||||
state_should="$(cat "$__object/parameter/state")"
|
||||
if [ "$state_is" != "$state_should" ]; then
|
||||
case "$state_should" in
|
||||
installed)
|
||||
cat << DONE
|
||||
su - $user -c "source \"\\\$HOME/.rvm/scripts/rvm\"
|
||||
su - "$user" -c "source \"\\\$HOME/.rvm/scripts/rvm\"
|
||||
rvm $gemset --create"
|
||||
DONE
|
||||
case "$default" in
|
||||
|
@ -36,7 +37,7 @@ DONE
|
|||
;;
|
||||
*)
|
||||
cat << DONE
|
||||
su - $user -c "source \"\\\$HOME/.rvm/scripts/rvm\"
|
||||
su - "$user" -c "source \"\\\$HOME/.rvm/scripts/rvm\"
|
||||
rvm use --default $gemset"
|
||||
DONE
|
||||
;;
|
||||
|
@ -44,7 +45,7 @@ DONE
|
|||
;;
|
||||
removed)
|
||||
cat << DONE
|
||||
su - $user -c "source \"\\\$HOME/.rvm/scripts/rvm\"
|
||||
su - "$user" -c "source \"\\\$HOME/.rvm/scripts/rvm\"
|
||||
rvm use $ruby; rvm --force gemset delete $gemsetname"
|
||||
DONE
|
||||
;;
|
||||
|
|
|
@ -27,9 +27,10 @@ if [ -f "$__object/parameter/default" ]; then
|
|||
default="$(cat "$__object/parameter/default")"
|
||||
else
|
||||
default="no"
|
||||
echo $default > "$__object/parameter/default"
|
||||
fi
|
||||
|
||||
__rvm $user --state installed
|
||||
__rvm "$user" --state installed
|
||||
require="__rvm/$user" \
|
||||
__rvm_ruby $ruby --user $user --state installed --default $default
|
||||
__rvm_ruby $ruby --user "$user" --state installed --default $default
|
||||
|
||||
|
|
|
@ -20,11 +20,11 @@
|
|||
|
||||
ruby="$__object_id"
|
||||
user="$(cat "$__object/parameter/user")"
|
||||
if su - $user -c "[ ! -d \"\$HOME/.rvm\" ]" ; then
|
||||
if su - "$user" -c "[ ! -d \"\$HOME/.rvm\" ]" ; then
|
||||
echo "removed"
|
||||
exit 0
|
||||
fi
|
||||
if su - $user -c "source \"\$HOME/.rvm/scripts/rvm\"
|
||||
if su - "$user" -c "source \"\$HOME/.rvm/scripts/rvm\"
|
||||
rvm list | grep -q $ruby"; then
|
||||
echo "installed"
|
||||
else
|
||||
|
|
|
@ -26,19 +26,19 @@ state_should="$(cat "$__object/parameter/state")"
|
|||
if [ "$state_is" != "$state_should" ]; then
|
||||
case "$state_should" in
|
||||
installed)
|
||||
echo "su - $user -c \"source \\\$HOME/.rvm/scripts/rvm;"\
|
||||
echo "su - \"$user\" -c \"source \\\$HOME/.rvm/scripts/rvm;"\
|
||||
"rvm install $ruby\""
|
||||
case "$default" in
|
||||
no)
|
||||
;;
|
||||
*)
|
||||
echo "su - $user -c \"source \\\$HOME/.rvm/scripts/rvm;"\
|
||||
echo "su - \"$user\" -c \"source \\\$HOME/.rvm/scripts/rvm;"\
|
||||
"rvm use --default $ruby\""
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
removed)
|
||||
echo "su - $user -c \"source \\\$HOME/.rvm/scripts/rvm;"\
|
||||
echo "su - \"$user\" -c \"source \\\$HOME/.rvm/scripts/rvm;"\
|
||||
"rvm remove $ruby\""
|
||||
;;
|
||||
esac
|
||||
|
|
Loading…
Reference in a new issue