Forum: Ruby on Rails rubygems, rubygems-bundler and bundler

E341f0a8f77a06a0842b68b41c8b6398?d=identicon&s=25 Christopher Frost (christophrost)
on 2013-03-17 18:59
Hello,

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?

Thanks in advance.
Christopher
81b61875e41eaa58887543635d556fca?d=identicon&s=25 Frederick Cheung (Guest)
on 2013-03-17 19:57
(Received via mailing list)
On Sunday, March 17, 2013 5:59:34 PM UTC, Ruby-Forum.com User wrote:
> 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.

Fred
E341f0a8f77a06a0842b68b41c8b6398?d=identicon&s=25 Christopher Frost (christophrost)
on 2013-03-18 03:39
> 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?

Regards,
Christopher
81b61875e41eaa58887543635d556fca?d=identicon&s=25 Frederick Cheung (Guest)
on 2013-03-18 11:15
(Received via mailing list)
On Monday, March 18, 2013 2:39:45 AM UTC, Ruby-Forum.com User wrote:
>
> 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.
>

rubygems-update is a way of distributing update to rubygems itself as a
gem.


> 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?
>
> I've not use rubygems-bundler before - not sure what its constraints are.

Fred
3ec52ed58eb92026d86e62c39bdb7589?d=identicon&s=25 Michal Papis (mpapis)
on 2013-03-19 10:00
(Received via mailing list)
run `gem regenerate_binstubs` - it will refresh all the binaries in
rubygems to use rubygems-bundler, it's usually done by default when you
install gem.
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.