-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplate.js
51 lines (42 loc) · 1.32 KB
/
template.js
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
/**
* grunt-init-go-main
* https://github.com/gedex/grunt-init-go-main
*
* Copyright (c) 2014 Akeda Bagus <[email protected]>
* Licensed under the MIT License.
*/
'use strict';
// Basic template description.
exports.description = 'Create a Go main program.';
// Template-specific notes to be displayed before question prompts.
exports.notes = '';
// Template-specific notes to be displayed after the question prompts.
exports.after = '';
// Any existing file or directory matching this wildcard will cause a warning.
exports.warnOn = '*';
// The actual init template.
exports.template = function(grunt, init, done) {
init.process( {}, [
// Prompt for these values.
{
name: 'bin',
message: 'Binary name (no whitespace)',
default: 'hello-world'
},
init.prompt('main_file', 'main'),
init.prompt('description', 'My awesome Go program that prints "Hello World!"'),
init.prompt('licenses', 'MIT'),
init.prompt('repository', 'github.com/gedex/hello-world'),
init.prompt('author_name'),
init.prompt('author_email'),
], function(err, props) {
// 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);
// All done!
done();
});
};