-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a7296e9
commit 65ece13
Showing
5 changed files
with
66 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,6 +52,7 @@ | |
<icon src="res/icon/ios/[email protected]" width="87" /> | ||
<splash src="res/screen/ios/Default@2x~universal~anyany.png" /> | ||
</platform> | ||
<hook src="scripts/changeVersion.js" type="before_prepare" /> | ||
<plugin name="cordova-plugin-whitelist" spec="^1.3.3" /> | ||
<plugin name="cordova-plugin-geolocation" spec="^4.0.1" /> | ||
<plugin name="cordova-plugin-camera" spec="^4.0.3" /> | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
module.exports = function(ctx) { | ||
var configXmlHelper = require('./configXmlHelper'); | ||
|
||
var configXml = configXmlHelper.readConfigXML(); | ||
var widget = configXml.getElementsByTagName("widget")[0]; | ||
|
||
var version = widget.getAttribute("version"); | ||
var androidVersionCode = widget.getAttribute("android-versionCode"); | ||
var iosCFBundleVersion = widget.getAttribute("ios-CFBundleVersion"); | ||
|
||
var versionSplit = version.split("."); | ||
versionSplit[2] = parseInt(process.env.TRAVIS_BUILD_NUMBER || "0"); | ||
|
||
var newAndroidVersionCode = versionSplit[0] * 10000000 + versionSplit[1] * 10000 + versionSplit[2]; | ||
var newVersion = versionSplit.join("."); | ||
var newIosCFBundleVersion = newVersion; | ||
|
||
console.log("Version:", version); | ||
console.log("android-versionCode:", androidVersionCode); | ||
console.log("ios-CFBundleVersion:", iosCFBundleVersion); | ||
|
||
widget.setAttribute("version", newVersion); | ||
widget.setAttribute("ios-CFBundleVersion", newIosCFBundleVersion); | ||
widget.setAttribute("android-versionCode", newAndroidVersionCode); | ||
|
||
console.log("New Version:", widget.getAttribute("version")); | ||
console.log("New android-versionCode:", widget.getAttribute("android-versionCode")); | ||
console.log("New ios-CFBundleVersion:", widget.getAttribute("ios-CFBundleVersion")); | ||
|
||
configXmlHelper.writeConfigXML(configXml); | ||
}; | ||
|
||
if (!require.main.loaded) { | ||
module.exports({ | ||
cmdLine: process.argv.join(" ") | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
var filePath = "config.xml"; | ||
var xmldom = require('xmldom'); | ||
var fs = require('fs'); | ||
|
||
module.exports = { | ||
readConfigXML: function() { | ||
var DOMParser = xmldom.DOMParser; | ||
var xmlString = fs.readFileSync(filePath, "utf-8"); | ||
|
||
return new DOMParser().parseFromString(xmlString); | ||
}, | ||
|
||
writeConfigXML: function (configXml) { | ||
var XMLSerializer = xmldom.XMLSerializer; | ||
var xmlString = new XMLSerializer().serializeToString(configXml); | ||
|
||
fs.writeFileSync(filePath, xmlString, 'utf8'); | ||
} | ||
}; |