Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I would like to download a gem without installing all the required gems for a given gem.

Specifically for the Rails 3 gem. It has a lot of dependencies, and I need to install it on a closed server which currently has no ruby/rake/rails software.

Any clues would be great as clicking through rubygems.org is tedious.

okay, let me clarify this a bit. What I would like is for this to work:

gem install rails --download-only

which would solve my problems as then I could burn the resulting gem's onto a disc and move them over to my server which doesn't have Internet access.

share|improve this question
    
Not sure that this is possible. That is why they are called dependencies. They depend on other things that you have to have to work. –  soandos Aug 19 '11 at 18:45
add comment

4 Answers

up vote 5 down vote accepted

To download a single gem use (using loudmouth gem as an example):

gem fetch loudmouth
Fetching: loudmouth-0.2.4.gem (100%)
Downloaded loudmouth-0.2.4

to download all gems that your Rails 3 app depends on run:

bundle package

This will download all gems (and their dependencies) and place them into vendor/cache (without installing them).

You can then burn all the gems in vendor/cache to a CD and physically bring it to the other server without net access.

share|improve this answer
    
A bit too late to use, but this is the answer I was looking for. Thanks for posting it. –  Daniel Oct 25 '12 at 1:17
add comment

Well, I hate to answer my own question but I think this is the most likely to be the solution for my question.

- find network enabled machine
- install rails and all needed gems using RubyGems.
- tar/zip /usr/lib[64]/ruby/gem/1.9.1/cache/*.gem
- transport tar file to non-networked computer.

The location of those gem cached files is very useful. If I had numerous gem's on my networked machine and didn't want to transport all the gems I would have used

> bundle list

to show the application specific gems needed.

-daniel

share|improve this answer
add comment

I would create a local RubyGems server with all the gems required for the application, including Rails and its dependencies.

Basic documentation here:

This blog post shows how to set up an internal server that you can send Gems to for automatic indexing:

share|improve this answer
add comment

Unfortunately you cannot get around the dependency issue. They are needed for a reason; Trying to install Rails without needed dependencies is going to result in a lot of issues, if Rails even runs at all.

You didn't specify exactly what you meant by closed. If you mean closed as in you cannot install systemwide software, have a look at RVM, which is software that will allow you to create a self-contained Ruby environment. You might also be able to get away with setting this up on another server and moving it over if the server has no connection to the internet. Have a look at it and see if this helps you out.

share|improve this answer
    
If I can't manually download the gem's then I'll probably have to use this method: I'll use a linux VM and create a rails complete install package. –  Daniel Aug 19 '11 at 20:30
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.