As the name itself will specify the purpose of it. Bundler gem is used to bundle all of your required ruby gems.
The bundler allows the specification of all dependencies in a separate place from the application itself. You can specify the required version of gems and its entire set of dependencies.
So while deploying your application in a server no need to install the gem from Rubyforge or RubyGems.org etc.
Steps to follow:
1. At the root of your application, run gem install bundler
2. Create a Gemfile in the root of your application
3. Add dependencies to your Gemfile. like gem “rspec”, 1.2.3
4. At the root, run bundle install. It will install all the gems which you specified in Gemfile from the remote system. And it will create a file called Gemfile.lock. The purpose of Gemfile.lock is to get the list of gems installed and its dependencies in your app.
5. And now run bundle package. It will make a copy of your installed gems into your application path vendor/cache. It will more helpful when you are deploying your app in any other server. Cos after running bundle package, your application will look gems into vendor/cache instead of remote systems.
For more details:
- Gem Bundler on Heroku (heroku.com)
- Ruby Tracker, the Ruby Dependency Manager ” Envy Labs (envylabs.com)
- Developing Rubygems with RVM and Bundler (mikeperham.com)
- Fixing Common Bundler Problems (intridea.com)