summaryrefslogtreecommitdiff
path: root/puppet/modules/bundler/manifests/install.pp
diff options
context:
space:
mode:
authorMicah <micah@leap.se>2016-07-12 16:46:00 -0400
committerMicah <micah@leap.se>2016-07-12 16:46:00 -0400
commitb5c3c14ae094bff896d19ee37f967e8fc8c34017 (patch)
treee354f84795e66cb6acae4cb0b0e122d3e498424f /puppet/modules/bundler/manifests/install.pp
parent4aff06cc2fecc0b59728d7fc825fb36394b847b7 (diff)
git subrepo clone https://leap.se/git/puppet_bundler puppet/modules/bundler
subrepo: subdir: "puppet/modules/bundler" merged: "bacec3e" upstream: origin: "https://leap.se/git/puppet_bundler" branch: "master" commit: "bacec3e" git-subrepo: version: "0.3.0" origin: "https://github.com/ingydotnet/git-subrepo" commit: "1e79595" Change-Id: I7596e2c4abf326acbce2a01c363e9694626e230f
Diffstat (limited to 'puppet/modules/bundler/manifests/install.pp')
-rw-r--r--puppet/modules/bundler/manifests/install.pp64
1 files changed, 64 insertions, 0 deletions
diff --git a/puppet/modules/bundler/manifests/install.pp b/puppet/modules/bundler/manifests/install.pp
new file mode 100644
index 00000000..1524de31
--- /dev/null
+++ b/puppet/modules/bundler/manifests/install.pp
@@ -0,0 +1,64 @@
+# Class bundler::install
+#
+# Installs bundler Ruby gem manager
+#
+# == Parameters
+#
+# [*install_method*]
+# How to install bundler, 'rvm' is the default
+# [*ruby_version*]
+# Ruby version that bundler will use.
+#
+# == Examples
+#
+#
+# == Requires:
+#
+# If use_rvm = 'true':
+# include rvm
+#
+class bundler::install (
+ $ruby_version = undef,
+ $ensure = 'present',
+ $install_method = 'rvm',
+ $use_rvm = '',
+ ) inherits bundler::params {
+
+ # deprecation warning
+ if $use_rvm != '' {
+ warning('$use_rvm is deprecated, please use $install_method instead')
+ }
+
+ if ( $install_method == undef ) or ( $install_method == 'package' ) {
+ $provider_method = undef
+ }
+ else {
+ # backwards compatibility
+ if $use_rvm == false {
+ $provider_method = gem
+ }
+ else {
+ $provider_method = $bundler::params::install_method
+ }
+ }
+
+ if $provider_method == 'rvm' {
+ if $ruby_version == undef {
+ fail('When using rvm, you must pass a ruby_version')
+ }
+ else {
+ #Install bundler with correct RVM
+ rvm_gem { 'bundler':
+ ensure => $ensure,
+ ruby_version => $ruby_version,
+ }
+ }
+ }
+ else {
+ package { 'bundler':
+ ensure => $ensure,
+ provider => $provider_method,
+ }
+ }
+
+}