fgrehm / vagrant-cachier

Caffeine reducer
http://fgrehm.viewdocs.io/vagrant-cachier
MIT License
1.07k stars 111 forks source link

rvm cache is pessimistic #43

Closed xtoddx closed 10 years ago

xtoddx commented 11 years ago

Expected

setting config.cache.enable :rvm would cache rvm files in conjunction with the fnichol/chef-rvm cookbook

Actual

rvm caching requires rvm to be installed already before activating the cache

Workaround

mkdir -p ~/.vagrant.d/cache/BOXNAME/rvm/rvm

Vagrantfile excerpt:

config.vm.provision :chef_solo do |chef|
  chef.add_recipe 'rvm::vagrant'
  chef.json = {rvm: {rvmrc: {rvm_archives_path: '/tmp/vagrant-cache/rvm/rvm'}}}
end

Commentary

I think specifying this in my cookbook defeats the purpose of having an rvm bucket. If it cant' work on first-run, then it isn't generally useful. At the minimum, I would expect to see better documentation around this issue, the brief mention in the README is unlcear as to why rvm should already be installed and how to work around that during provisioning.

fgrehm commented 11 years ago

ping @cromulus

fgrehm commented 11 years ago

@xtoddx as of this writing, in order to fully benefit from both the rubygems bucket and the rvm bucket you'll need to split your provisioning scripts into multiple steps so that this plugin can do its job like:

config.vm.provision :chef_solo do |chef|
  chef.add_recipe 'rvm::install_rvm'
end

config.vm.provision :chef_solo do |chef|
  chef.add_recipe 'rvm::install_ruby'
end

config.vm.provision :chef_solo do |chef|
  chef.add_recipe 'rvm::bundle_install'
end

TBH I can't think of a way of doing everything in one go, if you are please let us know :) I'll try to write a note on the readme about this when I have a chance