[ALOY-1332] Alloy.version does not match actual version
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | Medium |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2015-11-25T17:19:44.000+0000 |
| Affected Version/s | alloy 1.7.27 |
| Fix Version/s | Release 5.2.0, alloy 1.7.28 |
| Components | Runtime |
| Labels | n/a |
| Reporter | Fokke Zandbergen |
| Assignee | Feon Sua Xin Miao |
| Created | 2015-11-20T07:45:21.000+0000 |
| Updated | 2016-01-20T23:08:29.000+0000 |
Description
Alloy.version is [hard-coded](https://github.com/appcelerator/alloy/blob/master/Alloy/lib/alloy.js#L30) and not up to date with the actual version in [package.json](https://github.com/appcelerator/alloy/blob/master/package.json#L17).
For sample apps I need to check that the user is using a supported Alloy version, which because of this I can not.
I suggest we do a hacky RegEx replace [here](https://github.com/appcelerator/alloy/blob/master/Alloy/commands/compile/index.js#L164) or maybe better move [lib/alloy.js](https://github.com/appcelerator/alloy/blob/master/Alloy/lib/alloy.js) to the templates folder and properly replace a placeholder for the version with the one in package.json. That way we don't have to update the version in two places.
PR: https://github.com/appcelerator/alloy/pull/743 Functional Test: 1. Create a project 2. Print out
Alloy.versionfrom the controller, eg. index.js 3. The version should match package.json version.PR merged.
Verified fixed, using: MacOS 10.11.3 (15D21) Studio 4.4.0.201511241829 Ti SDK 5.2.0.v20160114021251 Appc NPM 4.2.3-1 Appc CLI 5.2.0-232 Alloy 1.7.33 Xcode 7.2 (7C68) Node v0.12.7 Java 1.7.0_80 Alloy.version now prints the correct version of the Alloy package. Used the provided steps to create and check a test case