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/cowboy/grunt/blob/master/docs/plugins.md';
|
16 |
|
17 |
|
18 | exports.warnOn = '*';
|
19 |
|
20 |
|
21 | exports.template = function(grunt, init, done) {
|
22 |
|
23 | var task = grunt.task;
|
24 | var file = grunt.file;
|
25 | var utils = grunt.utils;
|
26 | var log = grunt.log;
|
27 | var verbose = grunt.verbose;
|
28 | var fail = grunt.fail;
|
29 | var option = grunt.option;
|
30 | var config = grunt.config;
|
31 | var template = grunt.template;
|
32 |
|
33 | grunt.helper('prompt', {type: 'grunt'}, [
|
34 |
|
35 | grunt.helper('prompt_for', 'name', function(value, data, done) {
|
36 |
|
37 | data.short_name = value;
|
38 | value = data.full_name = 'grunt-' + value;
|
39 |
|
40 | done(null, value);
|
41 | }),
|
42 | grunt.helper('prompt_for', 'description', 'The best sample grunt tasks ever.'),
|
43 | grunt.helper('prompt_for', 'version'),
|
44 | grunt.helper('prompt_for', 'repository'),
|
45 | grunt.helper('prompt_for', 'homepage'),
|
46 | grunt.helper('prompt_for', 'bugs'),
|
47 | grunt.helper('prompt_for', 'licenses'),
|
48 | grunt.helper('prompt_for', 'author_name'),
|
49 | grunt.helper('prompt_for', 'author_email'),
|
50 | grunt.helper('prompt_for', 'author_url'),
|
51 | grunt.helper('prompt_for', 'grunt_version'),
|
52 | grunt.helper('prompt_for', 'node_version', '*')
|
53 | ], function(err, props) {
|
54 |
|
55 | props.main = 'grunt.js';
|
56 | props.npm_test = 'grunt test';
|
57 | props.bin = 'bin/' + props.name;
|
58 | props.dependencies = {grunt: props.grunt_version};
|
59 |
|
60 |
|
61 | var files = init.filesToCopy(props);
|
62 |
|
63 |
|
64 | init.addLicenseFiles(files, props.licenses);
|
65 |
|
66 |
|
67 | init.copyAndProcess(files, props);
|
68 |
|
69 |
|
70 | init.writePackageJSON('package.json', props);
|
71 |
|
72 |
|
73 | done();
|
74 | });
|
75 |
|
76 | };
|