cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject [3/6] git commit: added initial work to build nightly, updating platforms.js file in cordova-lib
Date Sat, 01 Nov 2014 01:26:24 GMT
added initial work to build nightly, updating platforms.js file in cordova-lib


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

Branch: refs/heads/master
Commit: d49c9d1099e829a3ce6ee27942e8b7962aa02b80
Parents: 4e44786
Author: Steve Gill <stevengill97@gmail.com>
Authored: Thu Oct 23 17:51:16 2014 -0700
Committer: Steve Gill <stevengill97@gmail.com>
Committed: Fri Oct 31 18:25:00 2014 -0700

----------------------------------------------------------------------
 src/main.js         |  4 +++
 src/nightly.js      | 86 ++++++++++++++++++++++++++++++++++++++++++++++++
 src/repoutil.js     |  1 +
 src/retrieve-sha.js | 28 ++++++++++++++++
 4 files changed, 119 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-coho/blob/d49c9d10/src/main.js
----------------------------------------------------------------------
diff --git a/src/main.js b/src/main.js
index 9329604..27edd74 100644
--- a/src/main.js
+++ b/src/main.js
@@ -125,6 +125,10 @@ module.exports = function() {
             name: 'check-license',
             desc: 'Go through each specified repo and check the licenses of node modules
that are 3rd-party dependencies.',
             entryPoint: lazyRequire('./check-license')
+        }, {
+            name: 'nightly',
+            desc: 'Builds and publishes nightly builds of cordova-cli using the latest commits
for each platform.',
+            entryPoint: lazyRequire('./nightly')
         }
     ];
     var commandMap = {};

http://git-wip-us.apache.org/repos/asf/cordova-coho/blob/d49c9d10/src/nightly.js
----------------------------------------------------------------------
diff --git a/src/nightly.js b/src/nightly.js
new file mode 100644
index 0000000..c63d50a
--- /dev/null
+++ b/src/nightly.js
@@ -0,0 +1,86 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+*/
+
+var optimist = require('optimist');
+var apputil = require('./apputil');
+var executil = require('./executil');
+var flagutil = require('./flagutil');
+var gitutil = require('./gitutil');
+var repoutil = require('./repoutil');
+var repoupdate = require('./repo-update');
+var retrieveSha = require('./retrieve-sha');
+var print = apputil.print;
+var fs = require('fs');
+var path = require('path');
+
+module.exports = function*() {
+    var repos = flagutil.computeReposFromFlag('nightly');    
+    console.log(repos);
+    //Update Repos
+    yield repoupdate.updateRepos(repos, []);
+
+    var SHAJSON = yield retrieveSha(repos);
+
+    //console.log(SHAJSON['android']);
+    //save SHAJSON in cordova-cli repo
+
+    //Update platforms at cordova-lib/src/cordova/platforms.js
+    //console.log(repos);
+    var cordovaLib = repoutil.getRepoById('lib');
+    //Need to run forEachRepo 
+    yield repoutil.forEachRepo([cordovaLib], function*() {
+        //need to get the path to cordova-lib using executil
+        var cordovalibdir = yield executil.execHelper(executil.ARGS('pwd'), true, true);
+        yield updatePlatformsFile(path.join(cordovalibdir, 'cordova-lib/src/cordova/platforms.js'),
SHAJSON);
+    });
+
+}
+
+//updates platforms.js with the SHA
+function *updatePlatformsFile(file, shajson){
+    platformsJS = require(file);
+    var repos = flagutil.computeReposFromFlag('active-platform');
+    //console.log(platformsJS);
+    yield repoutil.forEachRepo(repos, function*(repo) {
+        console.log(repo);
+        if(repo.id === 'windowsphone'){
+            platformsJS['wp8'].version = shajson[repo.id]; 
+        } else if(repo.id === 'windows') {
+            platformsJS[repo.id].version = shajson[repo.id];     
+            platformsJS['windows8'].version = shajson[repo.id]; 
+        } else if(repo.id === 'blackberry') {
+            platformsJS['blackberry10'].version = shajson[repo.id]; 
+        } else {
+            platformsJS[repo.id].version = shajson[repo.id]; 
+        }
+    });
+
+    fs.readFile(file, 'utf8', function (err, data) {
+    if (err) {
+        console.log(err);
+    }
+    var result = data.replace(/(({(.\n)*(.|\n)*)version:\s[\d\w'.]*(\n)(.)*(\n)})/g, JSON.stringify(platformsJS,
null, 4));
+    
+    fs.writeFile(file, result, 'utf8', function(err) {
+        if (err) return console.log (err);
+    });
+
+    }); 
+}
+

http://git-wip-us.apache.org/repos/asf/cordova-coho/blob/d49c9d10/src/repoutil.js
----------------------------------------------------------------------
diff --git a/src/repoutil.js b/src/repoutil.js
index 33417fd..ae92cec 100644
--- a/src/repoutil.js
+++ b/src/repoutil.js
@@ -417,6 +417,7 @@ var repoGroups = {
     'release-repos': allRepos.filter(function(r) { return !r.inactive })
 };
 repoGroups['cadence'] = repoGroups['active-platform'].concat([getRepoById('mobile-spec'),
getRepoById('app-hello-world')]);
+repoGroups['nightly'] = repoGroups['active-platform'].concat([getRepoById('cli'), getRepoById('lib')]);
 
 repoGroups.__defineGetter__('auto', function() {
     return allRepos.filter(function(repo) {

http://git-wip-us.apache.org/repos/asf/cordova-coho/blob/d49c9d10/src/retrieve-sha.js
----------------------------------------------------------------------
diff --git a/src/retrieve-sha.js b/src/retrieve-sha.js
new file mode 100644
index 0000000..daf346e
--- /dev/null
+++ b/src/retrieve-sha.js
@@ -0,0 +1,28 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+*/
+var repoutil = require('./repoutil');
+var executil = require('./executil');
+
+module.exports = function *(repos) {
+    var shas = {};
+    yield repoutil.forEachRepo(repos, function*(repo) { 
+        shas[repo.id] = yield executil.execHelper(executil.ARGS('git rev-parse HEAD'), true,
true);
+    });
+    return shas;
+}


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


Mime
View raw message