fdm-init-plugin
Version:
61 lines (48 loc) • 1.69 kB
JavaScript
/*
* grunt-init-gruntplugin
* https://gruntjs.com/
*
* Copyright (c) 2013 "Cowboy" Ben Alman, contributors
* Licensed under the MIT license.
*/
;
// Basic template description.
exports.description = 'Create a Fd Maven plugin';
// 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({type: 'grunt'}, [
// Prompt for these values.
init.prompt('name'),
init.prompt('description'),
init.prompt('version'),
init.prompt('repository'),
init.prompt('homepage'),
init.prompt('bugs'),
init.prompt('licenses'),
init.prompt('author_name'),
init.prompt('node_version', grunt.package.engines.node)
], function(err, props) {
// Set a few grunt-plugin-specific properties.
props.short_name = props.name.replace(/^grunt[\-_]?/, '').replace(/[\W_]+/g, '_').replace(/^(\d)/, '_$1');
props.main = 'Gruntfile.js';
props.npm_test = 'fdm build test';
props.keywords = ['fdmplugin','gruntplugin'];
props.devDependencies = {
'grunt-contrib-jshint': '~0.6.0',
'grunt-contrib-clean': '~0.4.0',
'grunt-contrib-nodeunit': '~0.2.0',
};
// 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();
});
};