Creating your own RubyGem mirror
In case you want to create your own RubyGem mirror here’s how I did mine.
From now on, let’s pretend we will store the mirrored gems in : /data/rubygems.mirror
First you need to create a config file (YAML format) specifying the source and destination for your mirror (put it in /data/gemmirror.config for example) :
---
- from: http://gems.rubyforge.org
to: /data/rubygems.mirror- from is the master mirror you will pull from
- to is the directory where your mirror files will be stored
Then all you have to do is to add this commands as a cron task :
/usr/bin/gem mirror --config-file=/data/gemmirror.config && /usr/bin/gem generate_index -d /data/rubygems.mirror/usr/bin/gem mirror —config-file=/data/rubygemmirror : will mirror the gems using informations in /data/rubygemmirror file
/usr/bin/gem generate_index -d /data/rubygems.mirror : will generate an optimized index to reduce the datas transfered on index update
Here’s what you asked for Nick !
Fri, 23 May 2008 20:06 Posted in Ruby
4 comments »
-
By Steve 9 days later:
-
By Jonathan Tron 22 days later:
Try rewriting the config file as :
--- from: http://gems.rubyforge.org to: /temp/gems
thus not enclosing the hash ({:from => …, :to => …}) in an array.
-
By Nick 5 months later:
Thanks.
I suppose then I set up a web server to provide that directory, and use that address as the source?
Also, how much space will it take?
Thanks again.
-
By Jonathan Tron 5 months later:
Currently my mirror uses 3.6GB.
Hi there, no matter what I do I get an error as follows:
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/config_file.rb:98:in `initialize’: undefined method `key?’ for [{"from"=>"http://gems.rubyforge.org", “to”=>"/temp/gems"}]:Array (NoMethodError)
It looks like my config file is begin parsed correctly. It looks like this:
Any ideas? I’m at my wits end!