From fe143d57b87ad0fce0b59b08dd255ecdde511778 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 5 Dec 2012 23:43:24 +0100 Subject: [PATCH] add new type: __rbenv Signed-off-by: Nico Schottelius --- cdist/conf/type/__rbenv/explorer/homedir | 25 +++++++++++++ cdist/conf/type/__rbenv/man.text | 43 ++++++++++++++++++++++ cdist/conf/type/__rbenv/manifest | 34 +++++++++++++++++ cdist/conf/type/__rbenv/parameter/optional | 1 + 4 files changed, 103 insertions(+) create mode 100755 cdist/conf/type/__rbenv/explorer/homedir create mode 100644 cdist/conf/type/__rbenv/man.text create mode 100644 cdist/conf/type/__rbenv/manifest create mode 100644 cdist/conf/type/__rbenv/parameter/optional diff --git a/cdist/conf/type/__rbenv/explorer/homedir b/cdist/conf/type/__rbenv/explorer/homedir new file mode 100755 index 00000000..8dc25535 --- /dev/null +++ b/cdist/conf/type/__rbenv/explorer/homedir @@ -0,0 +1,25 @@ +#!/bin/sh +# +# 2012 Nico Schottelius (nico-cdist at schottelius.org) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# +# Check whether repository exists +# + +user="$__object_id" +su - "$user" -c "pwd -P" diff --git a/cdist/conf/type/__rbenv/man.text b/cdist/conf/type/__rbenv/man.text new file mode 100644 index 00000000..bee57f76 --- /dev/null +++ b/cdist/conf/type/__rbenv/man.text @@ -0,0 +1,43 @@ +cdist-type__rbenv(7) +==================== +Nico Schottelius + + +NAME +---- +cdist-type__rbenv - Manage rbenv installation + + +DESCRIPTION +----------- +This cdist type allows you to manage rbenv installations. +It also installs ruby-build. + + +OPTIONAL PARAMETERS +------------------- +state:: + Either "present" or "absent", defaults to "present" + + +EXAMPLES +-------- + +-------------------------------------------------------------------------------- +# Install rbenv including ruby-build for nico +__rbenv nico + +# Bastian does not need rbenv anymore, he began to code C99 +__rbenv bastian --state absent +-------------------------------------------------------------------------------- + + +SEE ALSO +-------- +- cdist-type(7) + + +COPYING +------- +Copyright \(C) 2012 Nico Schottelius. Free use of this software is +granted under the terms of the GNU General Public License version 3 (GPLv3). diff --git a/cdist/conf/type/__rbenv/manifest b/cdist/conf/type/__rbenv/manifest new file mode 100644 index 00000000..2e8769a4 --- /dev/null +++ b/cdist/conf/type/__rbenv/manifest @@ -0,0 +1,34 @@ +#!/bin/sh +# +# 2012 Nico Schottelius (nico-cdist at schottelius.org) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# + +homedir="$(cat "$__object/explorer/homedir")" +state_should=present +[ -f "$__object/parameter/state" ] && state_should="$(cat "$__object/parameter/state")" + +rbenvdir="$homedir/.rbenv" +rubybuilddir="$rbenvdir/plugins/ruby-build" + +__git "$rbenvdir" --source git://github.com/sstephenson/rbenv.git \ + --state "$state_should" + +require="__git/$rbendir" __git "$rubybuilddir" \ + --source git://github.com/sstephenson/ruby-build.git \ + --state "$state_should" diff --git a/cdist/conf/type/__rbenv/parameter/optional b/cdist/conf/type/__rbenv/parameter/optional new file mode 100644 index 00000000..ff72b5c7 --- /dev/null +++ b/cdist/conf/type/__rbenv/parameter/optional @@ -0,0 +1 @@ +state