Zabba
Zabba

Reputation: 65467

How to find out what fork/original of a gem is installed on my system?

When I add gem 'delayed_job' to my gemfile, how do I know whether I am going to get collectiveidea / delayed_job or tobi / delayed_job ?

Also, is there some way to check among the list of gems I already have installed, as to which fork/location those gems were downloaded/installed from?

Ps. I am using RVM on Ubuntu, Bundler and Rails 3.0.3

Upvotes: 4

Views: 248

Answers (3)

tee
tee

Reputation: 4409

The gemspec contains a homepage attribute, which often shows the source code repository. You can view a gemspec of a locally installed gem with:

gem spec delayed_job

View the homepage with:

gem spec delayed_job | grep homepage

That said, the gemspec does not always have the source repo.

To help solve this problem (and others), I wrote a gem called gemdiff. It does the gemspec inspection, and if that does not contain a github URL, it searches github for a match. It includes exceptions for gems like delayed_job, which is a fork of the original repository by tobi.

gem install gemdiff
gemdiff find delayed_job
=> http://github.com/collectiveidea/delayed_job

More valuably, gemdiff will inspect your project's bundle and can show you the source code diff between the version of a gem you have installed and the highest version that can be installed, as determined by bundler.

https://github.com/teeparham/gemdiff

Upvotes: 1

Vasiliy Ermolovich
Vasiliy Ermolovich

Reputation: 24617

If you want to specify git location you can use :git param:

gem "delayed_job", :git => "git://github.com/collectiveidea/delayed_job.git"
gem "delayed_job", :git => "git://github.com/tobi/delayed_job.git"

Read more about Gemfile

Upvotes: 1

Pan Thomakos
Pan Thomakos

Reputation: 34350

There isn't one way to tell which github fork or branch you are downloading from. For the delayed_job gem you are downloading from collectiveidea's branch. You can tell on this page where the homepage points to collectiveidea's github fork. The reason you can't tell which fork in particular is because rubygems aren't linked to github repositories. They are simply packages that are uploaded to the site. For all you know you could be downloading a gem from a copy of someone's local repository that isn't even published on the internet. You could also be downloading from an SVN repository instead of a Git repository. In general the rubygems.org site should give you some idea of how to find the source code for a gem though. Also, most github gems tag their commits with a version number so that you can tell which revision you are using by checking the github/git tags.

Upvotes: 2

Related Questions