I want to freeze a specific gem into my Rails application.
In rails 2 there was this command:
rake gems:unpack
I can\'t find that c
Assuming you already have bundler gem installed:
$ bundle lock
$ git add Gemfile.lock
I haven't had to do this yet, but I believe it's all handled by bundler
.
When you create a new rails3 app, the rails dependencies are put into your Gemfile
. You can run bundle install
to install them. By default, they are installed into your BUNDLE_PATH
.
If you want to install them within your app, you can specify where: bundle install vendor/gems
.
I think what you are looking for is
bundle package
checkout the man pages here: http://gembundler.com/man/bundle-package.1.html
DO NOT USE THE "RECOMMENDED" ANSWER BY NFM!
Instead, review the Bundler site, particularly the page on deployments: http://gembundler.com/deploying.html
The short summary is to use specific versions in your Gemfile and run bundle install --deployment
on each target system where you need the exact gem versions.
Using the --path
option will install the gems, but it's not really what you want to do. As Matt Enright said, you just bloat your SCM with stuff that bundler can handle smartly on each target environment.
The command that you want is bundle package
which just unpacks the gems and dependencies at vendor/cache
folder.
But just a notice, the :git => ....
kind of gems wont get packaged. You have to hack a way out for :git => ...
related gems to get packed.
A lot of comments are somewhat saying that it's not useful to use the bundle install --path vendor/gems, but those people who are using Dreamhost, it should note that you cannot use bundle install in Dreamhost.
The solution is to get all the gems into the vendor folder and upload the whole thing to the Dreamhost directory.
There are other solutions to turn around this, but it's much more complicated to do.