cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agri...@apache.org
Subject [1/2] git commit: Add running RAT to coho tool.
Date Tue, 28 May 2013 19:31:17 GMT
Updated Branches:
  refs/heads/master 9d6e1f504 -> 7ba4c8c86


Add running RAT to coho tool.

Tested only for iOS, so exclusion filters need updating for other repos.


Project: http://git-wip-us.apache.org/repos/asf/cordova-coho/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-coho/commit/07e025e9
Tree: http://git-wip-us.apache.org/repos/asf/cordova-coho/tree/07e025e9
Diff: http://git-wip-us.apache.org/repos/asf/cordova-coho/diff/07e025e9

Branch: refs/heads/master
Commit: 07e025e9fa94ec2bceb303eaf7865d6c14e8b30c
Parents: 9d6e1f5
Author: Andrew Grieve <agrieve@chromium.org>
Authored: Tue May 28 15:30:23 2013 -0400
Committer: Andrew Grieve <agrieve@chromium.org>
Committed: Tue May 28 15:30:23 2013 -0400

----------------------------------------------------------------------
 coho |   46 ++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 46 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-coho/blob/07e025e9/coho
----------------------------------------------------------------------
diff --git a/coho b/coho
index 5a84c1c..585e98e 100755
--- a/coho
+++ b/coho
@@ -25,6 +25,15 @@ var shjs = require('shelljs');
 
 var origWorkingDir = process.cwd();
 
+var COMMON_RAT_FLAGS = ['-e "*.wav"',
+    '-e "*.webloc"',
+    '-e "*jasmine-1.2.0*"',
+    '-e "*.xcodeproj"',
+    '-e ".*"',
+    '-e "*-Info.plist"',
+    '-e "VERSION"'
+    ];
+
 var platformRepos = [
     {
         title: 'Android',
@@ -741,6 +750,39 @@ function tagReleaseBranchCommand(argv) {
     });
 }
 
+function ratCommand() {
+    var opt = registerRepoFlag(optimist);
+    opt = registerHelpFlag(opt);
+    opt.usage('Uses Apache RAT to audit source files for license headers.\n' +
+              '\n' +
+              'Usage: $0 audit-license-headers --repo=ios')
+    argv = opt.argv;
+
+    if (argv.h) {
+        optimist.showHelp();
+        process.exit(1);
+    }
+    var repos = computeReposFromFlag(argv);
+    // Check that RAT command exists.
+    var ratPath = path.resolve(path.join(path.dirname(process.argv[1]), 'apache-rat-0.8',
'apache-rat-0.8.jar'));
+    if (!fs.existsSync(ratPath)) {
+        console.log('RAT tool not found, downloading to: ' + ratPath);
+        forEachRepo([getRepoById('coho')], function() {
+            if (shjs.which('curl')) {
+                execHelper('curl "http://mirror.csclub.uwaterloo.ca/apache/incubator/rat/binaries/apache-rat-incubating-0.8-bin.tar.gz"
| tar xz');
+            } else {
+                execHelper('wget -O - "http://mirror.csclub.uwaterloo.ca/apache/incubator/rat/binaries/apache-rat-incubating-0.8-bin.tar.gz"
| tar xz');
+            }
+        });
+        if (!fs.existsSync(ratPath)) {
+            fatal('Download failed.');
+        }
+    }
+    forEachRepo(repos, function(repo) {
+        execHelper('java -jar "' + ratPath + '" -d . ' + COMMON_RAT_FLAGS.join(' '));
+    });
+}
+
 function main() {
     var commandList = [
         {
@@ -764,6 +806,10 @@ function main() {
             desc: 'Tags repos for a release.',
             entryPoint: tagReleaseBranchCommand
         }, {
+            name: 'audit-license-headers',
+            desc: 'Uses Apache RAT to look for missing license headers.',
+            entryPoint: ratCommand
+        }, {
             name: 'create-release-snapshot',
             desc: 'Creates a signed .zip that consitutes a release.',
             entryPoint: createReleaseCommand


Mime
View raw message