You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by pm...@apache.org on 2012/05/22 14:16:16 UTC
js commit: build complains about ws instead of fixing
Updated Branches:
refs/heads/master 781562d1f -> 56051d527
build complains about ws instead of fixing
Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/commit/56051d52
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/tree/56051d52
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/diff/56051d52
Branch: refs/heads/master
Commit: 56051d527f890c20e01241a34e33fdcb1f49471c
Parents: 781562d
Author: Patrick Mueller <pm...@apache.org>
Authored: Tue May 22 08:15:45 2012 -0400
Committer: Patrick Mueller <pm...@apache.org>
Committed: Tue May 22 08:15:45 2012 -0400
----------------------------------------------------------------------
Jakefile | 32 +++++++++++++++++++++++++++++---
1 files changed, 29 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/56051d52/Jakefile
----------------------------------------------------------------------
diff --git a/Jakefile b/Jakefile
index 20f0c63..fad61ef 100644
--- a/Jakefile
+++ b/Jakefile
@@ -98,7 +98,7 @@ task('set-cwd', [], function() {
});
desc('check sources with JSHint');
-task('hint', ['fixwhitespace'], function () {
+task('hint', ['complainwhitespace'], function () {
var knownWarnings = ["Redefinition of 'FileReader'", "Redefinition of 'require'", "Read only"];
var filterKnownWarnings = function(el, index, array) {
var wut = true;
@@ -117,8 +117,34 @@ task('hint', ['fixwhitespace'], function () {
});
}, true);
+var complainedAboutWhitespace = false
+
+desc('complain about what fixwhitespace would fix');
+task('complainwhitespace', function() {
+ processWhiteSpace(function(file, newSource) {
+ if (!complainedAboutWhitespace) {
+ console.log("files with whitespace issues: (to fix: `jake fixwhitespace`)")
+ complainedAboutWhitespace = true
+ }
+
+ console.log(" " + file)
+ })
+}, true);
+
desc('converts tabs to four spaces, eliminates trailing white space, converts newlines to proper form - enforcing style guide ftw!');
task('fixwhitespace', function() {
+ processWhiteSpace(function(file, newSource) {
+ if (!complainedAboutWhitespace) {
+ console.log("fixed whitespace issues in:")
+ complainedAboutWhitespace = true
+ }
+
+ fs.writeFileSync(file, newSource, 'utf8');
+ console.log(" " + file)
+ })
+}, true);
+
+function processWhiteSpace(processor) {
forEachFile('lib', function(err, file, stats, cbDone) {
//if (err) throw err;
if (rexp_minified.test(file) || !rexp_src.test(file)) {
@@ -136,9 +162,9 @@ task('fixwhitespace', function() {
if (origsrc !== src) {
// write it out yo
- fs.writeFileSync(file, src, 'utf8');
+ processor(file, src);
}
cbDone();
}
}, complete);
-}, true);
+}