Allow vendoring of gems
eileencodes opened this issue · comments
Bundler supports vendoring gems into a specified directory. Some apps rely on this feature so they don't need to download from RubyGems if the gem is already present.
Once vendoring is implemented we'll want to have a way to clean the gems that are no longer used. To make that work for apps that dual-boot in multiple Rails version we'll need a way to set a list of gems to not clean.
It looks like you can specify a directory to install gems into with an environment variable today:
$ ls 08:15:40
Gemfile Gemfile.lock test.rb
$ env GEL_STORE=./gems gel exec ruby test.rb
Traceback (most recent call last):
2: from test.rb:1:in `<main>'
1: from /usr/local/Cellar/gel/0.3.0/lib/gel/compatibility/rubygems.rb:197:in `require'
/usr/local/Cellar/gel/0.3.0/lib/gel/compatibility/rubygems.rb:197:in `require': cannot load such file -- httparty (LoadError)
$ env GEL_STORE=./gems gel install
Installing multi_xml (0.6.0)
Installing mime-types (3.3.1)
Installing mime-types-data (3.2019.1009)
Installing httparty (0.18.0)
Installed 4 gems
$ env GEL_STORE=./gems ../gel/exe/gel exec ruby test.rb
hi
$ ls
Gemfile Gemfile.lock gems test.rb
Gel still doesn't support installing into a specific directory, because of the custom database it needs to track which files are available. But it does now support reading locally-bundled .gem
files from vendor/cache/*.gem
in place of server-supplied equivalents, which seems like a fair compromise: the local Gel instance is still able to maintain book-keeping of installed files, while the managed app directory is able to pre-package dependencies to avoid a live server requirement.