Puppet Class: rubyenv

Defined in:
manifests/init.pp

Overview

Configure Ruby environment for system

Parameters:

  • versions (Any) (defaults to: ['2.3.0', '2.2.4', '2.0.0-p648', '1.9.3-p551'])
  • default (Any) (defaults to: '2.3.0')


2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'manifests/init.pp', line 2

class rubyenv(
  $versions = ['2.3.0', '2.2.4', '2.0.0-p648', '1.9.3-p551'],
  $default = '2.3.0',
) {
  $gems = hiera_array('rubyenv::gems', [])

  include ruby

  ruby::version { $versions: }

  class { 'ruby::global':
    version => $default
  }

  ruby_gem { 'bundler for all rubies':
    gem          => 'bundler',
    ruby_version => '*'
  }

  $gems.each |$gem| {
    ruby_gem { "${gem} for all rubies":
      gem          => $gem,
      ruby_version => '*'
    }
  }

  Ruby_gem <| |> ~>
  file { "/Users/${::user}/.rbenv":
    ensure => 'absent',
    force  => true
  }

  file { ['/usr/local/bin/bundler', '/usr/local/bin/bundle']:
    ensure  => absent,
    require => Ruby_gem['bundler for all rubies']
  }
}