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 2014/11/01 02:26:22 UTC
[1/6] git commit: CB-7904 removed improper argv usage
Repository: cordova-coho
Updated Branches:
refs/heads/master 4e44786dd -> ab0bbd2d7
CB-7904 removed improper argv usage
Project: http://git-wip-us.apache.org/repos/asf/cordova-coho/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-coho/commit/8e4dae80
Tree: http://git-wip-us.apache.org/repos/asf/cordova-coho/tree/8e4dae80
Diff: http://git-wip-us.apache.org/repos/asf/cordova-coho/diff/8e4dae80
Branch: refs/heads/master
Commit: 8e4dae8056ed5cf2471cdff1888d4aef64c88b9c
Parents: 55267d6
Author: Steve Gill <st...@gmail.com>
Authored: Fri Oct 31 15:40:29 2014 -0700
Committer: Steve Gill <st...@gmail.com>
Committed: Fri Oct 31 18:25:00 2014 -0700
----------------------------------------------------------------------
src/nightly.js | 8 +++++---
src/npm-publish.js | 11 +++++++----
2 files changed, 12 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-coho/blob/8e4dae80/src/nightly.js
----------------------------------------------------------------------
diff --git a/src/nightly.js b/src/nightly.js
index dbc25ce..542db5b 100644
--- a/src/nightly.js
+++ b/src/nightly.js
@@ -112,9 +112,11 @@ module.exports = function*(argv) {
yield runTests(cli, cordovaLib);
//publish to npm under nightly tag
- argv.tag = 'nightly';
- argv.r = ['lib', 'cli'];
- yield npmpublish.publishTag(argv);
+ var options = {};
+ options.tag = 'nightly';
+ options.r = ['lib', 'cli'];
+ optoins.pretend = argv.pretend;
+ yield npmpublish.publishTag(options);
}
//updates platforms.js with the SHA
http://git-wip-us.apache.org/repos/asf/cordova-coho/blob/8e4dae80/src/npm-publish.js
----------------------------------------------------------------------
diff --git a/src/npm-publish.js b/src/npm-publish.js
index d266290..7031b84 100644
--- a/src/npm-publish.js
+++ b/src/npm-publish.js
@@ -24,17 +24,20 @@ var repoutil = require('./repoutil');
var executil = require('./executil');
var print = apputil.print;
-exports.publishTag = function*(argv) {
+exports.publishTag = function*(options) {
var opt = flagutil.registerHelpFlag(optimist);
//argv was passed through another function, set defaults to appease demand.
- if(argv) {
+ if(options) {
opt = opt
.options('tag', {
- default:argv.tag
+ default:options.tag
})
.options('r', {
- default:argv.r
+ default:options.r
+ })
+ .options('pretend', {
+ default:options.pretend
})
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[2/6] git commit: CB-7904 added npm-link step
Posted by st...@apache.org.
CB-7904 added npm-link step
Project: http://git-wip-us.apache.org/repos/asf/cordova-coho/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-coho/commit/55267d6c
Tree: http://git-wip-us.apache.org/repos/asf/cordova-coho/tree/55267d6c
Diff: http://git-wip-us.apache.org/repos/asf/cordova-coho/diff/55267d6c
Branch: refs/heads/master
Commit: 55267d6c1fbc7171009d11bfc2143a63cbf61e2c
Parents: 32d74c6
Author: Steve Gill <st...@gmail.com>
Authored: Fri Oct 31 12:48:26 2014 -0700
Committer: Steve Gill <st...@gmail.com>
Committed: Fri Oct 31 18:25:00 2014 -0700
----------------------------------------------------------------------
src/nightly.js | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-coho/blob/55267d6c/src/nightly.js
----------------------------------------------------------------------
diff --git a/src/nightly.js b/src/nightly.js
index 45ec1a2..dbc25ce 100644
--- a/src/nightly.js
+++ b/src/nightly.js
@@ -28,6 +28,7 @@ var versionutil = require('./versionutil');
var gitutil = require('./gitutil');
var fs = require('fs');
var path = require('path');
+var npmlink = require('./npm-link');
module.exports = function*(argv) {
var repos = flagutil.computeReposFromFlag('nightly');
@@ -104,8 +105,10 @@ module.exports = function*(argv) {
});
});
+ //npm link repos that should be linked
+ yield npmlink();
+
//run CLI + cordova-lib tests
- //TODO: Link cli to use local lib (done on my machine, need to automate this for others)
yield runTests(cli, cordovaLib);
//publish to npm under nightly tag
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[4/6] git commit: CB-7904 Added nightly command to build nightly
releases
Posted by st...@apache.org.
CB-7904 Added nightly command to build nightly releases
Project: http://git-wip-us.apache.org/repos/asf/cordova-coho/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-coho/commit/304e0548
Tree: http://git-wip-us.apache.org/repos/asf/cordova-coho/tree/304e0548
Diff: http://git-wip-us.apache.org/repos/asf/cordova-coho/diff/304e0548
Branch: refs/heads/master
Commit: 304e054803be7e468dfbb1ec0a369d12a01fc615
Parents: d49c9d1
Author: Steve Gill <st...@gmail.com>
Authored: Wed Oct 29 22:02:20 2014 -0700
Committer: Steve Gill <st...@gmail.com>
Committed: Fri Oct 31 18:25:00 2014 -0700
----------------------------------------------------------------------
package.json | 2 +-
src/executil.js | 18 +++++--
src/gitutil.js | 4 +-
src/main.js | 4 ++
src/nightly.js | 124 ++++++++++++++++++++++++++++++++++++------------
src/npm-publish.js | 77 ++++++++++++++++++++++++++++++
src/repoutil.js | 11 ++++-
src/versionutil.js | 24 ++++++++++
8 files changed, 227 insertions(+), 37 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-coho/blob/304e0548/package.json
----------------------------------------------------------------------
diff --git a/package.json b/package.json
index cdb4efe..babb812 100644
--- a/package.json
+++ b/package.json
@@ -10,11 +10,11 @@
"chalk": "~0.4",
"co": "~3.0",
"gnode": "^0.1.0",
+ "nlf": "1.1.0",
"optimist": "0.4",
"q": "~0.9",
"request": "2.22.0",
"shelljs": "0.1.4",
- "nlf": "1.1.0",
"treeify": "1.0.1"
},
"repository": {
http://git-wip-us.apache.org/repos/asf/cordova-coho/blob/304e0548/src/executil.js
----------------------------------------------------------------------
diff --git a/src/executil.js b/src/executil.js
index 1a83630..301f007 100644
--- a/src/executil.js
+++ b/src/executil.js
@@ -23,19 +23,20 @@ var print = apputil.print;
var gitCommitCount = 0;
-exports.ARGS = function(s, var_args) {
+function ARGS(s, var_args) {
var ret = s.trim().split(/\s+/);
for (var i = 1; i < arguments.length; ++i) {
ret.push(arguments[i]);
}
return ret;
}
+exports.ARGS = ARGS;
// silent = false ==> print command and output
// silent == true or 1 ==> don't print command, don't print output
// silent == 2 ==> don't print command, print output
// silent == 3 ==> print command, don't print output
-exports.execHelper = function(cmdAndArgs, silent, allowError) {
+function execHelper(cmdAndArgs, silent, allowError) {
// there are times where we want silent but not allowError.
if (null == allowError) {
// default to allow failure if being silent.
@@ -58,8 +59,9 @@ exports.execHelper = function(cmdAndArgs, silent, allowError) {
process.exit(2);
});
}
+exports.execHelper = execHelper;
-exports.reportGitPushResult = function(repos, branches) {
+function reportGitPushResult(repos, branches) {
print('');
if (gitCommitCount) {
var flagsStr = repos.map(function(r) { return '-r ' + r.id; }).join(' ') + ' ' + branches.map(function(b) { return '-b ' + b; }).join(' ');
@@ -75,3 +77,13 @@ exports.reportGitPushResult = function(repos, branches) {
}
}
+exports.reportGitPushResult = reportGitPushResult;
+
+function *execOrPretend(cmd, pretend) {
+ if (pretend) {
+ print('PRETENDING TO RUN: ' + cmd.join(' '));
+ } else {
+ return yield execHelper(cmd);
+ }
+}
+exports.execOrPretend = execOrPretend;
http://git-wip-us.apache.org/repos/asf/cordova-coho/blob/304e0548/src/gitutil.js
----------------------------------------------------------------------
diff --git a/src/gitutil.js b/src/gitutil.js
index 91e4b86..907292f 100644
--- a/src/gitutil.js
+++ b/src/gitutil.js
@@ -90,4 +90,6 @@ exports.hashForRef = function(ref) {
return executil.execHelper(executil.ARGS('git rev-parse', ref), true, true);
};
-
+exports.resetFromOrigin = function() {
+ return executil.execHelper(executil.ARGS('git reset --hard origin/master'), false, true);
+}
http://git-wip-us.apache.org/repos/asf/cordova-coho/blob/304e0548/src/main.js
----------------------------------------------------------------------
diff --git a/src/main.js b/src/main.js
index 27edd74..6b4c037 100644
--- a/src/main.js
+++ b/src/main.js
@@ -129,6 +129,10 @@ module.exports = function() {
name: 'nightly',
desc: 'Builds and publishes nightly builds of cordova-cli using the latest commits for each platform.',
entryPoint: lazyRequire('./nightly')
+ }, {
+ name:'npm-publish-tag',
+ desc: 'Publishes current version of repo to specified tag',
+ entryPoint: lazyRequire('./npm-publish', 'publishTag')
}
];
var commandMap = {};
http://git-wip-us.apache.org/repos/asf/cordova-coho/blob/304e0548/src/nightly.js
----------------------------------------------------------------------
diff --git a/src/nightly.js b/src/nightly.js
index c63d50a..3de5f10 100644
--- a/src/nightly.js
+++ b/src/nightly.js
@@ -17,48 +17,109 @@ specific language governing permissions and limitations
under the License.
*/
-var optimist = require('optimist');
-var apputil = require('./apputil');
var executil = require('./executil');
+var optimist = require('optimist');
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 npmpublish = require('./npm-publish');
+var versionutil = require('./versionutil');
+var gitutil = require('./gitutil');
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, []);
+module.exports = function*(argv) {
+ var repos = flagutil.computeReposFromFlag('nightly');
+ var cli = repoutil.getRepoById('cli');
+ var cordovaLib = repoutil.getRepoById('lib');
+ var opt = flagutil.registerHelpFlag(optimist);
- var SHAJSON = yield retrieveSha(repos);
+ argv = opt
+ .usage('Publish CLI & LIB to NPM under nightly tag. \n' +
+ 'Cordova platform add uses latest commits to the platforms. \n' +
+ 'Usage: $0 nightly'
+ )
+ .options('pretend', {
+ desc: 'Don\'t actually publish to npm, just print what would be run.',
+ type:'boolean'
+ })
+ .argv;
+
+ if(argv.h) {
+ optimist.showHelp();
+ process.exit(1);
+ }
- //console.log(SHAJSON['android']);
+ //Update Repos
+ yield repoupdate.updateRepos(repos);
+
+ //Remove any local changes for cli & lib
+ yield repoutil.forEachRepo([cordovaLib, cli], function*() {
+ gitutil.resetFromOrigin();
+ });
+
+ //get SHAS from platforms
+ var SHAJSON = yield retrieveSha(repos);
+
//save SHAJSON in cordova-cli repo
+ yield repoutil.forEachRepo([cli], function*() {
+ //need to get the path to cordova-cli using executil
+ var cordovaclidir = yield executil.execHelper(executil.ARGS('pwd'), true, true);
+ fs.writeFile((path.join(cordovaclidir, 'shas.json')), JSON.stringify(SHAJSON, null, 4), 'utf8', function(err) {
+ if (err) return console.log (err);
+ });
- //Update platforms at cordova-lib/src/cordova/platforms.js
- //console.log(repos);
- var cordovaLib = repoutil.getRepoById('lib');
- //Need to run forEachRepo
+ });
+
+ //Update platform references at cordova-lib/src/cordova/platformsConfig.json
+ var cordovalibdir;
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);
+ cordovalibdir = yield executil.execHelper(executil.ARGS('pwd'), true, true);
});
+ yield updatePlatformsFile(path.join(cordovalibdir, 'src/cordova/platformsConfig.json'), SHAJSON);
+
+
+ var currentDate = new Date();
+ var nightlyVersion = '-nightly.' + currentDate.getFullYear() + '.' +
+ currentDate.getMonth() + '.' + currentDate.getDate();
+ var cordovaLibVersion;
+ //update package.json version for cli + lib, update lib reference for cli
+ yield repoutil.forEachRepo([cordovaLib, cli], function*(repo) {
+ var dir = yield executil.execHelper(executil.ARGS('pwd'), true, true);
+ var packageJSON = require(dir+'/package.json');
+ packageJSON.version = versionutil.removeDev(packageJSON.version) + nightlyVersion;
+
+ if(repo.id === 'lib'){
+ cordovaLibVersion = packageJSON.version;
+ } else {
+ packageJSON.dependencies['cordova-lib'] = cordovaLibVersion;
+ }
+
+ fs.writeFile(dir+'/package.json', JSON.stringify(packageJSON, null, 4), 'utf8', function(err) {
+ if (err) return console.log (err);
+ });
+ });
+
+ //run CLI + cordova-lib tests
+ //TODO: Link cli to use local lib (done on my machine, need to automate this for others)
+ yield runTests(cli, cordovaLib);
+
+ //publish to npm under nightly tag
+ argv.tag = 'nightly';
+ argv.r = ['lib', 'cli'];
+ yield npmpublish.publishTag(argv);
}
//updates platforms.js with the SHA
-function *updatePlatformsFile(file, shajson){
- platformsJS = require(file);
- var repos = flagutil.computeReposFromFlag('active-platform');
- //console.log(platformsJS);
+function *updatePlatformsFile(file, shajson) {
+ var platformsJS = require(file);
+
+ var repos = flagutil.computeReposFromFlag('active-platform');
+
yield repoutil.forEachRepo(repos, function*(repo) {
- console.log(repo);
if(repo.id === 'windowsphone'){
platformsJS['wp8'].version = shajson[repo.id];
} else if(repo.id === 'windows') {
@@ -71,16 +132,17 @@ function *updatePlatformsFile(file, shajson){
}
});
- 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) {
+ fs.writeFile(file, JSON.stringify(platformsJS, null, 4), 'utf8', function(err) {
if (err) return console.log (err);
});
-
- });
}
+function *runTests(cli, lib) {
+ yield repoutil.forEachRepo([cli, lib], function *(repo) {
+ if (repo.id === 'lib'){
+ yield executil.execHelper(executil.ARGS('npm test'), false, false);
+ } else {
+ yield executil.execHelper(executil.ARGS('npm test'), false, false);
+ }
+ });
+}
http://git-wip-us.apache.org/repos/asf/cordova-coho/blob/304e0548/src/npm-publish.js
----------------------------------------------------------------------
diff --git a/src/npm-publish.js b/src/npm-publish.js
new file mode 100644
index 0000000..d266290
--- /dev/null
+++ b/src/npm-publish.js
@@ -0,0 +1,77 @@
+/*
+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 flagutil = require('./flagutil');
+var repoutil = require('./repoutil');
+var executil = require('./executil');
+var print = apputil.print;
+
+exports.publishTag = function*(argv) {
+ var opt = flagutil.registerHelpFlag(optimist);
+
+ //argv was passed through another function, set defaults to appease demand.
+ if(argv) {
+ opt = opt
+ .options('tag', {
+ default:argv.tag
+ })
+ .options('r', {
+ default:argv.r
+ })
+ }
+
+ argv = opt
+ .usage('Publishes current version of a repo to a specified npm tag. \n' +
+ 'Usage: $0 npm-publish --tag rc -r cli -r lib')
+ .options('tag', {
+ desc: 'Which npm tag to publish to',
+ demand: true
+ })
+ .options('r', {
+ alias: 'repos',
+ desc: 'Which repo(s) to publish',
+ demand:true
+ })
+ .options('pretend', {
+ desc: 'Don\'t actually run commands, just print what would be run.',
+ type:'boolean'
+ })
+ .argv;
+
+ if(argv.h) {
+ optimist.showHelp();
+ process.exit(1);
+ }
+
+ var repos = flagutil.computeReposFromFlag(argv.r);
+
+ //npm publish --tag argv.tag
+ yield repoutil.forEachRepo(repos, function*(repo) {
+ yield executil.execOrPretend(executil.ARGS('npm publish --tag ' + argv.tag), argv.pretend);
+ //yield executil.execOrPretend(executil.ARGS('ls'), argv.pretend);
+ });
+}
+
+//TODO: Does npm tag cordova-js*.tgz latest
+exports.setLatest = function *(argv) {
+
+
+}
http://git-wip-us.apache.org/repos/asf/cordova-coho/blob/304e0548/src/repoutil.js
----------------------------------------------------------------------
diff --git a/src/repoutil.js b/src/repoutil.js
index ae92cec..b08cb5a 100644
--- a/src/repoutil.js
+++ b/src/repoutil.js
@@ -450,14 +450,23 @@ exports.forEachRepo = function*(repos, func) {
var newPath = isInForEachRepoFunction ? path.join('..', repo.repoName) : repo.repoName;
isInForEachRepoFunction = true;
+
+ if(repo.id === 'lib'){
+ newPath = newPath + '/cordova-lib'
+ }
shelljs.cd(newPath);
+
if (shelljs.error()) {
apputil.fatal('Repo directory does not exist: ' + repo.repoName + '. First run coho repo-clone.');
}
yield func(repo);
+
+ if(repo.id === 'lib'){
+ origPath = origPath + '/..';
+ }
shelljs.cd(origPath);
- isInForEachRepoFunction = origPath != '..';
+ isInForEachRepoFunction = !((origPath === '..')||(origPath === '../..'));
}
}
http://git-wip-us.apache.org/repos/asf/cordova-coho/blob/304e0548/src/versionutil.js
----------------------------------------------------------------------
diff --git a/src/versionutil.js b/src/versionutil.js
new file mode 100644
index 0000000..810a458
--- /dev/null
+++ b/src/versionutil.js
@@ -0,0 +1,24 @@
+/*
+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.
+*/
+
+function removeDev(version) {
+ var newVersion = version.replace('-dev', '');
+ return newVersion;
+}
+exports.removeDev = removeDev;
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[3/6] git commit: added initial work to build nightly,
updating platforms.js file in cordova-lib
Posted by st...@apache.org.
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 <st...@gmail.com>
Authored: Thu Oct 23 17:51:16 2014 -0700
Committer: Steve Gill <st...@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
[5/6] git commit: CB-7904 incorporated feedback from comments on PR
Posted by st...@apache.org.
CB-7904 incorporated feedback from comments on PR
Project: http://git-wip-us.apache.org/repos/asf/cordova-coho/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-coho/commit/32d74c65
Tree: http://git-wip-us.apache.org/repos/asf/cordova-coho/tree/32d74c65
Diff: http://git-wip-us.apache.org/repos/asf/cordova-coho/diff/32d74c65
Branch: refs/heads/master
Commit: 32d74c651fd300a0d78cf2e4e2ab77d1127f0cba
Parents: 304e054
Author: Steve Gill <st...@gmail.com>
Authored: Thu Oct 30 15:55:05 2014 -0700
Committer: Steve Gill <st...@gmail.com>
Committed: Fri Oct 31 18:25:00 2014 -0700
----------------------------------------------------------------------
src/gitutil.js | 4 ++++
src/nightly.js | 29 +++++++++++++----------------
src/repoutil.js | 7 +++----
3 files changed, 20 insertions(+), 20 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-coho/blob/32d74c65/src/gitutil.js
----------------------------------------------------------------------
diff --git a/src/gitutil.js b/src/gitutil.js
index 907292f..3296b62 100644
--- a/src/gitutil.js
+++ b/src/gitutil.js
@@ -93,3 +93,7 @@ exports.hashForRef = function(ref) {
exports.resetFromOrigin = function() {
return executil.execHelper(executil.ARGS('git reset --hard origin/master'), false, true);
}
+
+exports.gitClean = function() {
+ return executil.execHelper(executil.ARGS('git clean -d -f'), false, true);
+}
http://git-wip-us.apache.org/repos/asf/cordova-coho/blob/32d74c65/src/nightly.js
----------------------------------------------------------------------
diff --git a/src/nightly.js b/src/nightly.js
index 3de5f10..45ec1a2 100644
--- a/src/nightly.js
+++ b/src/nightly.js
@@ -53,20 +53,21 @@ module.exports = function*(argv) {
//Update Repos
yield repoupdate.updateRepos(repos);
-
- //Remove any local changes for cli & lib
- yield repoutil.forEachRepo([cordovaLib, cli], function*() {
- gitutil.resetFromOrigin();
- });
-
+
+ //remove local changes and sync up with remote master
+ yield repoutil.forEachRepo(repos, function*() {
+ yield gitutil.gitClean();
+ yield gitutil.resetFromOrigin();
+ })
+
//get SHAS from platforms
var SHAJSON = yield retrieveSha(repos);
//save SHAJSON in cordova-cli repo
yield repoutil.forEachRepo([cli], function*() {
//need to get the path to cordova-cli using executil
- var cordovaclidir = yield executil.execHelper(executil.ARGS('pwd'), true, true);
- fs.writeFile((path.join(cordovaclidir, 'shas.json')), JSON.stringify(SHAJSON, null, 4), 'utf8', function(err) {
+ var cordovaclidir = process.cwd();
+ fs.writeFileSync((path.join(cordovaclidir, 'shas.json')), JSON.stringify(SHAJSON, null, 4), 'utf8', function(err) {
if (err) return console.log (err);
});
@@ -76,7 +77,7 @@ module.exports = function*(argv) {
var cordovalibdir;
yield repoutil.forEachRepo([cordovaLib], function*() {
//need to get the path to cordova-lib using executil
- cordovalibdir = yield executil.execHelper(executil.ARGS('pwd'), true, true);
+ cordovalibdir = process.cwd();
});
yield updatePlatformsFile(path.join(cordovalibdir, 'src/cordova/platformsConfig.json'), SHAJSON);
@@ -88,7 +89,7 @@ module.exports = function*(argv) {
var cordovaLibVersion;
//update package.json version for cli + lib, update lib reference for cli
yield repoutil.forEachRepo([cordovaLib, cli], function*(repo) {
- var dir = yield executil.execHelper(executil.ARGS('pwd'), true, true);
+ var dir = process.cwd();
var packageJSON = require(dir+'/package.json');
packageJSON.version = versionutil.removeDev(packageJSON.version) + nightlyVersion;
@@ -98,7 +99,7 @@ module.exports = function*(argv) {
packageJSON.dependencies['cordova-lib'] = cordovaLibVersion;
}
- fs.writeFile(dir+'/package.json', JSON.stringify(packageJSON, null, 4), 'utf8', function(err) {
+ fs.writeFileSync(dir+'/package.json', JSON.stringify(packageJSON, null, 4), 'utf8', function(err) {
if (err) return console.log (err);
});
});
@@ -132,17 +133,13 @@ function *updatePlatformsFile(file, shajson) {
}
});
- fs.writeFile(file, JSON.stringify(platformsJS, null, 4), 'utf8', function(err) {
+ fs.writeFileSync(file, JSON.stringify(platformsJS, null, 4), 'utf8', function(err) {
if (err) return console.log (err);
});
}
function *runTests(cli, lib) {
yield repoutil.forEachRepo([cli, lib], function *(repo) {
- if (repo.id === 'lib'){
yield executil.execHelper(executil.ARGS('npm test'), false, false);
- } else {
- yield executil.execHelper(executil.ARGS('npm test'), false, false);
- }
});
}
http://git-wip-us.apache.org/repos/asf/cordova-coho/blob/32d74c65/src/repoutil.js
----------------------------------------------------------------------
diff --git a/src/repoutil.js b/src/repoutil.js
index b08cb5a..69ef3d2 100644
--- a/src/repoutil.js
+++ b/src/repoutil.js
@@ -451,8 +451,10 @@ exports.forEachRepo = function*(repos, func) {
isInForEachRepoFunction = true;
+ //cordova-lib lives inside of a top level cordova-lib directory
if(repo.id === 'lib'){
- newPath = newPath + '/cordova-lib'
+ newPath = newPath + '/cordova-lib';
+ origPath = origPath + '/..';
}
shelljs.cd(newPath);
@@ -461,9 +463,6 @@ exports.forEachRepo = function*(repos, func) {
}
yield func(repo);
- if(repo.id === 'lib'){
- origPath = origPath + '/..';
- }
shelljs.cd(origPath);
isInForEachRepoFunction = !((origPath === '..')||(origPath === '../..'));
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[6/6] git commit: CB-7904 fixed spelling error
Posted by st...@apache.org.
CB-7904 fixed spelling error
Project: http://git-wip-us.apache.org/repos/asf/cordova-coho/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-coho/commit/ab0bbd2d
Tree: http://git-wip-us.apache.org/repos/asf/cordova-coho/tree/ab0bbd2d
Diff: http://git-wip-us.apache.org/repos/asf/cordova-coho/diff/ab0bbd2d
Branch: refs/heads/master
Commit: ab0bbd2d7096049feda949442e5be23f5bc08e51
Parents: 8e4dae8
Author: Steve Gill <st...@gmail.com>
Authored: Fri Oct 31 17:04:42 2014 -0700
Committer: Steve Gill <st...@gmail.com>
Committed: Fri Oct 31 18:25:01 2014 -0700
----------------------------------------------------------------------
src/nightly.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-coho/blob/ab0bbd2d/src/nightly.js
----------------------------------------------------------------------
diff --git a/src/nightly.js b/src/nightly.js
index 542db5b..6cd6e74 100644
--- a/src/nightly.js
+++ b/src/nightly.js
@@ -115,7 +115,7 @@ module.exports = function*(argv) {
var options = {};
options.tag = 'nightly';
options.r = ['lib', 'cli'];
- optoins.pretend = argv.pretend;
+ options.pretend = argv.pretend;
yield npmpublish.publishTag(options);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org