You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ra...@apache.org on 2019/11/24 15:02:09 UTC
[cordova-coho] branch master updated: fix(versionutil): produce JS
that passes our linting (#253)
This is an automated email from the ASF dual-hosted git repository.
raphinesse pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cordova-coho.git
The following commit(s) were added to refs/heads/master by this push:
new 89fb5bc fix(versionutil): produce JS that passes our linting (#253)
89fb5bc is described below
commit 89fb5bc20215301281258c028884e5fe6011bafb
Author: Raphael von der GrĂ¼n <ra...@gmail.com>
AuthorDate: Sun Nov 24 16:02:01 2019 +0100
fix(versionutil): produce JS that passes our linting (#253)
We have recently started to lint as many JS files as possible. This includes the platforms' version scripts. Unfortunately coho updates them in a form that violates our code style.
This commit:
- pulls out the code to update our platforms' version scripts to one location
- has coho update the version script according to our style guide
---
src/versionutil.js | 17 ++++++-----------
1 file changed, 6 insertions(+), 11 deletions(-)
diff --git a/src/versionutil.js b/src/versionutil.js
index 364f7ca..16ba598 100644
--- a/src/versionutil.js
+++ b/src/versionutil.js
@@ -19,6 +19,7 @@ under the License.
var fs = require('fs');
var path = require('path');
+var glob = require('glob');
var shelljs = require('shelljs');
var xml2js = require('xml2js');
var apputil = require('./apputil');
@@ -97,26 +98,20 @@ exports.updateRepoVersion = function * updateRepoVersion (repo, version, opts) {
versionFilePaths.forEach(function (versionFilePath) {
fs.writeFileSync(versionFilePath, version + '\n');
});
+
shelljs.config.fatal = true;
+ glob.sync('{bin/,}template{s,}/{scripts/,}cordova/version').forEach(f => {
+ shelljs.sed('-i', /\bVERSION\s*=.+?;/, `VERSION = '${version}';`, f);
+ });
if (repo.id === 'android') {
shelljs.sed('-i', /CORDOVA_VERSION.*=.*;/, 'CORDOVA_VERSION = "' + version + '";', path.join('framework', 'src', 'org', 'apache', 'cordova', 'CordovaWebView.java'));
- shelljs.sed('-i', /VERSION.*=.*;/, 'VERSION = "' + version + '";', path.join('bin', 'templates', 'cordova', 'version'));
// Set build.gradle version, vcsTag, and name
shelljs.sed('-i', /version.*=.*/, "version = '" + version + "'", path.join('framework', 'build.gradle'));
shelljs.sed('-i', /vcsTag.*=.*/, "vcsTag = '" + version + "'", path.join('framework', 'build.gradle'));
shelljs.sed('-i', /version.{\n.*(name.*=.*)/, "version {\n name = '" + version + "'", path.join('framework', 'build.gradle'));
- } else if (repo.id === 'ios' || repo.id === 'osx') {
- shelljs.sed('-i', /VERSION.*=.*/, 'VERSION="' + version + '";', path.join('bin', 'templates', 'scripts', 'cordova', 'version'));
- } else if (repo.id === 'windows') {
- if (fs.existsSync(path.join('template', 'cordova', 'version'))) {
- shelljs.sed('-i', /VERSION.*=.*;/, 'VERSION = "' + version + '";', path.join('template', 'cordova', 'version'));
- }
- } else if (repo.id === 'browser' || repo.id === 'electron') {
- if (fs.existsSync(path.join('bin', 'template', 'cordova', 'version'))) {
- shelljs.sed('-i', /VERSION.*=.*;/, 'VERSION = "' + version + '";', path.join('bin', 'template', 'cordova', 'version'));
- }
}
shelljs.config.fatal = false;
+
if (!(yield gitutil.pendingChangesExist())) {
apputil.print('VERSION file was already up-to-date.');
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org