Skip to content

Commit

Permalink
Grunt: alias 'jsbeautifier' => 'beautify'
Browse files Browse the repository at this point in the history
  • Loading branch information
rwaldron committed Feb 18, 2016
1 parent e16378f commit d7c1886
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions Gruntfile.js
Expand Up @@ -159,20 +159,20 @@ module.exports = function(grunt) {

//
//
// grunt jsbeautifier:file:file-a.js
// grunt jsbeautifier:file:[file-a.js,file-b.js]
// grunt beautify:file:file-a.js
// grunt beautify:file:[file-a.js,file-b.js]
//
// grunt jsbeautifier:file:file-a
// grunt jsbeautifier:file:[file-a,file-b]
// grunt beautify:file:file-a
// grunt beautify:file:[file-a,file-b]
//
grunt.registerTask("jsbeautifier:file", "Cleanup a single or limited set of files; usage: 'grunt jsbeautifier:file:file.js' or 'grunt jsbeautifier:file:[file-a.js,file-b.js]' (extension optional)", function(file) {
grunt.registerTask("beautify:file", "Cleanup a single or limited set of files; usage: 'grunt beautify:file:file.js' or 'grunt beautify:file:[file-a.js,file-b.js]' (extension optional)", function(file) {
var files;

if (file) {
files = [file];

//
// grunt jsbeautifier:file:[test-file-a,test-file-b]
// grunt beautify:file:[test-file-a,test-file-b]
//
if (file[0] === "[" && file[file.length - 1] === "]") {
files = file.match(/(\w+)/g);
Expand All @@ -184,11 +184,11 @@ module.exports = function(grunt) {
files[i] += ".js";
}
}
grunt.config("jsbeautifier.files", files);
grunt.config("beautify.files", files);
}
}

grunt.task.run("jsbeautifier");
grunt.task.run("beautify");
});

// Support running a complete set of tests with
Expand All @@ -206,6 +206,8 @@ module.exports = function(grunt) {
grunt.loadNpmTasks("grunt-jsbeautifier");
grunt.loadNpmTasks("grunt-jscs");

grunt.registerTask("beautify", ["jsbeautifier"]);

grunt.registerTask("default", ["jshint", "jscs", "nodeunit"]);
// Explicit test task runs complete set of tests
grunt.registerTask("test", ["jshint", "jscs", "nodeunit:complete"]);
Expand Down

0 comments on commit d7c1886

Please sign in to comment.