views:

67

answers:

2

When it comes to adding gems/plugins I notice that sometimes the author name is prepended to the gem/plugin name, whereas other times it isn't. Is there any reasoning behind this?

Example:

config.gem "thoughtbot-factory_girl", :source => "http://gems.github.com"

Why not have it as:

config.gem "factory_girl", :source => "http://gems.github.com"

When do you differentiate between the two?

+1  A: 

Because there are several projects with similar funcitonality, but provided by different authors. Maybe some of them are forks of the other ones. Or maybe they just have a common interface for a specific task.

Quick googleing yields the following authors:

To distinguish them, it's useful to prepend author's nickname to gem name.

Pavel Shved
+12  A: 

When GitHub used to auto-build and host gems, they enforced a namespacing scheme by username. This is why github gems are prefixed with a username. GitHub embraces forking projects; hence the need for the prefixed usernames. GitHub was never really a good place for the canonical gem names, so they decided to drop their automatic gem hosting* when Gemcutter launched. Since then, even the original host of canonical gems, RubyForge, stopped hosting gems in favor of Gemcutter. Gemcutter is now the canonical source for all gems.

To make this easy for everyone, http://gems.rubyforge.org now points to http://gemcutter.org.

*GitHub announced that they would continue to host all old username namespaced gems for at least one more year.


With regards to factory_girl, that too is now hosted on Gemcutter. Your config only needs to look like this now:

config.gem "factory_girl"

...but I suggest also adding a version number for your projects (you'll thank me when you come back to a stale project later):

config.gem "factory_girl", :version => "1.2.3"
Ryan McGeary
Thanks a lot Ryan. You explained it well.