- Web server
- Builder gem
- A repository
- Client setup
I used nginx but you should be able to tailor this to your needs without too much effort.
Create a directory to contain your local gem repository:
$ sudo mkdir -p /var/www/gems-repo/gemsNote: to get everything working correctly you need to ensure you have that /gems subdirectory off your base directory configured in nginx. You can find more info on this at the RubyGems FAQ.
Add a virtual host config in /etc/nginx/sites-available for your gems repository (I'm going to assume gems.example.com):
$ cat /etc/nginx/sites-available/gems.example.comEnsure you drop a symlink in /etc/nginx/sites-enabled/ for your virtual host and restart nginx.
server {
listen 80;
server_name gems.example.com;
access_log /var/log/nginx/gems.example.com.access.log;
root /var/www/gems-repo;
}
Install the builder gem
$ sudo gem install builder
Build your repositoryJump into the base directory defined above (/var/www/gems-repo). Copy all your own gems into /var/www/gems-repo/gems/. Then generate the relevant resource files for rubygems:
$ sudo gem generate_index -d /var/www/gems-repoYou would re-run this every time you add to or make changes to the repository.
Loading 1 gems from /var/www/gems-repo
.
Loaded all gems
Generating quick index gemspecs for 1 gems
.
Complete
Generating specs index
Generating latest specs index
Generating quick index
Generating latest index
Generating Marshal master index
Generating YAML master index for 1 gems (this may take a while)
.
Complete
Compressing indicies
Client setup
Finally run the following on all local clients that need access to the repository:
$ sudo gem sources -a http://gems.example.com/You can ensure the extra source was added by running 'gem sources'. If you now do a search for you gem that you added above you should see it listed as a target.
5 comments:
Thank you! That helped a lot!
The "builder" gem has nothing to do with generate_index. The generate_index gem command is built in.
err... never mind, generate_index does use the XML builder gem.
how to update our repository ???
@avin: You just drop the new gem(s) in the path listed above (/var/www/gems-repo/gems/), cd to the gems root directory (/var/www/gems-repo) and run 'sudo gem generate_index -d /var/www/gems-repo' as listed.
Post a Comment