From 13fc5aa8f5b1a3a92b59fe00c6e7d53bd6158c8f Mon Sep 17 00:00:00 2001
From: Nico Schottelius <nico@brief.schottelius.org>
Date: Fri, 2 Nov 2012 17:15:16 +0100
Subject: [PATCH] use shortcut version to exit if nothing is to be done

Signed-off-by: Nico Schottelius <nico@brief.schottelius.org>
---
 cdist/conf/type/__rvm_gem/gencode-remote | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/cdist/conf/type/__rvm_gem/gencode-remote b/cdist/conf/type/__rvm_gem/gencode-remote
index 34a69624..0b855fc0 100755
--- a/cdist/conf/type/__rvm_gem/gencode-remote
+++ b/cdist/conf/type/__rvm_gem/gencode-remote
@@ -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,19 +26,20 @@ gemsetname="$(echo "$gemset" | cut -d '@' -f 2)"
 state_is="$(cat "$__object/explorer/state")"
 user="$(cat "$__object/parameter/user")"
 state_should="$(cat "$__object/parameter/state")"
-if [ "$state_is" != "$state_should" ]; then
-   case "$state_should" in
-      present)
-         cat << DONE
+
+[ "$state_is" = "$state_should" ] && exit 0
+
+case "$state_should" in
+    present)
+        cat << DONE
 su - "$user" -c "source \"\\\$HOME/.rvm/scripts/rvm\"
 rvm use $gemset; gem install $gem"
 DONE
-      ;;
-      absent)
-          cat << DONE
+    ;;
+    absent)
+        cat << DONE
 su - "$user" -c "source \"\\\$HOME/.rvm/scripts/rvm\"
 rvm use $gemset; gem uninstall $gem"
 DONE
-      ;;
-   esac
-fi
+    ;;
+esac