I would like to exactly know how rubygems-bundler and bundler make
difference in Rails applications.
I am using RVM to manage different Ruby versions and ruby gems.
When I have a look into @global gemset for each ruby version, I can see
four gems have been by default installed. (rvm, rubygems-bundler,
bundler and rake).
I am confused by Rubygems, bundler and rubygems-bundler.
Can anyone kindly walk me through the differences between them?
I would like to exactly know how rubygems-bundler and bundler make
difference in Rails applications.
I am using RVM to manage different Ruby versions and ruby gems.
When I have a look into @global gemset for each ruby version, I can see
four gems have been by default installed. (rvm, rubygems-bundler,
bundler and rake).
I am confused by Rubygems, bundler and rubygems-bundler.
Can anyone kindly walk me through the differences between them?
rubygems is the now standard way of packaging and distributing ruby libraries. bundler is a gem to handle dependency management. It also solves dependency mismatch problems that used to occur.
Say for example that your app uses the foo gem (any version) and the bar gem. The bar gem is only compatible with foo 1.x, but you have foo 1.x and 2.0 installed. If your app loads the foo gem first then the defaut will be the latest version (2.0), but this will then prevent you loading the bar gem, because it can only use foo 1.x and you can’t load 2 versions of the same gem. Of course if your app had loaded foo 1.x instead everything would be fine but before bundler there was no easy way of managing this .
bundler also helps ensure that everyone working on a project is using the same versions of the gems (including your production development, makes it easy to install all an app’s dependencies in one go and makes it very easy to install gems straight from their git repo.
A minor annoyance with bundler is that it means that you might run into problems running (for example) rake: this would load the most recent version of rake, which might clash with the version you have asked bundler to use, or rake might load a gem that clashes with something else in your app. You can use bundle exec rake to load bundler first and ensure that these problems don’t happen, but it gets a bit annoying to have to type that extra preamble everytime. rubygems-bundler aims to make that unnecessary.
You can use `bundle exec rake` to load bundler first and ensure
that
these problems don't happen, but it gets a bit annoying to have to type
that extra preamble everytime. rubygems-bundler aims to make that
unnecessary.
Fred
Thank you so much, Fred, for your explanation.
I got clear on Rubygems and bundler.
But I am not still able to get the handle of rubygems-bundler and
rubygems-update.
I am using RVM and it normally activated Rake 0.9.2.2.
If my current gemset is dependent upon Rake 0.8.7, I still have to type
bundle exec rake ... to use rake 0.8.7 even if I have ruygems-bundler
1.0.0 gem.
It can be thought that rubygems-bundler is not working as expected in
the RVM environment?