cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fil...@apache.org
Subject [32/35] cordova-coho git commit: dont use xml2js xml writer as we lose comments. instead, use sed to rewrite the plugin.xml versions.
Date Wed, 26 Apr 2017 01:04:27 GMT
dont use xml2js xml writer as we lose comments. instead, use sed to rewrite the plugin.xml
versions.


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

Branch: refs/heads/master
Commit: 52abc1622d1a0057e39096d82910e5f3abb3c0ab
Parents: e7051aa
Author: filmaj <maj.fil@gmail.com>
Authored: Wed Mar 1 15:46:55 2017 -0800
Committer: filmaj <maj.fil@gmail.com>
Committed: Tue Apr 25 17:28:08 2017 -0700

----------------------------------------------------------------------
 src/versionutil.js | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-coho/blob/52abc162/src/versionutil.js
----------------------------------------------------------------------
diff --git a/src/versionutil.js b/src/versionutil.js
index cbb8e99..5937684 100644
--- a/src/versionutil.js
+++ b/src/versionutil.js
@@ -152,11 +152,8 @@ exports.updateRepoVersion = function *updateRepoVersion(repo, version,
opts) {
                     if (err) throw err;
                     xml2js.parseString(data, function(err, xml) {
                         if (err) throw err;
-                        xml.plugin['$'].version = version;
-                        // TODO: writing out the xml in this way causes us to lose the comments,
which means we lose the apache license header :(
-                        var xmlWriter = new xml2js.Builder();
-                        var xmlOutput = xmlWriter.buildObject(xml);
-                        fs.writeFileSync(xmlFile, xmlOutput + '\n');
+                        var prev_version = xml.plugin['$'].version;
+                        shelljs.sed('-i', new RegExp('version="' + prev_version + '"','i'),
'version="' + version + '"', xmlFile);
                     });
                 });
             } else {


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


Mime
View raw message