How to clone http://rubygems.org/ gems and use that mirror inside an intranet without internet connection.


In a pc with internet connection, install rubygems-mirror,

gem install rubygems-mirror

Create a file ~/.gem/.mirrorrc in your home folder and paste the following snippet

- from: http://gems.rubyforge.org
  to: /home/sexy/gems.mirror
  parallelism: 10
  skiperror: true

gems.mirror is the name of the directory we want to store all gems, it could be anything.

Then execute the following

gem mirror

This will mirror the gems using the information in /home/sexy/.gem/.mirrorrc

Move all files in your intranet and then update gem mirrors in the intranet pcs

gem source -r http://rubygems.org  
gem source -a http://localhost/path/to/mirror

The former command removes original source while the latter adds the local source via a local web server



[1] rubygems.org

[2] rubygems-mirror