add rvm types
This commit is contained in:
parent
202e5b69d8
commit
11be251163
22 changed files with 637 additions and 0 deletions
26
conf/type/__rvm/explorer/state
Executable file
26
conf/type/__rvm/explorer/state
Executable file
|
@ -0,0 +1,26 @@
|
||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# 2012 Evax Software <contact@evax.fr>
|
||||||
|
#
|
||||||
|
# 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 <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
|
||||||
|
user="$__object_id"
|
||||||
|
if su - $user -c "[ -d \"\$HOME/.rvm\" ]" ; then
|
||||||
|
echo "installed"
|
||||||
|
else
|
||||||
|
echo "removed"
|
||||||
|
fi
|
39
conf/type/__rvm/gencode-remote
Executable file
39
conf/type/__rvm/gencode-remote
Executable file
|
@ -0,0 +1,39 @@
|
||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# 2012 Evax Software <contact@evax.fr>
|
||||||
|
#
|
||||||
|
# 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 <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
|
||||||
|
user="$__object_id"
|
||||||
|
state_is="$(cat "$__object/explorer/state")"
|
||||||
|
state_should="$(cat "$__object/parameter/state")"
|
||||||
|
if [ "$state_is" != "$state_should" ]; then
|
||||||
|
case "$state_should" in
|
||||||
|
installed)
|
||||||
|
cat << DONE
|
||||||
|
su - $user -c "bash -s stable < <(curl -s \
|
||||||
|
https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)"
|
||||||
|
DONE
|
||||||
|
;;
|
||||||
|
removed)
|
||||||
|
cat << DONE
|
||||||
|
su - $user -c "rm -Rf \"\\\$HOME/.rvm\";
|
||||||
|
sed -i '/rvm\/scripts\/rvm/d' \"\\\$HOME/.bashrc\""
|
||||||
|
DONE
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
45
conf/type/__rvm/man.text
Normal file
45
conf/type/__rvm/man.text
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
cdist-type__rvm(7)
|
||||||
|
==================
|
||||||
|
Evax Software <contact@evax.fr>
|
||||||
|
|
||||||
|
|
||||||
|
NAME
|
||||||
|
----
|
||||||
|
cdist-type__rvm - Install rvm for a given user
|
||||||
|
|
||||||
|
|
||||||
|
DESCRIPTION
|
||||||
|
-----------
|
||||||
|
RVM is the Ruby enVironment Manager for the Ruby programming language.
|
||||||
|
|
||||||
|
|
||||||
|
REQUIRED PARAMETERS
|
||||||
|
-------------------
|
||||||
|
state::
|
||||||
|
Either "installed" or "removed".
|
||||||
|
|
||||||
|
|
||||||
|
EXAMPLES
|
||||||
|
--------
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
# Install rvm for user billie
|
||||||
|
__rvm billie --state installed
|
||||||
|
|
||||||
|
# Remove rvm
|
||||||
|
__rvm billie --state removed
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
SEE ALSO
|
||||||
|
--------
|
||||||
|
- cdist-type(7)
|
||||||
|
- cdist-type__rvm_ruby(7)
|
||||||
|
- cdist-type__rvm_gemset(7)
|
||||||
|
- cdist-type__rvm_gem(7)
|
||||||
|
|
||||||
|
|
||||||
|
COPYING
|
||||||
|
-------
|
||||||
|
Copyright \(C) 2012 Evax Software. Free use of this software is granted under
|
||||||
|
the terms of the GNU General Public License version 3 (GPLv3).
|
1
conf/type/__rvm/parameter/required
Normal file
1
conf/type/__rvm/parameter/required
Normal file
|
@ -0,0 +1 @@
|
||||||
|
state
|
39
conf/type/__rvm_gem/explorer/state
Executable file
39
conf/type/__rvm_gem/explorer/state
Executable file
|
@ -0,0 +1,39 @@
|
||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# 2012 Evax Software <contact@evax.fr>
|
||||||
|
#
|
||||||
|
# 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 <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
|
||||||
|
gem="$__object_id"
|
||||||
|
gemset="$(cat "$__object/parameter/gemset")"
|
||||||
|
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"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
if su - $user -c "source \"\$HOME/.rvm/scripts/rvm\"
|
||||||
|
rvm list | grep $ruby"; then
|
||||||
|
if su - $user -c "source \"\$HOME/.rvm/scripts/rvm\"
|
||||||
|
rvm use $ruby; rvm gemset list | grep $gemsetname > /dev/null &&
|
||||||
|
rvm use $gemset && gem list | grep $gem"; then
|
||||||
|
echo "installed"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
echo "removed"
|
43
conf/type/__rvm_gem/gencode-remote
Executable file
43
conf/type/__rvm_gem/gencode-remote
Executable file
|
@ -0,0 +1,43 @@
|
||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# 2012 Evax Software <contact@evax.fr>
|
||||||
|
#
|
||||||
|
# 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 <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
|
||||||
|
gem="$__object_id"
|
||||||
|
gemset="$(cat "$__object/parameter/gemset")"
|
||||||
|
ruby="$(echo "$gemset" | cut -d '@' -f 1)"
|
||||||
|
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
|
||||||
|
installed)
|
||||||
|
cat << DONE
|
||||||
|
su - $user -c "source \"\\\$HOME/.rvm/scripts/rvm\"
|
||||||
|
rvm use $gemset; gem install $gem"
|
||||||
|
DONE
|
||||||
|
;;
|
||||||
|
removed)
|
||||||
|
cat << DONE
|
||||||
|
su - $user -c "source \"\\\$HOME/.rvm/scripts/rvm\"
|
||||||
|
rvm use $gemset; gem uninstall $gem"
|
||||||
|
DONE
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
53
conf/type/__rvm_gem/man.text
Normal file
53
conf/type/__rvm_gem/man.text
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
cdist-type__rvm_gemset(7)
|
||||||
|
==========================
|
||||||
|
Evax Software <contact@evax.fr>
|
||||||
|
|
||||||
|
|
||||||
|
NAME
|
||||||
|
----
|
||||||
|
cdist-type__rvm_gem - Manage Ruby gems through rvm
|
||||||
|
|
||||||
|
|
||||||
|
DESCRIPTION
|
||||||
|
-----------
|
||||||
|
RVM is the Ruby enVironment Manager for the Ruby programming language.
|
||||||
|
|
||||||
|
|
||||||
|
REQUIRED PARAMETERS
|
||||||
|
-------------------
|
||||||
|
user::
|
||||||
|
The remote user account to use
|
||||||
|
gemset::
|
||||||
|
The gemset to use
|
||||||
|
state::
|
||||||
|
Either "installed" or "removed".
|
||||||
|
|
||||||
|
OPTIONAL PARAMETERS
|
||||||
|
-------------------
|
||||||
|
default::
|
||||||
|
Make the selected gemset the default
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
# Remove it
|
||||||
|
__rvm_ruby rails --gemset ruby-1.9.3-p0@myset --user bill --state removed
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
SEE ALSO
|
||||||
|
--------
|
||||||
|
- cdist-type(7)
|
||||||
|
- cdist-type__rvm(7)
|
||||||
|
- cdist-type__rvm_ruby(7)
|
||||||
|
- cdist-type__rvm_gemset(7)
|
||||||
|
|
||||||
|
|
||||||
|
COPYING
|
||||||
|
-------
|
||||||
|
Copyright \(C) 2012 Evax Software. Free use of this software is granted under
|
||||||
|
the terms of the GNU General Public License version 3 (GPLv3).
|
38
conf/type/__rvm_gem/manifest
Executable file
38
conf/type/__rvm_gem/manifest
Executable file
|
@ -0,0 +1,38 @@
|
||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# 2012 Evax Software <contact@evax.fr>
|
||||||
|
#
|
||||||
|
# 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 <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
|
||||||
|
gem="$__object_id"
|
||||||
|
gemset="$(cat "$__object/parameter/gemset")"
|
||||||
|
ruby="$(echo "$gemset" | cut -d '@' -f 1)"
|
||||||
|
gemsetname="$(echo "$gemset" | cut -d '@' -f 2)"
|
||||||
|
user="$(cat "$__object/parameter/user")"
|
||||||
|
state="$(cat "$__object/explorer/state")"
|
||||||
|
if [ -f "$__object/parameter/default" ]; then
|
||||||
|
default="$(cat "$__object/parameter/default")"
|
||||||
|
else
|
||||||
|
default="no"
|
||||||
|
echo $default > "$__object/parameter/default"
|
||||||
|
fi
|
||||||
|
|
||||||
|
__rvm $user --state installed
|
||||||
|
require="__rvm/$user" \
|
||||||
|
__rvm_ruby $ruby --user $user --state installed --default $default
|
||||||
|
require="__rvm_ruby/$ruby" \
|
||||||
|
__rvm_gemset $gemset --user $user --state installed --default $default
|
1
conf/type/__rvm_gem/parameter/optional
Normal file
1
conf/type/__rvm_gem/parameter/optional
Normal file
|
@ -0,0 +1 @@
|
||||||
|
default
|
3
conf/type/__rvm_gem/parameter/required
Normal file
3
conf/type/__rvm_gem/parameter/required
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
state
|
||||||
|
gemset
|
||||||
|
user
|
37
conf/type/__rvm_gemset/explorer/state
Executable file
37
conf/type/__rvm_gemset/explorer/state
Executable file
|
@ -0,0 +1,37 @@
|
||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# 2012 Evax Software <contact@evax.fr>
|
||||||
|
#
|
||||||
|
# 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 <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
|
||||||
|
gemset="$__object_id"
|
||||||
|
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"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
if su - $user -c "source \"\$HOME/.rvm/scripts/rvm\"
|
||||||
|
rvm list | grep $ruby"; then
|
||||||
|
if su - $user -c "source \"\$HOME/.rvm/scripts/rvm\"
|
||||||
|
rvm use $ruby; rvm gemset list | grep $gemsetname > /dev/null"; then
|
||||||
|
echo "installed"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
echo "removed"
|
52
conf/type/__rvm_gemset/gencode-remote
Executable file
52
conf/type/__rvm_gemset/gencode-remote
Executable file
|
@ -0,0 +1,52 @@
|
||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# 2012 Evax Software <contact@evax.fr>
|
||||||
|
#
|
||||||
|
# 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 <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
|
||||||
|
gemset="$__object_id"
|
||||||
|
ruby="$(echo "$gemset" | cut -d '@' -f 1)"
|
||||||
|
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
|
||||||
|
installed)
|
||||||
|
cat << DONE
|
||||||
|
su - $user -c "source \"\\\$HOME/.rvm/scripts/rvm\"
|
||||||
|
rvm $gemset --create"
|
||||||
|
DONE
|
||||||
|
case "$default" in
|
||||||
|
no)
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
cat << DONE
|
||||||
|
su - $user -c "source \"\\\$HOME/.rvm/scripts/rvm\"
|
||||||
|
rvm use --default $gemset"
|
||||||
|
DONE
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
removed)
|
||||||
|
cat << DONE
|
||||||
|
su - $user -c "source \"\\\$HOME/.rvm/scripts/rvm\"
|
||||||
|
rvm use $ruby; rvm --force gemset delete $gemsetname"
|
||||||
|
DONE
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
55
conf/type/__rvm_gemset/man.text
Normal file
55
conf/type/__rvm_gemset/man.text
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
cdist-type__rvm_gemset(7)
|
||||||
|
==========================
|
||||||
|
Evax Software <contact@evax.fr>
|
||||||
|
|
||||||
|
|
||||||
|
NAME
|
||||||
|
----
|
||||||
|
cdist-type__rvm_gemset - Manage gemsets through rvm
|
||||||
|
|
||||||
|
|
||||||
|
DESCRIPTION
|
||||||
|
-----------
|
||||||
|
RVM is the Ruby enVironment Manager for the Ruby programming language.
|
||||||
|
|
||||||
|
|
||||||
|
REQUIRED PARAMETERS
|
||||||
|
-------------------
|
||||||
|
user::
|
||||||
|
The remote user account to use
|
||||||
|
ruby::
|
||||||
|
The ruby version to use
|
||||||
|
name::
|
||||||
|
The gemset name (including
|
||||||
|
state::
|
||||||
|
Either "installed" or "removed".
|
||||||
|
|
||||||
|
OPTIONAL PARAMETERS
|
||||||
|
-------------------
|
||||||
|
default::
|
||||||
|
If set to anything but "no" (the default), set the give gemset as default.
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
# Remove the gemset @myset for user john
|
||||||
|
__rvm_ruby ruby-1.9.3-p0@myset --user john --state removed
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
SEE ALSO
|
||||||
|
--------
|
||||||
|
- cdist-type(7)
|
||||||
|
- cdist-type__rvm(7)
|
||||||
|
- cdist-type__rvm_ruby(7)
|
||||||
|
- cdist-type__rvm_gem(7)
|
||||||
|
|
||||||
|
|
||||||
|
COPYING
|
||||||
|
-------
|
||||||
|
Copyright \(C) 2012 Evax Software. Free use of this software is granted under
|
||||||
|
the terms of the GNU General Public License version 3 (GPLv3).
|
35
conf/type/__rvm_gemset/manifest
Executable file
35
conf/type/__rvm_gemset/manifest
Executable file
|
@ -0,0 +1,35 @@
|
||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# 2012 Evax Software <contact@evax.fr>
|
||||||
|
#
|
||||||
|
# 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 <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
|
||||||
|
gemset="$__object_id"
|
||||||
|
ruby="$(echo "$gemset" | cut -d '@' -f 1)"
|
||||||
|
gemsetname="$(echo "$gemset" | cut -d '@' -f 2)"
|
||||||
|
user="$(cat "$__object/parameter/user")"
|
||||||
|
state="$(cat "$__object/explorer/state")"
|
||||||
|
if [ -f "$__object/parameter/default" ]; then
|
||||||
|
default="$(cat "$__object/parameter/default")"
|
||||||
|
else
|
||||||
|
default="no"
|
||||||
|
fi
|
||||||
|
|
||||||
|
__rvm $user --state installed
|
||||||
|
require="__rvm/$user" \
|
||||||
|
__rvm_ruby $ruby --user $user --state installed --default $default
|
||||||
|
|
1
conf/type/__rvm_gemset/parameter/optional
Normal file
1
conf/type/__rvm_gemset/parameter/optional
Normal file
|
@ -0,0 +1 @@
|
||||||
|
default
|
2
conf/type/__rvm_gemset/parameter/required
Normal file
2
conf/type/__rvm_gemset/parameter/required
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
state
|
||||||
|
user
|
32
conf/type/__rvm_ruby/explorer/state
Executable file
32
conf/type/__rvm_ruby/explorer/state
Executable file
|
@ -0,0 +1,32 @@
|
||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# 2012 Evax Software <contact@evax.fr>
|
||||||
|
#
|
||||||
|
# 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 <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
|
||||||
|
ruby="$__object_id"
|
||||||
|
user="$(cat "$__object/parameter/user")"
|
||||||
|
if su - $user -c "[ ! -d \"\$HOME/.rvm\" ]" ; then
|
||||||
|
echo "removed"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
if su - $user -c "source \"\$HOME/.rvm/scripts/rvm\"
|
||||||
|
rvm list | grep $ruby >/dev/null"; then
|
||||||
|
echo "installed"
|
||||||
|
else
|
||||||
|
echo "removed"
|
||||||
|
fi
|
45
conf/type/__rvm_ruby/gencode-remote
Executable file
45
conf/type/__rvm_ruby/gencode-remote
Executable file
|
@ -0,0 +1,45 @@
|
||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# 2012 Evax Software <contact@evax.fr>
|
||||||
|
#
|
||||||
|
# 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 <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
|
||||||
|
ruby="$__object_id"
|
||||||
|
state_is="$(cat "$__object/explorer/state")"
|
||||||
|
user="$(cat "$__object/parameter/user")"
|
||||||
|
default="$(cat "$__object/parameter/default")"
|
||||||
|
state_should="$(cat "$__object/parameter/state")"
|
||||||
|
if [ "$state_is" != "$state_should" ]; then
|
||||||
|
case "$state_should" in
|
||||||
|
installed)
|
||||||
|
echo "su - $user -c \"source \\\$HOME/.rvm/scripts/rvm;"\
|
||||||
|
"rvm install $ruby\""
|
||||||
|
case "$default" in
|
||||||
|
no)
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "su - $user -c \"source \\\$HOME/.rvm/scripts/rvm;"\
|
||||||
|
"rvm use --default $ruby\""
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
removed)
|
||||||
|
echo "su - $user -c \"source \\\$HOME/.rvm/scripts/rvm;"\
|
||||||
|
"rvm remove $ruby\""
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
54
conf/type/__rvm_ruby/man.text
Normal file
54
conf/type/__rvm_ruby/man.text
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
cdist-type__rvm_ruby(7)
|
||||||
|
=======================
|
||||||
|
Evax Software <contact@evax.fr>
|
||||||
|
|
||||||
|
|
||||||
|
NAME
|
||||||
|
----
|
||||||
|
cdist-type__rvm_ruby - Manage ruby installations through rvm
|
||||||
|
|
||||||
|
|
||||||
|
DESCRIPTION
|
||||||
|
-----------
|
||||||
|
RVM is the Ruby enVironment Manager for the Ruby programming language.
|
||||||
|
|
||||||
|
|
||||||
|
REQUIRED PARAMETERS
|
||||||
|
-------------------
|
||||||
|
user::
|
||||||
|
The remote user account to use
|
||||||
|
state::
|
||||||
|
Either "installed" or "removed".
|
||||||
|
|
||||||
|
OPTIONAL PARAMETERS
|
||||||
|
-------------------
|
||||||
|
default:
|
||||||
|
If set to anything but "no" (the default), set the given version as default
|
||||||
|
|
||||||
|
EXAMPLES
|
||||||
|
--------
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
# Install ruby 1.9.3 through rvm for user thelonious
|
||||||
|
__rvm_ruby ruby-1.9.3-p0 --user thelonious --state installed
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
# Remove ruby 1.9.3 for user john
|
||||||
|
__rvm_ruby ruby-1.9.3-p0 --user john --state removed
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
SEE ALSO
|
||||||
|
--------
|
||||||
|
- cdist-type(7)
|
||||||
|
- cdist-type__rvm(7)
|
||||||
|
- cdist-type__rvm_gemset(7)
|
||||||
|
- cdist-type__rvm_gem(7)
|
||||||
|
|
||||||
|
|
||||||
|
COPYING
|
||||||
|
-------
|
||||||
|
Copyright \(C) 2012 Evax Software. Free use of this software is granted under
|
||||||
|
the terms of the GNU General Public License version 3 (GPLv3).
|
33
conf/type/__rvm_ruby/manifest
Executable file
33
conf/type/__rvm_ruby/manifest
Executable file
|
@ -0,0 +1,33 @@
|
||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# 2012 Evax Software <contact@evax.fr>
|
||||||
|
#
|
||||||
|
# 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 <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
|
||||||
|
if [ -f "$__object/parameter/default" ]; then
|
||||||
|
default="$(cat "$__object/parameter/default")"
|
||||||
|
else
|
||||||
|
default="no"
|
||||||
|
echo "$default" > "$__object/parameter/default"
|
||||||
|
fi
|
||||||
|
|
||||||
|
ruby="$__object_id"
|
||||||
|
user="$(cat "$__object/parameter/user")"
|
||||||
|
state="$(cat "$__object/explorer/state")"
|
||||||
|
|
||||||
|
__rvm "$user" --state installed
|
||||||
|
|
1
conf/type/__rvm_ruby/parameter/optional
Normal file
1
conf/type/__rvm_ruby/parameter/optional
Normal file
|
@ -0,0 +1 @@
|
||||||
|
default
|
2
conf/type/__rvm_ruby/parameter/required
Normal file
2
conf/type/__rvm_ruby/parameter/required
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
state
|
||||||
|
user
|
Loading…
Reference in a new issue