Permalink
Browse files

added a warn and replace for gruntplugins using "grunt-contrib" naming

  • Loading branch information...
1 parent 7afa893 commit 338786c256b9764bd7f8d030ed50dc0b4e2bcd11 @jsoverson jsoverson committed Dec 11, 2012
Showing with 12 additions and 1 deletion.
  1. +12 −1 templates/gruntplugin/template.js
@@ -25,7 +25,18 @@ exports.template = function(grunt, init, done) {
// Prompt for these values.
init.prompt('name', function(value, props, done) {
// Prepend grunt- to default name.
- done(null, 'grunt-' + value);
+ var name = 'grunt-' + value;
+
+ // Replace 'grunt-contrib' with 'grunt' and give a warning
+ if (/^grunt-contrib/.test(name)) {
+ var message = 'Omitting "contrib" from your project\'s name. The grunt-contrib ' +
@sorccu

sorccu Dec 11, 2012

Are you sure you didn't mean to write "omit" instead of "omitting"?

@jsoverson

jsoverson Dec 11, 2012

Member

The replacement is about to actually be done by the task, and isn't a command or suggestion. The tense seems appropriate.

If anything the replacement could be seen by the user as having already happened, so the past tense 'omitted' could be argued for here.

@sorccu

sorccu Dec 11, 2012

Ok, makes sense.

+ 'namespace is reserved for tasks maintained by the grunt team.';
+
+ grunt.log.writelns(message.red);
+ name = name.replace(/^grunt-contrib/,'grunt');
+ }
+
+ done(null, name);
}),
init.prompt('description', 'The best grunt plugin ever.'),
init.prompt('version'),

0 comments on commit 338786c

Please sign in to comment.