4056fc63801dcd4bc2fca74c57c090de6650ab04.svn-base
1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*
* grunt
* http://gruntjs.com/
*
* Copyright (c) 2012 "Cowboy" Ben Alman
* Licensed under the MIT license.
* https://github.com/gruntjs/grunt/blob/master/LICENSE-MIT
*/
// Basic template description.
exports.description = 'Create a commonjs module, including Nodeunit unit tests.';
// Template-specific notes to be displayed before question prompts.
exports.notes = '';
// Any existing file or directory matching this wildcard will cause a warning.
exports.warnOn = '*';
// The actual init template.
exports.template = function(grunt, init, done) {
grunt.helper('prompt', {}, [
// Prompt for these values.
grunt.helper('prompt_for', 'name'),
grunt.helper('prompt_for', 'description'),
grunt.helper('prompt_for', 'version'),
grunt.helper('prompt_for', 'repository'),
grunt.helper('prompt_for', 'homepage'),
grunt.helper('prompt_for', 'bugs'),
grunt.helper('prompt_for', 'licenses'),
grunt.helper('prompt_for', 'author_name'),
grunt.helper('prompt_for', 'author_email'),
grunt.helper('prompt_for', 'author_url'),
grunt.helper('prompt_for', 'node_version', '*'),
grunt.helper('prompt_for', 'main'),
grunt.helper('prompt_for', 'npm_test')
], function(err, props) {
props.keywords = [];
// Files to copy (and process).
var files = init.filesToCopy(props);
// Add properly-named license files.
init.addLicenseFiles(files, props.licenses);
// Actually copy (and process) files.
init.copyAndProcess(files, props);
// Generate package.json file.
init.writePackageJSON('package.json', props);
// All done!
done();
});
};