many cleanups to __rvm* types
Signed-off-by: Nico Schottelius <nico@brief.schottelius.org>
This commit is contained in:
parent
d5955bbb4d
commit
df88d98ea0
4 changed files with 25 additions and 27 deletions
|
@ -1,5 +1,4 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
#!/bin/sh #
|
||||
# 2012 Evax Software <contact@evax.fr>
|
||||
# 2012 Nico Schottelius (nico-cdist at schottelius.org)
|
||||
#
|
||||
|
@ -32,12 +31,12 @@ state_should="$(cat "$__object/parameter/state")"
|
|||
case "$state_should" in
|
||||
present)
|
||||
cat << DONE
|
||||
su - "$user" -c "source \"\\\$HOME/.rvm/scripts/rvm; rvm use $gemset; gem install $gem"\"
|
||||
su - "$user" -c 'source ~/.rvm/scripts/rvm; rvm use "$gemset"; gem install "$gem"'
|
||||
DONE
|
||||
;;
|
||||
absent)
|
||||
cat << DONE
|
||||
su - "$user" -c "source \"\\\$HOME/.rvm/scripts/rvm; rvm use $gemset; gem uninstall $gem"\"
|
||||
su - "$user" -c 'source ~/.rvm/scripts/rvm; rvm use "$gemset"; gem uninstall "$gem"'
|
||||
DONE
|
||||
;;
|
||||
esac
|
||||
|
|
|
@ -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 ~/.rvm ]" ; then
|
||||
echo "absent"
|
||||
exit 0
|
||||
fi
|
||||
if su - "$user" -c "source \"\$HOME/.rvm/scripts/rvm\"
|
||||
if su - "$user" -c "source ~/.rvm/scripts/rvm
|
||||
rvm list | grep -q $ruby"; then
|
||||
if su - "$user" -c "source \"\$HOME/.rvm/scripts/rvm\"
|
||||
if su - "$user" -c "source ~/.rvm/scripts/rvm
|
||||
rvm use $ruby > /dev/null; rvm gemset list | grep -q $gemsetname"; then
|
||||
echo "present"
|
||||
exit 0
|
||||
|
|
|
@ -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
|
||||
|
||||
[ "$state_is" = "$state_should" ] && exit 0
|
||||
|
||||
case "$state_should" in
|
||||
present)
|
||||
cat << DONE
|
||||
su - "$user" -c "source \"\\\$HOME/.rvm/scripts/rvm\"
|
||||
rvm $gemset --create"
|
||||
su - "$user" -c "source ~/.rvm/scripts/rvm; rvm $gemset --create"
|
||||
DONE
|
||||
case "$default" in
|
||||
no)
|
||||
;;
|
||||
*)
|
||||
cat << DONE
|
||||
su - "$user" -c "source \"\\\$HOME/.rvm/scripts/rvm\"
|
||||
rvm use --default $gemset"
|
||||
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"
|
||||
su - "$user" -c "source ~/.rvm/scripts/rvm; rvm use $ruby; rvm --force gemset delete $gemsetname"
|
||||
DONE
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
esac
|
||||
|
|
|
@ -9,7 +9,7 @@ Changelog
|
|||
* Core: Export PYTHONPATH, it's also needed by emulator
|
||||
* Bugfix Type __rvm_ruby: Add clean package dependencies
|
||||
* Bugfix Type __rvm_gem: Run rvm as user, not as root
|
||||
* Cleanup Type __rvm: Use shortcut version
|
||||
* Cleanup Type __rvm, __rvm_gemset: Use shortcut version
|
||||
|
||||
2.1.0pre5: 2012-11-01
|
||||
* Core: First round of tests updated to work with multiple configuration directories
|
||||
|
|
Loading…
Reference in a new issue