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 2012/12/30 22:02:35 UTC

[3/5] git commit: added new arguments

added new arguments


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

Branch: refs/heads/master
Commit: dd0437d905e0a9d095feffcc15250a8e15adeb45
Parents: fe641e2
Author: steven gill <st...@apache.org>
Authored: Mon Nov 12 15:26:12 2012 -0800
Committer: steven gill <st...@apache.org>
Committed: Mon Nov 12 15:26:12 2012 -0800

----------------------------------------------------------------------
 README.md         |   61 ++++++++++++-----------------------
 coho              |   82 ++++++++++++++++++++++++++++++------------------
 test/tests.coffee |    4 +-
 3 files changed, 74 insertions(+), 73 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-coho/blob/dd0437d9/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index 5a2f101..290de76 100644
--- a/README.md
+++ b/README.md
@@ -8,59 +8,40 @@ Prerequisites
  - Must be run on a Mac with Lion (or later) installed
  - Have node installed (v 6.6+)
  - Must have git setup
- - Install joDoc
-	- Have perl 5.8+ installed
-	- Clone [joDoc](http://github.com/davebalmer/jodoc)
-
-	        git clone http://github.com/davebalmer/joDoc.git
-
-	- Add `joDoc/` to your path:
-
-	  Open `~/.bashrc` or `~/.profile` (or whatever you use) and
-
-	        export PATH=$PATH:~/path/to/joDoc/
-
-	- Install markdown:
-
-	        # Use your package manager such as:
-	        brew install markdown
-	        port install markdown
-	        aptitude install markdown
-
-	- Install nokogiri (Ruby HTML parser):
-
-	        gem install nokogiri
-
-	- Install json (Ruby JSON parser):
-
-	        gem install json
- - Install Android SDK
  - Install gpg
-
 	- Create a keypair if you don't have one already that can be used to 
 	sign the release artifact.
 
 Usage
 -----
-*	`./coho all 1.8.0 1.7.0`
+*	`./coho all 2.2.0 2.1.0`
 
-	where 'all' is the platforms to include, '1.8.0' is the current version
-        to release, and '1.7.0' is the previous version that will be diff'ed to
+	where 'all' is the commands to run, '2.2.0' is the current version to release,
+	and '2.1.0' is the previous version that will be diff'ed to
 	create a changelog using `git history`. Specifying the previous version
 	is optional, if you omit it a changelog will not be generated.
 	Running coho will do a `git checkout` of the tagged
-	specified release version (ie, '1.8.0'). Running coho will also create
+	specified release version (ie, '2.2.0'). Running coho will also create
 	the `temp/release/src` directory which is where the generated artifact
 	will be when coho completes.
 	
-*	`make`
-
-	runs `coho all 1.8.0 1.7.0` and the unit tests to verify the
-	packaging of the artifact. You may need to
-	npm install coffee-script and nodeunit if you wish to run this. You 
-	will probably want to change the release version 'VERSION' and the 		previous version 'oldVersion' variables at the top of the 
-	`test/tests.coffee` script from the default values of '1.8.0' and
-	'1.7.0' respectively.
+	Other commands to run:
+	
+	`./coho build 2.2.0 2.1.0`
+	builds the release without zipping + signing.
+	
+	`./coho sign 2.2.0 2.1.0`
+	will take a built release and zip + sign it. Must run `build` before running `sign`. 
+	
+*	`make` OR `npm test`
+
+	runs `coho all 2.2.0 2.1.0` and the unit tests to verify the
+	packaging of the artifact. You may need to run `npm install` to 
+	install coffee-script and nodeunit if you wish to run this. You 
+	will probably want to change the release version 'VERSION' and the 
+	previous version 'OLDVER' variables at the top of the 
+	`test/tests.coffee` script from the default values of '2.2.0' and
+	'2.1.0' respectively.
 
 Issues
 ------

http://git-wip-us.apache.org/repos/asf/cordova-coho/blob/dd0437d9/coho
----------------------------------------------------------------------
diff --git a/coho b/coho
index 3bdf1d7..d7cc506 100755
--- a/coho
+++ b/coho
@@ -17,11 +17,16 @@
 	specific language governing permissions and limitations
 	under the License.
 */
-PLATFORM = process.argv[2]
-if (!PLATFORM) {
-    PLATFORM = "all";
+COMMAND = process.argv[2]
+if (!COMMAND) {
+    COMMAND = "all";
 }
 VERSION = process.argv[3]
+if (!VERSION){
+    VERSION = '2.2.0';
+}
+OLDVER         = process.argv[4]
+
 var util           = require('util')
 ,   exec           = require('child_process').exec
 ,   fs             = require('fs')
@@ -30,15 +35,12 @@ var util           = require('util')
 ,   releaseSrcDir  = '../../release/src/cordova-'+VERSION
 ,   repoCount      = 15
 ,   tracker        = 0
-,   oldVer         = process.argv[4];
+,   cordovaSrcZip  = "cordova-"+VERSION+"-src.zip"
+,   cordovaSrcAsc  = cordovaSrcZip+".asc"
+,   cordovaSrcMd5  = cordovaSrcZip+".md5"
+,   cordovaSrcSha  = cordovaSrcZip+".sha";
 
-var cordovaSrcZip = "cordova-"+VERSION+"-src.zip";
-var cordovaSrcAsc = cordovaSrcZip+".asc";
-var cordovaSrcMd5 = cordovaSrcZip+".md5";
-var cordovaSrcSha = cordovaSrcZip+".sha";
 
-shjs.rm('-rf', 'temp')
-shjs.mkdir('-p', ['temp/repositories','temp/release/src/cordova-'+VERSION])
 
 var platformDict = {
   "iOS" : ['https://git-wip-us.apache.org/repos/asf/incubator-cordova-ios.git','incubator-cordova-ios'],
@@ -59,23 +61,30 @@ var platformDict = {
 };
 
 
-shjs.cd(tempRepoDir)
-shjs.echo(shjs.ls('.'))
-
-//keys into top level directory
-shjs.echo('Moving KEYS file to release');
-shjs.cp('../../KEYS', '../release/KEYS');
-
-// notice, license, readme, disclaimer file to be put into official release artifact
-shjs.echo('Moving notice, license, readme, and disclaimer files to release artifact');
-shjs.cp('../../bin/*', '../release/src/cordova-'+VERSION);
 
+//shjs.echo(shjs.ls('.'))
 
-//git clone & checkout version
+//prep function
 function prep(){
+    //remove old folders and create new ons
+    shjs.rm('-rf', 'temp')
+    shjs.mkdir('-p', ['temp/repositories','temp/release/src/cordova-'+VERSION])
+    
+    //set working directory 
+    shjs.cd(tempRepoDir)
+    
+    //copy keys into top level directory
+    console.log('Moving KEYS file to release');
+    shjs.cp('../../KEYS', '../release/KEYS');
+
+    //copy notice, license, readme, disclaimer file to be put into official release artifact
+    console.log('Moving notice, license, readme, and disclaimer files to release artifact');
+    shjs.cp('../../bin/*', '../release/src/cordova-'+VERSION);
+    
+    //git clone & checkout version
     tracker = 0;
     for(key in platformDict){
-        shjs.echo('Cloning ' + key);
+        console.log('Cloning ' + key);
         shjs.exec("git clone "+platformDict[key][0]+" && cd "+platformDict[key][1]+" && git fetch --tags && git checkout "+VERSION, {async:true, silent:true}, function(e, stdout, stderr) {
             tracker +=1;
             if (tracker == repoCount){
@@ -100,20 +109,22 @@ function repoZip(){
 
 //generates the changelog
 function changelog(){
-    //keeps track of directoires of created changelogs
-    var tempArray = []
-    if (oldVer != undefined){
+    if (OLDVER != undefined){
+        //keeps track of directoires of created changelogs
+        var tempArray = []
         exec('cd ../release/src/cordova-'+VERSION+' && echo "CHANGELOG" > changelog');
         tempArray.push('../release/src/cordova-'+VERSION+'/changelog');
         tracker = 0;
         for(key in platformDict){
             tempArray.push(platformDict[key][1]+'/changelog');
-            exec("cd "+platformDict[key][1]+" && echo '\n"+key+" \n---\n' > changelog && git log --format='%h %s' "+oldVer+".."+VERSION+" >> changelog", function(){
+            exec("cd "+platformDict[key][1]+" && echo '\n"+key+" \n---\n' > changelog && git log --format='%h %s' "+OLDVER+".."+VERSION+" >> changelog", function(){
                 tracker +=1
                 if (tracker == repoCount){
                     //concatenate all changelogs to one changelog 
                     shjs.cat(tempArray).to('../release/src/cordova-'+VERSION+'/changelog');
-                    signZip();
+                    if (COMMAND.toLowerCase() === 'all' || COMMAND.toLowerCase() === 'sign' ){
+                        signZip();
+                    }
                 }
             });
         }
@@ -122,10 +133,19 @@ function changelog(){
 
 // zip and sign cordova release folder
 function signZip(){
-    shjs.echo('Zipping and signing src');
+    if (COMMAND.toLowerCase() === 'sign'){
+        //set working directory 
+        shjs.cd(tempRepoDir)
+    }
+    console.log('Zipping and signing src');
     shjs.exec("cd ../release/src && zip -rq "+ cordovaSrcZip +" * && gpg --armor --output "+cordovaSrcAsc+" --detach-sig "+cordovaSrcZip+" && gpg --print-md MD5 "+cordovaSrcZip+" > " + cordovaSrcMd5 +" && gpg --print-md SHA512 " + cordovaSrcZip + " > " + cordovaSrcSha, {async:true}, function(){
-        shjs.echo("Created temp/release/src/"+cordovaSrcZip+" with corresponding asc, md5, and sha files.");
+        console.log("Created temp/release/src/"+cordovaSrcZip+" with corresponding asc, md5, and sha files.");
     });   
 }
-
-prep();
+if (COMMAND.toLowerCase() === 'all' || COMMAND.toLowerCase() === 'build' ){
+    prep();
+}else if(COMMAND.toLowerCase() === 'sign'){
+    signZip();
+}else{
+    console.log("Incorrect Arguments, please review the readme!");
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-coho/blob/dd0437d9/test/tests.coffee
----------------------------------------------------------------------
diff --git a/test/tests.coffee b/test/tests.coffee
index c441039..43d2e42 100644
--- a/test/tests.coffee
+++ b/test/tests.coffee
@@ -1,5 +1,5 @@
 VERSION = '2.2.0'
-oldVersion = '2.1.0'
+OLDVER = '2.1.0'
 
 exports['sanity test'] = (test)-> 
     test.expect 1
@@ -18,7 +18,7 @@ exports['test cli callable'] = (test)->
 			test.ok true, 'successfully called coho'
 			test.done()
 			
-	child = exec "./coho all #{VERSION} #{oldVersion}", thetest
+	child = exec "./coho all #{VERSION} #{OLDVER}", thetest
 
 exports['creating temp directory'] = (test)->
 	test.expect 1