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 Evax Software <contact@evax.fr>
|
||||||
# 2012 Nico Schottelius (nico-cdist at schottelius.org)
|
# 2012 Nico Schottelius (nico-cdist at schottelius.org)
|
||||||
#
|
#
|
||||||
|
@ -32,12 +31,12 @@ state_should="$(cat "$__object/parameter/state")"
|
||||||
case "$state_should" in
|
case "$state_should" in
|
||||||
present)
|
present)
|
||||||
cat << DONE
|
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
|
DONE
|
||||||
;;
|
;;
|
||||||
absent)
|
absent)
|
||||||
cat << DONE
|
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
|
DONE
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
|
@ -22,13 +22,13 @@ gemset="$__object_id"
|
||||||
ruby="$(echo "$gemset" | cut -d '@' -f 1)"
|
ruby="$(echo "$gemset" | cut -d '@' -f 1)"
|
||||||
gemsetname="$(echo "$gemset" | cut -d '@' -f2)"
|
gemsetname="$(echo "$gemset" | cut -d '@' -f2)"
|
||||||
user="$(cat "$__object/parameter/user")"
|
user="$(cat "$__object/parameter/user")"
|
||||||
if su - "$user" -c "[ ! -d \"\$HOME/.rvm\" ]" ; then
|
if su - "$user" -c "[ ! -d ~/.rvm ]" ; then
|
||||||
echo "absent"
|
echo "absent"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
if su - "$user" -c "source \"\$HOME/.rvm/scripts/rvm\"
|
if su - "$user" -c "source ~/.rvm/scripts/rvm
|
||||||
rvm list | grep -q $ruby"; then
|
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
|
rvm use $ruby > /dev/null; rvm gemset list | grep -q $gemsetname"; then
|
||||||
echo "present"
|
echo "present"
|
||||||
exit 0
|
exit 0
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#
|
#
|
||||||
# 2012 Evax Software <contact@evax.fr>
|
# 2012 Evax Software <contact@evax.fr>
|
||||||
|
# 2012 Nico Schottelius (nico-cdist at schottelius.org)
|
||||||
#
|
#
|
||||||
# This file is part of cdist.
|
# This file is part of cdist.
|
||||||
#
|
#
|
||||||
|
@ -25,29 +26,27 @@ state_is="$(cat "$__object/explorer/state")"
|
||||||
user="$(cat "$__object/parameter/user")"
|
user="$(cat "$__object/parameter/user")"
|
||||||
default="$(cat "$__object/parameter/default" 2>/dev/null || true)"
|
default="$(cat "$__object/parameter/default" 2>/dev/null || true)"
|
||||||
state_should="$(cat "$__object/parameter/state")"
|
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)
|
present)
|
||||||
cat << DONE
|
cat << DONE
|
||||||
su - "$user" -c "source \"\\\$HOME/.rvm/scripts/rvm\"
|
su - "$user" -c "source ~/.rvm/scripts/rvm; rvm $gemset --create"
|
||||||
rvm $gemset --create"
|
|
||||||
DONE
|
DONE
|
||||||
case "$default" in
|
case "$default" in
|
||||||
no)
|
no)
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
cat << DONE
|
cat << DONE
|
||||||
su - "$user" -c "source \"\\\$HOME/.rvm/scripts/rvm\"
|
su - "$user" -c "source ~/.rvm/scripts/rvm; rvm use --default $gemset"
|
||||||
rvm use --default $gemset"
|
|
||||||
DONE
|
DONE
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
absent)
|
absent)
|
||||||
cat << DONE
|
cat << DONE
|
||||||
su - "$user" -c "source \"\\\$HOME/.rvm/scripts/rvm\"
|
su - "$user" -c "source ~/.rvm/scripts/rvm; rvm use $ruby; rvm --force gemset delete $gemsetname"
|
||||||
rvm use $ruby; rvm --force gemset delete $gemsetname"
|
|
||||||
DONE
|
DONE
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ Changelog
|
||||||
* Core: Export PYTHONPATH, it's also needed by emulator
|
* Core: Export PYTHONPATH, it's also needed by emulator
|
||||||
* Bugfix Type __rvm_ruby: Add clean package dependencies
|
* Bugfix Type __rvm_ruby: Add clean package dependencies
|
||||||
* Bugfix Type __rvm_gem: Run rvm as user, not as root
|
* 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
|
2.1.0pre5: 2012-11-01
|
||||||
* Core: First round of tests updated to work with multiple configuration directories
|
* Core: First round of tests updated to work with multiple configuration directories
|
||||||
|
|
Loading…
Reference in a new issue