Ah, you put me on the spot! Heh heh.
Actually, what vxnick wanted makes a ton of sense. It has been just within the past two or three years that I've been using regular expressions, and I'm far from being a guru with them. But I decided to rely on them to make the plugin less complicated and brittle. The first pass I made at it was not regexp dependent and it was a nightmare. Once I had the "Aha!" moment of being able to handle just about everything with regexps, the code became considerably simpler.
Anyway, I just pushed a change that adds support for a "binary" rule type which works by taking whatever you supply and making a shebang regexp for you. So you can now do this:
{"binary": "ruby"}
instead of
{"first_line": "^#\\!(?:.+)ruby"}
I haven't tested this extensively, but this should allow one to catch any variation of a base binary, such as ruby18, ruby19, php, php4, php5, etc.
Regarding the proliferation of plugins, I can see both sides. It is very frustrating when multiple plugins do essentially the same thing, but at the same time, I wouldn't want to see people not try to solve a problem in a slightly different way. One thing I've learned over the years is we don't all think the same way (this is true for most, if not all, areas of life, not just plugin development
), so one person's neato solution to a problem isn't going to ring bells with everyone. Besides, choice is good.
I don't want to stir this debate up again, but I figured since I got pulled into it
, I might as well toss in a penny or two while I'm here. Oh, and I wholeheartedly agree that the difference of opinion was handled very well.
Cheers and peace to all!
P.S. And just for posterity, the "first_line" rule type is a consolidation of what originally was "first_line" and "shebang". In my earliest attempts at this plugin, I was trying to handle shebangs separately from things like the first line of an XML file. When I decided to handle everything with regular expressions, I didn't think "shebang" was generic enough to reasonably apply to all situations. shrug I don't really like "first_line", but it works.