Is it possible to pack only selected gems into vendor/cache?

439 views
Skip to first unread message

szimek

unread,
May 12, 2010, 4:37:20 PM5/12/10
to ruby-bundler
Hey,

is it possible to put only selected gems into vendor/cache?

I'm developing a Rails app and currently I'm using Rails 2.3.5, but
I'd really like to use some of the stuff in 2-3-stable branch and I
don't want to wait for the 2.3.6 release, especially that there's no
official release date. I can't use :git with :branch options to fetch
Rails gem from github repository, because in 2-3-stable branch "rails"
is not a gem and Bundler complains that it can't find it. So I thought
that I could simply build all Rails gems myself and put them into
vendor/cache dir. Unfortunately, after running "bundle install",
Bundler puts all gems specified in the Gemfile there and I don't
really want to add additional 10MB into the repository now and
actually probably much more later, because I'll have to add new
versions of all gems there till the official Rails 2.3.6 release.

Cheers,
Szymon

--
You received this message because you are subscribed to the Google Groups "ruby-bundler" group.
To post to this group, send email to ruby-b...@googlegroups.com.
To unsubscribe from this group, send email to ruby-bundler...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/ruby-bundler?hl=en.

Andre Arko

unread,
May 12, 2010, 4:40:06 PM5/12/10
to ruby-b...@googlegroups.com
On May 12, 2010, at 1:37 PM, szimek wrote:

> is it possible to put only selected gems into vendor/cache?

Sure. Get the gems you want with `gem fetch <gemname>` and then put all the .gem files into the vendor/cache directory. You're done.

– Andre

szimek

unread,
May 12, 2010, 4:47:08 PM5/12/10
to ruby-bundler
Thanks for really quick response :)

I've built rails-2.3.6.beta.0.gem and its dependencies
(actionmailer-2.3.6.beta.0.gem etc.) and put them into vendor/cache. I
changed Gemfile to use the new rails gem: gem "rails", "2.3.6.beta.
0", :require => nil. However, when I run "bundle install --relock",
after checking all gems it says "Copying .gem files into vendor/cache"
and copies *all* gems specified in my Gemfile there - is there a way
to prevent it?

Andre Arko

unread,
May 12, 2010, 4:54:59 PM5/12/10
to ruby-b...@googlegroups.com
On May 12, 2010, at 1:47 PM, szimek wrote:

> However, when I run "bundle install --relock", after checking all gems it says "Copying .gem files into vendor/cache" and copies *all* gems specified in my Gemfile there - is there a way to prevent it?

If all you want to do is re-lock, I suggested running `bundle unlock && bundle lock`. It seems valid to be able to install without updating the cache, though, so I just added it as an option named --no-cache: http://github.com/carlhuda/bundler/commit/e4287d26ad52b4db5c6379432dd201bf1a0eb311. It will be part of the 0.9.26 release, whenever that happens.

szimek

unread,
May 12, 2010, 4:59:30 PM5/12/10
to ruby-bundler
Thanks! --no-cache will actually be necessary for me as I need to make
it work with capistrano, which currently simply runs "bundle install"
after deploying everything.

François Beausoleil

unread,
May 19, 2010, 1:19:53 AM5/19/10
to ruby-bundler
I just did something similar with our application. We have a patched
2.3.5. It's still in vendor/rails, but I'll move it to our Git
repository soon, and the way I will do it is to add a commit with the
gem specifications:

gem spec -v 2.3.5 --ruby actionmailer > vendor/rails/actionmailer/
actionmailer.gemspec
...
gem spec -v 2.3.5 --ruby rails > vendor/rails/railties/rails.gemspec

You can take a look at our Gemfile here: http://gist.github.com/405976

Hope that helps!
François
Reply all
Reply to author
Forward
0 new messages