1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 | exports.description = 'Create a grunt plugin, including Nodeunit unit tests.';
|
12 |
|
13 |
|
14 | exports.notes = 'The grunt plugin system is still under development. For ' +
|
15 | 'more information, see the docs at https://github.com/gruntjs/grunt/blob/master/docs/plugins.md';
|
16 |
|
17 |
|
18 | exports.warnOn = '*';
|
19 |
|
20 |
|
21 | exports.template = function(grunt, init, done) {
|
22 |
|
23 | grunt.helper('prompt', {type: 'grunt'}, [
|
24 |
|
25 | grunt.helper('prompt_for', 'name', function(value, data, done) {
|
26 |
|
27 | data.short_name = value;
|
28 | value = data.full_name = 'grunt-' + value;
|
29 |
|
30 | done(null, value);
|
31 | }),
|
32 | grunt.helper('prompt_for', 'description', 'The best sample grunt tasks ever.'),
|
33 | grunt.helper('prompt_for', 'version'),
|
34 | grunt.helper('prompt_for', 'repository'),
|
35 | grunt.helper('prompt_for', 'homepage'),
|
36 | grunt.helper('prompt_for', 'bugs'),
|
37 | grunt.helper('prompt_for', 'licenses'),
|
38 | grunt.helper('prompt_for', 'author_name'),
|
39 | grunt.helper('prompt_for', 'author_email'),
|
40 | grunt.helper('prompt_for', 'author_url'),
|
41 | grunt.helper('prompt_for', 'grunt_version'),
|
42 | grunt.helper('prompt_for', 'node_version', '*')
|
43 | ], function(err, props) {
|
44 |
|
45 | props.main = 'grunt.js';
|
46 | props.npm_test = 'grunt test';
|
47 | props.bin = 'bin/' + props.name;
|
48 | props.keywords = ['gruntplugin'];
|
49 |
|
50 |
|
51 | var files = init.filesToCopy(props);
|
52 |
|
53 |
|
54 | init.addLicenseFiles(files, props.licenses);
|
55 |
|
56 |
|
57 | init.copyAndProcess(files, props);
|
58 |
|
59 |
|
60 | init.writePackageJSON('package.json', props);
|
61 |
|
62 |
|
63 | done();
|
64 | });
|
65 |
|
66 | };
|