I’m trying to set up my own private gem server which should serve my gems and display the rdoc. As I’ve read the default gem server should be able to do that. And since I do not want all gems except my own to be displyed on the gem server I’m doing the following:
gem install -i /some/dir --ignore-dependencies my-special.gem
gem server -d /some/dir # -d should let me set my gem dir
But first of all, the gem server still displays all installed system gems and does not display what’s inside some/dir. And second, when trying to do a:
gem install --source http://localhost:8808 my-special.gem
I only get the following messsage:
ERROR: Could not find a valid gem 'my-special' (>= 0) in any repository
ERROR: While executing gem ... (Gem::RemoteFetcher::FetchError)
bad response Gateway Time-out 504 (http://localhost:8808/latest_specs.4.8.gz)
And I get that even for the gems that get displayed on the created gem server page at
http://localhost:8808
What am I doing wrong? Some blogs mention to update the index with gem generate_index but this makes no sense since this tool expects the *.gem files to be in a /gems subdir but by default they land in /cache.
I solved this pretty easily.
I don’t even use a dedicated gem server.
I did the following:
Create a directory on your apache web server that is servable and create a
gemssubdir in it. For example:mkdir -p /var/www/rubygems/gemsPut all gems you want to serve to the created
gemssubdirectory:cp /my/gems/dir/*.gem /var/www/rubygems/gemsGenerate the gem index:
gem generate_index -d /var/www/rubygemsDo not forget to adapt the access rights so that your web server can read the contents
INFO: The index has to be generated in the directory that contains the
gemssubdir, not thegemsdir itself! In this case it’s/var/www/rubygems.Now you can add
http://<my-gem-server>.domain/rubygemsto your gem sources