Rvm and chef ruby

Hey guys, i have been wondering if we should not be using rvm or any other
versions of ruby with chef. I have rvm installed in my chef devel
workstation (ubuntu 12.04). I have repos/workspace where i create custom
mulitple cookbooks (some uses the community cookbooks) specific to
projects. Each workspace have the ‘.ruby-version’ and ‘.ruby-gemset’ files.

Based on the chef doc to install chefDK
https://docs.chef.io/install_dk.html, it says to use the chef ruby as the
system ruby by using this command.

echo ‘eval “$(chef shell-init bash)”’ >> ~/.bash_profile

The above command doesn’t like to be in the ~/.bash_profile so, i
placed it in ~/.bashrc file and works.

Now, i had a similar issue after installing the rvm (system-wide).
Ubuntu wont source the /etc/profile.d/rvm.sh
http://askubuntu.com/questions/40287/etc-profile-not-being-sourced.
So, i had to place the

below entry in the ~/.bashrc file again. So the new entries in the
~/.bashrc files are:

####Added by me
[[ -s “/etc/profile.d/rvm.sh” ]] && . “/etc/profile.d/rvm.sh” # Load
RVM function
####added by me
eval “$(chef shell-init bash)” #loads chefdk ruby

With these entries now, whenever a new shell is started i am greeted
by the below warning:

Warning! PATH is not properly set up,
’/home/user/.chefdk/gem/ruby/2.1.0/bin’ is not at first place,
usually this is caused by shell initialization files - check
them for ‘PATH=…’ entries,
it might also help to re-add RVM to your dotfiles: ‘rvm get
stable --auto-dotfiles’,
to fix temporarily in this shell session run: ‘rvm use 2.1.0’.

I’ve been experimenting with having rvm take priority over chef-dk (init chef-dk and then init RVM) and then use ‘system’ in a project .ruby-version so that if i ‘cd’ into certain directories i’ll get chef-dk instead of rvm ruby.

There’s also ‘rvm mount’ to load the chef-dk ruby into rvm, but i ran into issues making that auto switch based on .ruby-version or .rvmrc (i think?)

Using chefDK 0.9.0’s ruby - it ties down to ruby 2.1.0 only. So it doesn;t give an env to work with a different workspace which use another version of ruby without the rvm installed