cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agri...@apache.org
Subject [24/26] js commit: [all] CB-3960 Move jshint into grunt (lamely) (cherry picked from commit 3d81324b9d89c8f51b14e2152eec5bfbea094caa)
Date Fri, 28 Jun 2013 14:15:48 GMT
[all] CB-3960 Move jshint into grunt (lamely)
(cherry picked from commit 3d81324b9d89c8f51b14e2152eec5bfbea094caa)


Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/8407cfbb
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/8407cfbb
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/8407cfbb

Branch: refs/heads/2.9.x
Commit: 8407cfbbcac805e1d813aab6d3df0b938259473b
Parents: 2d5fe12
Author: Andrew Grieve <agrieve@chromium.org>
Authored: Fri Jun 21 13:36:58 2013 -0400
Committer: Andrew Grieve <agrieve@chromium.org>
Committed: Fri Jun 28 10:13:07 2013 -0400

----------------------------------------------------------------------
 Gruntfile.js | 28 +++++++++++++++++++++++++++-
 Jakefile     | 48 ------------------------------------------------
 2 files changed, 27 insertions(+), 49 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/8407cfbb/Gruntfile.js
----------------------------------------------------------------------
diff --git a/Gruntfile.js b/Gruntfile.js
index 928b456..81275ad 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -17,6 +17,7 @@
  * under the License.
 */
 module.exports = function(grunt) {
+    var childProcess = require('child_process');
     var fs = require('fs');
     var path = require('path');
 
@@ -152,9 +153,34 @@ module.exports = function(grunt) {
         }, done);
     });
 
+    // TODO - Delete this task and use Grunt's built-in jshint (CB-3964).
+    grunt.registerTask('hint', 'Runs jshint.', function() {
+        var done = this.async();
+        var knownWarnings = [
+            "Redefinition of 'FileReader'",
+            "Redefinition of 'require'",
+            "Read only",
+            "Redefinition of 'console'"
+        ];
+        var filterKnownWarnings = function(el, index, array) {
+            var wut = true;
+            // filter out the known warnings listed out above
+            knownWarnings.forEach(function(e) {
+                wut = wut && (el.indexOf(e) == -1);
+            });
+            wut = wut && (!el.match(/\d+ errors/));
+            return wut;
+        };
+
+        childProcess.exec("jshint lib", function(err,stdout,stderr) {
+            var exs = stdout.split('\n');
+            grunt.log.writeln(exs.filter(filterKnownWarnings).join('\n'));
+            done();
+        });
+    });
     grunt.loadNpmTasks('grunt-contrib-clean');
     grunt.loadNpmTasks('grunt-contrib-jshint');
 
     // Default task(s).
-    grunt.registerTask('default', ['cordovajs', 'complainwhitespace', 'test']);
+    grunt.registerTask('default', ['cordovajs', 'hint', 'complainwhitespace', 'test']);
 };

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/8407cfbb/Jakefile
----------------------------------------------------------------------
diff --git a/Jakefile b/Jakefile
deleted file mode 100644
index 089b9b0..0000000
--- a/Jakefile
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF
- * or more contributor license agreements.  See th
- * distributed with this work for additional infor
- * regarding copyright ownership.  The ASF license
- * to you under the Apache License, Version 2.0 (t
- * "License"); you may not use this file except in
- * with the License.  You may obtain a copy of the
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to 
- * software distributed under the License is distr
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
- * KIND, either express or implied.  See the Licen
- * specific language governing permissions and lim
- * under the License.
- */
-
-var childProcess = require('child_process');
-
-task('default', ['hint'], function () {});
-
-desc('check sources with JSHint');
-task('hint', [], function () {
-    var knownWarnings = [
-        "Redefinition of 'FileReader'", 
-        "Redefinition of 'require'", 
-        "Read only",
-        "Redefinition of 'console'"
-    ];
-    var filterKnownWarnings = function(el, index, array) {
-        var wut = true;
-        // filter out the known warnings listed out above
-        knownWarnings.forEach(function(e) {
-            wut = wut && (el.indexOf(e) == -1);
-        });
-        wut = wut && (!el.match(/\d+ errors/));
-        return wut;
-    };
-
-    childProcess.exec("jshint lib",function(err,stdout,stderr) {
-        var exs = stdout.split('\n');
-        console.log(exs.filter(filterKnownWarnings).join('\n')); 
-        complete();
-    });
-}, true);
-


Mime
View raw message