diff --git a/README.md b/README.md index 505d9dd8..7aeac5fd 100644 --- a/README.md +++ b/README.md @@ -66,6 +66,10 @@ Vagrant mounts that very directory as _/vagrant_ within the virtual machine: vagrant@rails-dev-box:~$ ls /vagrant puppet rails README.md Vagrantfile +Rails development box provided [rbenv](https://github.com/sstephenson/rbenv) and [ruby-build](https://github.com/sstephenson/ruby-build). If you need to develop with specified version of ruby: + + vagrant@rails-dev-box:~$ rbenv install 1.9.3-p327 + so we are ready to go to edit in the host, and test in the virtual machine. This workflow is convenient because in the host computer one normally has his editor of choice fine-tuned, Git configured, and SSH keys in place. diff --git a/puppet/manifests/default.pp b/puppet/manifests/default.pp index 27f0c8c5..6c59be0d 100644 --- a/puppet/manifests/default.pp +++ b/puppet/manifests/default.pp @@ -125,3 +125,5 @@ class { 'install_execjs_runtime': } class { 'memcached': } + +class { 'rbenv': } diff --git a/puppet/modules/rbenv/files/.bash_profile b/puppet/modules/rbenv/files/.bash_profile new file mode 100644 index 00000000..c4823189 --- /dev/null +++ b/puppet/modules/rbenv/files/.bash_profile @@ -0,0 +1,2 @@ +export PATH="$HOME/.rbenv/bin:$PATH" +eval "$(rbenv init -)" diff --git a/puppet/modules/rbenv/manifests/init.pp b/puppet/modules/rbenv/manifests/init.pp new file mode 100644 index 00000000..dc041448 --- /dev/null +++ b/puppet/modules/rbenv/manifests/init.pp @@ -0,0 +1,37 @@ +class rbenv { + file { "/home/vagrant/.bash_profile": + source => "puppet:///modules/rbenv/.bash_profile", + ensure => present; + } + + package { + [ + 'bison', + 'autoconf', + 'git' + ] : + ensure => installed; + } + + exec { "ruby-build": + path => "/usr/bin", + command => "git clone git://github.com/sstephenson/ruby-build.git /home/vagrant/.rbenv/plugins/ruby-build", + user => "vagrant", + unless => "test -d /home/vagrant/.rbenv/plugins/ruby-build", + require => Exec["rbenv"]; + } + + exec { "rbenv": + path => "/usr/bin", + command => "git clone git://github.com/sstephenson/rbenv.git /home/vagrant/.rbenv", + user => "vagrant", + unless => "test -d /home/vagrant/.rbenv", + require => [ + Package[ + 'bison', + 'autoconf', + 'git' + ], + ]; + } +}