Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ruby gems repository

I'm trying to set a gem repository on one of our local servers. Here are the steps I'm running, that I've followed from several guides.

1) I create the BASEDIR folder /var/www/html/gems
2) sudo cp -r /usr/lib/ruby/gems/1.8/gems/someGem /var/www/html/gems
3) sudo gem generate_index -d /var/www/html/gems

However, when I run this, I get the following output:

Loading 0 gems from /var/www/html/gems

Loaded all gems
Generating quick index gemspecs for 0 gems

Complete
Generating specs index
Generating latest specs index
Generating quick index
Generating latest index
Generating Marshal master index
Generating YAML master index for 0 gems (this may take a while)

Complete
Compressing indicies

It's not loading the gem for some reason. I did see a guide that recommended making the BASEDIR as /var/www/html/rubygems/ and then further make a gems/ directory within the BASEDIR and copy the desired gems to this gems/ directory. I also tried this, but was getting the same results.

Our server had the unfortunate luck of having the same configuration as mentioned in this post (RHEL5, ruby 1.8.5, /var and /tmp on separate partitions), but we upgraded as suggested to ruby 1.8.6, but it still won't load the gem.

Has anyone come across this? Found a solution?

like image 697
istrasci Avatar asked Nov 11 '09 22:11

istrasci


People also ask

Where are RubyGems stored?

The main place where libraries are hosted is RubyGems.org, a public repository of gems that can be searched and installed onto your machine. You may browse and search for gems using the RubyGems website, or use the gem command. Using gem search -r , you can search RubyGems' repository.

How do I download RubyGems?

Open up the 'Software Center' app from your launcher and type in `RubyGems` without quotes into the application search box at the top right, and press [enter]. RubyGems then can be installed by just clicking on the button labeled 'Install', thats it.

What are gem files in Ruby?

A Gemfile is a file that is created to describe the gem dependencies required to run a Ruby program. A Gemfile should always be placed in the root of the project directory.

How do I know if RubyGems are installed?

Listing Installed Gems The list command shows your locally installed gems: $ gem list *** LOCAL GEMS *** abbrev (default: 0.1. 0) awesome_print (1.9. 2) base64 (default: 0.1.


2 Answers

I stumbled upon my old post and realized I'd actually solved this some time ago, so I figured I'd post my answer.

The problem was my step 2: copy gems action.

In the OP, I had tried

2) sudo cp -r /usr/lib/ruby/gems/1.8/gems/someGem /var/www/html/gems

What I found was that I needed to copy the actual .gem files, which lived at .../gems/1.8/gems/cache . So what I really needed to do for step 2 is:

sudo cp .../gems/1.8/gems/cache/*.gem /var/www/html/gems

After copying the gems correctly, the indexing worked as expected, and we could then use our server by adding it as a gem source on various machines. Installing our custom gems then worked smoothly.

like image 190
istrasci Avatar answered Sep 22 '22 00:09

istrasci


We internally use Artifactory for managing our in-house rubygems - some of them are proprietary and some are publicly released. we can enforce security between our different groups (dev, qa - prerelease, release, ...)

Also, rubygems.org is proxied and cached locally, which helps us gain better performance and avoid remote downtimes.

Eventually, developers are using a single source url, aggregating both remote and local repositories transparently.

like image 23
zapp Avatar answered Sep 21 '22 00:09

zapp