From 5c700184119e0fbc1cade425f8dda5b551683e9a Mon Sep 17 00:00:00 2001 From: Evax Software Date: Fri, 18 May 2012 10:55:28 +0200 Subject: [PATCH] switch the __rvm type to the new present/absent state scheme --- conf/type/__rvm/explorer/state | 4 ++-- conf/type/__rvm/gencode-remote | 4 ++-- conf/type/__rvm/man.text | 6 +++--- conf/type/__rvm_gem/explorer/state | 6 +++--- conf/type/__rvm_gem/gencode-remote | 4 ++-- conf/type/__rvm_gem/man.text | 8 ++++---- conf/type/__rvm_gem/manifest | 6 +++--- conf/type/__rvm_gemset/explorer/state | 6 +++--- conf/type/__rvm_gemset/gencode-remote | 4 ++-- conf/type/__rvm_gemset/man.text | 8 ++++---- conf/type/__rvm_gemset/manifest | 4 ++-- conf/type/__rvm_ruby/explorer/state | 6 +++--- conf/type/__rvm_ruby/gencode-remote | 4 ++-- conf/type/__rvm_ruby/man.text | 8 ++++---- conf/type/__rvm_ruby/manifest | 4 ++-- 15 files changed, 41 insertions(+), 41 deletions(-) diff --git a/conf/type/__rvm/explorer/state b/conf/type/__rvm/explorer/state index 92fa6e07..d0da0d86 100755 --- a/conf/type/__rvm/explorer/state +++ b/conf/type/__rvm/explorer/state @@ -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 diff --git a/conf/type/__rvm/gencode-remote b/conf/type/__rvm/gencode-remote index fe9cc5f8..6c661302 100755 --- a/conf/type/__rvm/gencode-remote +++ b/conf/type/__rvm/gencode-remote @@ -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\" diff --git a/conf/type/__rvm/man.text b/conf/type/__rvm/man.text index d54e2d1b..0a355dc6 100644 --- a/conf/type/__rvm/man.text +++ b/conf/type/__rvm/man.text @@ -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 -------------------------------------------------------------------------------- diff --git a/conf/type/__rvm_gem/explorer/state b/conf/type/__rvm_gem/explorer/state index b0232985..09509a2e 100755 --- a/conf/type/__rvm_gem/explorer/state +++ b/conf/type/__rvm_gem/explorer/state @@ -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" diff --git a/conf/type/__rvm_gem/gencode-remote b/conf/type/__rvm_gem/gencode-remote index 80e1becf..34a69624 100755 --- a/conf/type/__rvm_gem/gencode-remote +++ b/conf/type/__rvm_gem/gencode-remote @@ -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" diff --git a/conf/type/__rvm_gem/man.text b/conf/type/__rvm_gem/man.text index 27b16053..85b52d65 100644 --- a/conf/type/__rvm_gem/man.text +++ b/conf/type/__rvm_gem/man.text @@ -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 -------------------------------------------------------------------------------- diff --git a/conf/type/__rvm_gem/manifest b/conf/type/__rvm_gem/manifest index 245c865d..a551472d 100755 --- a/conf/type/__rvm_gem/manifest +++ b/conf/type/__rvm_gem/manifest @@ -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 diff --git a/conf/type/__rvm_gemset/explorer/state b/conf/type/__rvm_gemset/explorer/state index b33f570e..fbf11830 100755 --- a/conf/type/__rvm_gemset/explorer/state +++ b/conf/type/__rvm_gemset/explorer/state @@ -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" diff --git a/conf/type/__rvm_gemset/gencode-remote b/conf/type/__rvm_gemset/gencode-remote index 0e240462..75cc833a 100755 --- a/conf/type/__rvm_gemset/gencode-remote +++ b/conf/type/__rvm_gemset/gencode-remote @@ -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" diff --git a/conf/type/__rvm_gemset/man.text b/conf/type/__rvm_gemset/man.text index f1e3f2bf..10b6b411 100644 --- a/conf/type/__rvm_gemset/man.text +++ b/conf/type/__rvm_gemset/man.text @@ -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 -------------------------------------------------------------------------------- diff --git a/conf/type/__rvm_gemset/manifest b/conf/type/__rvm_gemset/manifest index 4fdf9cb1..b69395ea 100755 --- a/conf/type/__rvm_gemset/manifest +++ b/conf/type/__rvm_gemset/manifest @@ -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 diff --git a/conf/type/__rvm_ruby/explorer/state b/conf/type/__rvm_ruby/explorer/state index 71d682be..43dafd4f 100755 --- a/conf/type/__rvm_ruby/explorer/state +++ b/conf/type/__rvm_ruby/explorer/state @@ -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 diff --git a/conf/type/__rvm_ruby/gencode-remote b/conf/type/__rvm_ruby/gencode-remote index a3bcf318..b25b4fe9 100755 --- a/conf/type/__rvm_ruby/gencode-remote +++ b/conf/type/__rvm_ruby/gencode-remote @@ -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\"" ;; diff --git a/conf/type/__rvm_ruby/man.text b/conf/type/__rvm_ruby/man.text index c3183a7b..c558cfe3 100644 --- a/conf/type/__rvm_ruby/man.text +++ b/conf/type/__rvm_ruby/man.text @@ -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 -------------------------------------------------------------------------------- diff --git a/conf/type/__rvm_ruby/manifest b/conf/type/__rvm_ruby/manifest index c6e31244..581e98a8 100755 --- a/conf/type/__rvm_ruby/manifest +++ b/conf/type/__rvm_ruby/manifest @@ -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