I was reading the book Rails Way. And it discusses running "bundle package". This will store all the .gem files your app uses in vendor/cache. Running bundle install will prefer gems in vendor/cache to gems in other locations. I am using rvm, so I tested this with rvm:
rvm gemset create rent_prototype
rvm use 2.2.1@rent_prototype
gem install rails
rvm gemdir
/home/viggy/.rvm/gems/ruby-2.2.1@rentme_prototype
$ cd /home/viggy/.rvm/gems/ruby-2.2.1@rentme_prototype
$ ls -l devise-4.1.1
ls: cannot access devise-4.1.1: No such file or directory
Above I created a gemset with rvm and checked if the devise gem was installed, and it was not since it is not in Gemfile. Now I use bundle package:
$ cd -
$ bundle package
Updating files in vendor/cache
* rake-11.1.2.gem
* i18n-0.7.0.gem
* json-1.8.3.gem
...
$ cd vendor/cache
$ ls -l devise-4.1.1
ls: cannot access devise-4.1.1: No such file or directory
Of course, no devise gem in vendor/cache either.
Then I modify Gemfile and add:
gem 'devise'
Then I run bundle install.
Now I check where devise was installed:
$ bundle show devise
/home/viggy/.rvm/gems/ruby-2.2.1@rentme_prototype/gems/devise-4.1.1
$ cd vendor/cache
$ ls -l devise-4.1.1
ls: cannot access devise-4.1.1: No such file or directory
So when I install a gem, it installs in the rvm folder. It does not prefer vendor/cache to other locations. If that is the case, what is the purpose of "bundle package" when you are using rvm?