You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by st...@apache.org on 2013/08/02 00:19:53 UTC

git commit: CB-3506 added apacheupload

Updated Branches:
  refs/heads/master 35c89317a -> 9cf0fe8c7


CB-3506 added apacheupload


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

Branch: refs/heads/master
Commit: 9cf0fe8c7283f11cc3408c3c42005acd3dd9fbbe
Parents: 35c8931
Author: Steven Gill <st...@gmail.com>
Authored: Thu Aug 1 15:16:43 2013 -0700
Committer: Steven Gill <st...@gmail.com>
Committed: Thu Aug 1 15:16:43 2013 -0700

----------------------------------------------------------------------
 coho | 60 +++++++++++++++++++++++++++++++++++++++++++++++-------------
 1 file changed, 47 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-coho/blob/9cf0fe8c/coho
----------------------------------------------------------------------
diff --git a/coho b/coho
index 8800310..f493707 100755
--- a/coho
+++ b/coho
@@ -560,22 +560,55 @@ function createReleaseCommand(argv) {
 }
 
 function apacheUpload(){
+    var opt = registerRepoFlag(optimist)
+    opt = opt
+        .options('new-version', {
+            desc: 'The version to release. E.g. 3.0.0',
+            demand: true
+         })
+        .options('prev-version', {
+            desc: 'The previous release version (used to remove old version from download page)',
+            demand: false
+         });
+    
+    opt = registerHelpFlag(opt);
+    var argv = opt
+        .usage('Uploads the release to the apache servers and optionally removes previous release files.\n' +
+            'This involves:\n' +
+            '    Checking out Apache Cordova release repository if it does not already exist.\n' +
+            '    Updating the repositoryvia svn update\n' +
+            '    Optionally removing old release artifacts\n' +
+            '    Copying in new relase artifacts\n' +
+            '    Svn committing new release artifacts to the apache repo\n' +
+            '\n' +
+            'Usage: $0 upload-release --new-version 3.0.0 [--prev-version 2.9.0]')
+        .argv;
+    
+    if (argv.h) {
+        optimist.showHelp();
+        process.exit(1);
+    }
+    
     if (shjs.test('-d','./apachecordova')){
         print('apachecordova directory exists');
-        shjs.exec("cd apachecordova && svn update");
+        execHelper("cd apachecordova && svn update");
 
-    }else{
+    } else {
         //grab apachecordova repo off apache svn servers
-        shjs.exec("svn checkout https://dist.apache.org/repos/dist/release/cordova apachecordova")
+        execHelper("svn checkout https://dist.apache.org/repos/dist/release/cordova apachecordova")
     }
-    
 
-    /*svn checkout https://dist.apache.org/repos/dist/release/cordova apachecordova
-    add function to do rest of 
-    delete all files 
-    copy over release files
-    svn add *
-    svn commit -m*/
+    if (argv['prev-version'] && shjs.test('-d','./apachecordova/cordova-'+argv['prev-version']+'-src.zip')){
+        //remove old version
+        print('removing previous release from apache servers')
+        execHelper("cd apachecordova && svn delete cordova-"+argv['prev-version']+"-src.*");
+    }
+    
+    print('copy over and commit new release files')
+    execHelper("cp -r releases/cordova-"+argv['new-version']+"/cordova-"+argv['new-version']+"-src* apachecordova/");
+    execHelper("cd apachecordova && svn add *");
+    print("svn commit -m 'updated to "+argv['new-version']+"'")
+    execHelper("cd apachecordova && svn commit -m 'updated to "+opt.argv['new-version']+"'");
 }
 
 function computeReposFromFlag(flagValue) {
@@ -1444,10 +1477,11 @@ function main() {
             name: 'create-release-bug',
             desc: 'Creates a bug in JIRA for tracking the tasks involved in a new release',
             entryPoint: createReleaseBugCommand
+        }, {
+            name: 'upload-release',
+            desc: 'Uploads a signed .zip to Cordova\'s webserver.',
+            entryPoint: apacheUpload
         }
-//            name: 'upload-release',
-//            desc: 'Uploads a signed .zip to Cordova\'s webserver.',
-//            entryPoint: null
     ];
     var commandMap = {};
     for (var i = 0; i < commandList.length; ++i) {