Friday, January 1, 2016

Setup your own local ruby repository

I- Mirror all the gems from https://rubygems.org/:
a- install rubygems-mirror
$ sudo gem install rubygems-mirror

b- create rubygems-mirror configuration file in  ~/.gem/.mirrorrc with the following content

---
- from: http://rubygems.org
  to: ~/.gem/mirror


b- Create mirror directory

$ mkdir ~/.gem/mirror

c- Start mirroring, it might take days

$ gem mirror


II- Start Local repo repository
a- install geminabox and ruby-dev (for building native package)
$ sudo gem install geminabox
$ sudo apt-get install ruby-dev


b- create geminabox configuration file ~/.gem/mirror/config.ru: with the following content

require "rubygems"
require "geminabox"

Geminabox.data = "./"
run Geminabox


c- Start gem server:

$ cd ~/.gem/mirror
$ rackup


II- change gem repository to our newly created
$ gem source --remove http://rubygems.org/
$ gem source --add http://localhost:9292

No comments:

Post a Comment