What is the simplest way to download a gem without installing rubygems?

Solution 1:

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.

Solution 2:

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

Solution 3:

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

Basic documentation here:

  • http://docs.rubygems.org/read/chapter/18

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

  • http://dagi3d.net/posts/4-simple-private-gem-server-with-a-rack-middleware