Skip to content

Commit

Permalink
CB-9156 platform version grabbing supports custom paths
Browse files Browse the repository at this point in the history
  • Loading branch information
stevengill committed Jun 20, 2015
1 parent b08a012 commit 3e13d0a
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions tasks/compile.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,18 @@ module.exports = function(grunt) {
if (flag.indexOf(platformName) > -1) {
var equalIndex = flag.indexOf('=');
platformPath = flag.slice(equalIndex + 1);
console.log(platformPath);
}
});
if(!platformVersion) {
var platformPkgJson;
//grab platformVersion from custom path
if(platformPath && fs.existsSync(platformPath)) {
platformPkgJson = require('../' + platformPath + '/package.json');
platformVersion = platformPkgJson.version;

//grab platformVersion from sibling platform directoreis
if(pkgJson['cordova-platforms']['cordova-'+platformName] && fs.existsSync(path.join(pkgJson['cordova-platforms']['cordova-'+platformName]))) {
var platformPkgJson = require('../' + pkgJson['cordova-platforms']['cordova-'+platformName]+'/package.json');
} else if(pkgJson['cordova-platforms']['cordova-'+platformName] && fs.existsSync(path.join(pkgJson['cordova-platforms']['cordova-'+platformName]))) {
platformPkgJson = require('../' + pkgJson['cordova-platforms']['cordova-'+platformName]+'/package.json');
platformVersion = platformPkgJson.version;
} else {
platformVersion="N/A";
Expand Down

0 comments on commit 3e13d0a

Please sign in to comment.