Why do names of Rails gems & plugins sometimes contain author name?
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 =>开发者_JS百科 "http://gems.github.com"
When do you differentiate between the two?
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"
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:
- javan's factory_girl
- thoughtbot's factory_girl
- mattmatt's factory_girl
To distinguish them, it's useful to prepend author's nickname to gem name.
精彩评论