switch the __rvm type to the new present/absent state scheme
This commit is contained in:
parent
196fb7e656
commit
5c70018411
15 changed files with 41 additions and 41 deletions
|
@ -20,7 +20,7 @@
|
|||
|
||||
user="$__object_id"
|
||||
if su - $user -c "[ -d \"\$HOME/.rvm\" ]" ; then
|
||||
echo "installed"
|
||||
echo "present"
|
||||
else
|
||||
echo "removed"
|
||||
echo "absent"
|
||||
fi
|
||||
|
|
|
@ -23,12 +23,12 @@ state_is="$(cat "$__object/explorer/state")"
|
|||
state_should="$(cat "$__object/parameter/state")"
|
||||
if [ "$state_is" != "$state_should" ]; then
|
||||
case "$state_should" in
|
||||
installed)
|
||||
present)
|
||||
cat << DONE
|
||||
su - $user -c "curl -L get.rvm.io | bash -s stable"
|
||||
DONE
|
||||
;;
|
||||
removed)
|
||||
absent)
|
||||
cat << DONE
|
||||
su - $user -c "rm -Rf \"\\\$HOME/.rvm\";
|
||||
sed '/rvm\/scripts\/rvm/d' \"\\\$HOME/.bashrc\" > \"\\\$HOME/.bashrc.cdist-tmp\"
|
||||
|
|
|
@ -16,7 +16,7 @@ RVM is the Ruby enVironment Manager for the Ruby programming language.
|
|||
REQUIRED PARAMETERS
|
||||
-------------------
|
||||
state::
|
||||
Either "installed" or "removed".
|
||||
Either "present" or "absent".
|
||||
|
||||
|
||||
EXAMPLES
|
||||
|
@ -24,10 +24,10 @@ EXAMPLES
|
|||
|
||||
--------------------------------------------------------------------------------
|
||||
# Install rvm for user billie
|
||||
__rvm billie --state installed
|
||||
__rvm billie --state present
|
||||
|
||||
# Remove rvm
|
||||
__rvm billie --state removed
|
||||
__rvm billie --state absent
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ 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
|
||||
echo "removed"
|
||||
echo "absent"
|
||||
exit 0
|
||||
fi
|
||||
if su - "$user" -c "source \"\$HOME/.rvm/scripts/rvm\"
|
||||
|
@ -32,8 +32,8 @@ rvm list | grep -q $ruby"; then
|
|||
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"
|
||||
echo "present"
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
echo "removed"
|
||||
echo "absent"
|
||||
|
|
|
@ -27,13 +27,13 @@ user="$(cat "$__object/parameter/user")"
|
|||
state_should="$(cat "$__object/parameter/state")"
|
||||
if [ "$state_is" != "$state_should" ]; then
|
||||
case "$state_should" in
|
||||
installed)
|
||||
present)
|
||||
cat << DONE
|
||||
su - "$user" -c "source \"\\\$HOME/.rvm/scripts/rvm\"
|
||||
rvm use $gemset; gem install $gem"
|
||||
DONE
|
||||
;;
|
||||
removed)
|
||||
absent)
|
||||
cat << DONE
|
||||
su - "$user" -c "source \"\\\$HOME/.rvm/scripts/rvm\"
|
||||
rvm use $gemset; gem uninstall $gem"
|
||||
|
|
|
@ -20,7 +20,7 @@ user::
|
|||
gemset::
|
||||
The gemset to use
|
||||
state::
|
||||
Either "installed" or "removed".
|
||||
Either "present" or "absent".
|
||||
|
||||
OPTIONAL PARAMETERS
|
||||
-------------------
|
||||
|
@ -32,14 +32,14 @@ EXAMPLES
|
|||
|
||||
--------------------------------------------------------------------------------
|
||||
# Install the rails gem in gemset ruby-1.9.3-p0@myset for user bill
|
||||
__rvm_gemset rails --gemset ruby-1.9.3-p0@myset --user bill --state installed
|
||||
__rvm_gemset rails --gemset ruby-1.9.3-p0@myset --user bill --state present
|
||||
|
||||
# Do the same and also make ruby-1.9.3-p0@myset the default gemset
|
||||
__rvm_gemset rails --gemset ruby-1.9.3-p0@myset --user bill \
|
||||
--state installed --default yes
|
||||
--state present --default yes
|
||||
|
||||
# Remove it
|
||||
__rvm_ruby rails --gemset ruby-1.9.3-p0@myset --user bill --state removed
|
||||
__rvm_ruby rails --gemset ruby-1.9.3-p0@myset --user bill --state absent
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
|
|
@ -31,8 +31,8 @@ else
|
|||
echo $default > "$__object/parameter/default"
|
||||
fi
|
||||
|
||||
__rvm "$user" --state installed
|
||||
__rvm "$user" --state present
|
||||
require="__rvm/$user" \
|
||||
__rvm_ruby $ruby --user "$user" --state installed --default $default
|
||||
__rvm_ruby $ruby --user "$user" --state present --default $default
|
||||
require="__rvm_ruby/$ruby" \
|
||||
__rvm_gemset $gemset --user "$user" --state installed --default $default
|
||||
__rvm_gemset $gemset --user "$user" --state present --default $default
|
||||
|
|
|
@ -23,15 +23,15 @@ 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
|
||||
echo "removed"
|
||||
echo "absent"
|
||||
exit 0
|
||||
fi
|
||||
if su - "$user" -c "source \"\$HOME/.rvm/scripts/rvm\"
|
||||
rvm list | grep -q $ruby"; then
|
||||
if su - "$user" -c "source \"\$HOME/.rvm/scripts/rvm\"
|
||||
rvm use $ruby > /dev/null; rvm gemset list | grep -q $gemsetname"; then
|
||||
echo "installed"
|
||||
echo "present"
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
echo "removed"
|
||||
echo "absent"
|
||||
|
|
|
@ -27,7 +27,7 @@ default="$(cat "$__object/parameter/default")"
|
|||
state_should="$(cat "$__object/parameter/state")"
|
||||
if [ "$state_is" != "$state_should" ]; then
|
||||
case "$state_should" in
|
||||
installed)
|
||||
present)
|
||||
cat << DONE
|
||||
su - "$user" -c "source \"\\\$HOME/.rvm/scripts/rvm\"
|
||||
rvm $gemset --create"
|
||||
|
@ -43,7 +43,7 @@ DONE
|
|||
;;
|
||||
esac
|
||||
;;
|
||||
removed)
|
||||
absent)
|
||||
cat << DONE
|
||||
su - "$user" -c "source \"\\\$HOME/.rvm/scripts/rvm\"
|
||||
rvm use $ruby; rvm --force gemset delete $gemsetname"
|
||||
|
|
|
@ -18,7 +18,7 @@ REQUIRED PARAMETERS
|
|||
user::
|
||||
The remote user account to use
|
||||
state::
|
||||
Either "installed" or "removed".
|
||||
Either "present" or "absent".
|
||||
|
||||
OPTIONAL PARAMETERS
|
||||
-------------------
|
||||
|
@ -30,13 +30,13 @@ EXAMPLES
|
|||
|
||||
--------------------------------------------------------------------------------
|
||||
# Install the gemset @myset for user charles on based on ruby-1.9.3-0
|
||||
__rvm_gemset ruby-1.9.3-p0@myset --user charles --state installed
|
||||
__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 installed --default yes
|
||||
__rvm_gemset ruby-1.9.3-p0@myset --user charles --state present --default yes
|
||||
|
||||
# Remove the gemset @myset for user john
|
||||
__rvm_ruby ruby-1.9.3-p0@myset --user john --state removed
|
||||
__rvm_ruby ruby-1.9.3-p0@myset --user john --state absent
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ else
|
|||
echo $default > "$__object/parameter/default"
|
||||
fi
|
||||
|
||||
__rvm "$user" --state installed
|
||||
__rvm "$user" --state present
|
||||
require="__rvm/$user" \
|
||||
__rvm_ruby $ruby --user "$user" --state installed --default $default
|
||||
__rvm_ruby $ruby --user "$user" --state present --default $default
|
||||
|
||||
|
|
|
@ -21,12 +21,12 @@
|
|||
ruby="$__object_id"
|
||||
user="$(cat "$__object/parameter/user")"
|
||||
if su - "$user" -c "[ ! -d \"\$HOME/.rvm\" ]" ; then
|
||||
echo "removed"
|
||||
echo "absent"
|
||||
exit 0
|
||||
fi
|
||||
if su - "$user" -c "source \"\$HOME/.rvm/scripts/rvm\"
|
||||
rvm list | grep -q $ruby"; then
|
||||
echo "installed"
|
||||
echo "present"
|
||||
else
|
||||
echo "removed"
|
||||
echo "absent"
|
||||
fi
|
||||
|
|
|
@ -25,7 +25,7 @@ default="$(cat "$__object/parameter/default")"
|
|||
state_should="$(cat "$__object/parameter/state")"
|
||||
if [ "$state_is" != "$state_should" ]; then
|
||||
case "$state_should" in
|
||||
installed)
|
||||
present)
|
||||
echo "su - \"$user\" -c \"source \\\$HOME/.rvm/scripts/rvm;"\
|
||||
"rvm install $ruby\""
|
||||
case "$default" in
|
||||
|
@ -37,7 +37,7 @@ if [ "$state_is" != "$state_should" ]; then
|
|||
;;
|
||||
esac
|
||||
;;
|
||||
removed)
|
||||
absent)
|
||||
echo "su - \"$user\" -c \"source \\\$HOME/.rvm/scripts/rvm;"\
|
||||
"rvm remove $ruby\""
|
||||
;;
|
||||
|
|
|
@ -18,7 +18,7 @@ REQUIRED PARAMETERS
|
|||
user::
|
||||
The remote user account to use
|
||||
state::
|
||||
Either "installed" or "removed".
|
||||
Either "present" or "absent".
|
||||
|
||||
OPTIONAL PARAMETERS
|
||||
-------------------
|
||||
|
@ -30,13 +30,13 @@ EXAMPLES
|
|||
|
||||
--------------------------------------------------------------------------------
|
||||
# Install ruby 1.9.3 through rvm for user thelonious
|
||||
__rvm_ruby ruby-1.9.3-p0 --user thelonious --state installed
|
||||
__rvm_ruby ruby-1.9.3-p0 --user thelonious --state present
|
||||
|
||||
# Install ruby 1.9.3 through rvm for user ornette and make it the default
|
||||
__rvm_ruby ruby-1.9.3-p0 --user ornette --state installed --default yes
|
||||
__rvm_ruby ruby-1.9.3-p0 --user ornette --state present --default yes
|
||||
|
||||
# Remove ruby 1.9.3 for user john
|
||||
__rvm_ruby ruby-1.9.3-p0 --user john --state removed
|
||||
__rvm_ruby ruby-1.9.3-p0 --user john --state absent
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
|
|
@ -78,6 +78,6 @@ case "$ruby" in
|
|||
;;
|
||||
esac
|
||||
deps=$(eval echo \$$deps_list)
|
||||
for p in $deps; do __package_${type} $p --state installed; done
|
||||
for p in $deps; do __package_${type} $p --state present; done
|
||||
|
||||
__rvm "$user" --state installed
|
||||
__rvm "$user" --state present
|
||||
|
|
Loading…
Reference in a new issue