Reputation: 6149
I'm using rvm with different gemsets and loving it. Only problem I've run into is that as I create new gemsets and pick the gems I want, it seems to take awhile to re-download the gems again. Is there a way to let rvm know to use the gems that are already installed in another gemset?
For example, say I have a gemset named set1 with the wirble gem installed. Now I create a new rvm called set2. If I "gem install wirble" on set2 it appears to download wirble all over again. Any way to make rvm use the version that's already in set1?
Edit 1: Thanks everyone or the replies so far. Just to explain more clearly, what I find odd is when I want to install wirble and the SAME EXACT version is already on my computer, why does "gem install wrible" need to go online and download the same exact thing again? Why not just install from my computer locally (ie. in another gemset that has the exact files I need)
Edit 2: AND I am staying in the same version of ruby. So my example is assuming i'm using ruby 1.9.2. I am ONLY changing the gemset. I don't see why doing a "gem install wirble" needs to download it again just for a different gemset (again, on the same ruby 1.9.2)
Upvotes: 1
Views: 480
Reputation: 1785
One RVM function that doesn't seem to have been mentioned is copy
. This is particularly useful when:
you want to make a new gemset B comprised of the majority of gems already in your gemset A
Perhaps you want to isolate one gem in particular and compare two versions. Or something.
You can do the following, within whichever ruby version context is appropriate:
rvm gemset copy 1.9.4-p448@old_gemset_name 1.9.3-p448@new_gemset_name
This command will make a new gemset which is an exact clone of the old one, and then you can remove and reinstall the gem in question. I did this with Rspec, removing 2.14.1 to compare with 3.0.0beta, like so:
gem uninstall rspec -v2.14
gem install rspec -v3.0.0.beta1
There were some other uninstalls that went along with that, but you get the idea. The result is I can run two separate test suites, each in their respective directories and using a different Rspec, just by switching gemsets. <3 RVM.
EDIT: got the idea from here.
Upvotes: 0
Reputation: 20877
Googling "gem install from local cache" turned up this:
http://akitaonrails.com/2011/05/29/rubygems-local-cache-hack
It's basically a caching gem proxy that uses the public gem server as upstream.
A lighter-weight solution:
This one lets you selectively install gems (including their deps):
If you actually want to copy a gemset run these steps while in the gem path cache. Actually this isn't needed as "rvm gemset copy" doesn't download unless necessary.
Upvotes: 0
Reputation: 81530
If you're worried about clogging the series of tubes, you may want to see if it's possible to set up a gem server on your own machine using gem server
and tell rvm to use that.
Upvotes: 0
Reputation: 8535
That's by design. Keeping them separate is the whole point. (So that using one set doesn't affect the other, etc.)
Perhaps you're using multiple gemsets when you don't need to? For example, instead of using a separate gemset for each rails app, just use one. For example, I use ruby-1.9.2-p0@rails3
for all my rails 3 development.
Or I suppose you can always just manually copy them from one rvm directory to another (~/.rvm/gems/ruby-1.9.2-p0@rails3/gems/
on my system). Of course, this will only work for gems that are being compiled against the same ruby version.
Upvotes: 0
Reputation: 51707
Another option is to use Bundler instead of RVM gem sets. This won't download the gems if they are already on your system, and lets you have a unique set for each application.
Upvotes: 1