Created
September 13, 2014 00:11
-
-
Save mapyo/fb2ef4ba97394c6b01d7 to your computer and use it in GitHub Desktop.
rbenvをシステムワイドにインストールするpuppet書いた
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class dev::rbenv { | |
file { ['/usr/local/rbenv', | |
'/usr/local/rbenv/plugins', | |
'/usr/local/rbenv/shims', | |
'/usr/local/rbenv/versions']: | |
ensure => directory, | |
owner => 'vagrant', | |
group => 'vagrant', | |
mode => '0775', | |
} | |
exec { 'clone rbenv': | |
user => 'vagrant', | |
path => ['/usr/bin'], | |
command => 'git clone git://github.com/sstephenson/rbenv.git /usr/local/rbenv', | |
unless => 'test -d /usr/local/rbenv', | |
require => File['/usr/local/rbenv'] | |
} | |
file { 'rbenv/profile.d/rbenv.sh': | |
path => '/etc/profile.d/rbenv.sh', | |
content => '## rbenv setting | |
export RBENV_ROOT="/usr/local/rbenv" | |
export PATH="/usr/local/rbenv/bin:$PATH" | |
eval "$(rbenv init -)" | |
', | |
require => Exec['clone rbenv'] | |
} | |
exec { 'clone ruby-build': | |
user => 'vagrant', | |
path => ['/usr/bin'], | |
command => 'git clone git://github.com/sstephenson/ruby-build.git /usr/local/rbenv/plugins/ruby-build', | |
unless => 'test -d /usr/local/rbenv/plugins/ruby-build', | |
require => File['/usr/local/rbenv/plugins'] | |
} | |
exec { 'clone rbenv-default-gems': | |
user => 'vagrant', | |
path => ['/usr/bin'], | |
command => 'git clone git://github.com/sstephenson/rbenv-default-gems.git /usr/local/rbenv/plugins/rbenv-default-gems', | |
unless => 'test -d /usr/local/rbenv/plugins/rbenv-default-gems', | |
require => File['/usr/local/rbenv/plugins'] | |
} | |
file { '/usr/local/rbenv/default-gems': | |
content => 'bundler | |
rbenv-rehash | |
', | |
require => Exec['clone rbenv-default-gems'] | |
} | |
exec { 'install ruby 2.1.2': | |
user => 'vagrant', | |
path => ['/bin', '/usr/bin', '/usr/local/rbenv/bin', '/usr/local/rbenv/plugins/ruby-build/bin/'], | |
command => 'rbenv install 2.1.2', | |
environment => ['RBENV_ROOT=/usr/local/rbenv'], | |
creates => '/usr/local/rbenv/versions/2.1.2', | |
timeout => 1800, | |
require => Exec['clone rbenv-default-gems'] | |
} | |
exec { 'rbenv global 2.1.2.': | |
user => 'vagrant', | |
path => ['/bin', '/usr/bin', '/usr/local/rbenv/bin', '/usr/local/rbenv/plugins/ruby-build/bin/'], | |
command => 'rbenv global 2.1.2', | |
environment => ['RBENV_ROOT=/usr/local/rbenv'], | |
unless => 'cat /usr/local/rbenv/version | grep 2.1.2', | |
require => Exec['install ruby 2.1.2'] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment