[Rubygems-developers] Gem name validation

Josh Susser josh at hasmanythrough.com
Thu Oct 1 10:41:33 EDT 2009


On Sep 30, 2009, at 11:44 PM, John Barnette wrote:
> I'd like to add an error to Specification#validate if the spec's  
> name doesn't match /[a-z][a-z0-9-_]*/i. Any objections? Disregarding  
> obviously malformed specs, all current gem names match.


Sounds good, with one minor nitpick: your regexp isn't valid.  A dash  
in a character class must be in the first position to be a literal  
dash instead of a range separator.  Use /[a-z][-_a-z0-9]*/i or /[a-z][- 
\w]*/i instead.

Are we sure today isn't another Monday?

--
Josh Susser
http://blog.hasmanythrough.com



More information about the Rubygems-developers mailing list