Skip to content
This repository was archived by the owner on Jan 6, 2023. It is now read-only.

Commit 1ad2da0

Browse files
committed
fix(start): fixed issue where cordova install test did not account for promise.
1 parent fed9573 commit 1ad2da0

3 files changed

Lines changed: 21 additions & 19 deletions

File tree

lib/start.js

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -733,27 +733,29 @@ Start.initCordovaNoCli = function initCordova(options, appSetup) {
733733
};
734734

735735
Start.initCordova = function(options, appSetup) {
736-
var q;
737-
try {
738-
if (!options.isCordovaProject) {
739-
log.info('not a cordova project, no cordova options to initialize');
740-
return Q.resolve();
741-
}
742-
743-
Hooks.setHooksPermission(options.targetPath);
744-
745-
log.info('\nAdding initial native plugins');
736+
if (!options.isCordovaProject) {
737+
log.info('not a cordova project, no cordova options to initialize');
738+
return Q.resolve();
739+
}
740+
741+
Hooks.setHooksPermission(options.targetPath);
746742

747-
appSetup.bower = appSetup.bower ? appSetup.bower : [];
743+
log.info('\nAdding initial native plugins');
748744

749-
if (!Utils.cordovaInstalled()) {
745+
appSetup.bower = appSetup.bower ? appSetup.bower : [];
750746

751-
// console.log('utils cordova not installed');
747+
return Utils.cordovaInstalled().then(function(isCordovaInstalled) {
748+
if (isCordovaInstalled) {
752749
return Start.initCordovaNoCli(options, appSetup);
753750
}
751+
return rInitCordova(options, appSetup);
752+
});
753+
};
754754

755-
q = Q.defer();
755+
function rInitCordova(options, appSetup) {
756+
var q = Q.defer();
756757

758+
try {
757759
var cmds = [];
758760

759761
// add plugins
@@ -815,7 +817,7 @@ Start.initCordova = function(options, appSetup) {
815817
}
816818

817819
return q.promise;
818-
};
820+
}
819821

820822
Start.updateConfigXml = function(targetPath, packageName, appName) {
821823
var q = Q.defer();

lib/utils.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -313,10 +313,10 @@ Utils.gulpInstalledGlobally = function gulpInstalledGlobally() {
313313

314314
Utils.cordovaInstalled = function cordovaInstalled() {
315315
var Info = require('./info');
316-
var info = {};
317-
Info.getCordovaInfo(info);
318316

319-
return info.cordova !== 'Not installed';
317+
return Info.gatherInfo().then(function(info) {
318+
return info.cordova !== 'Not installed';
319+
});
320320
};
321321

322322
Utils.findIonicRoot = function findIonicRoot(dir) {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ionic-app-lib",
3-
"version": "2.1.3",
3+
"version": "2.1.4",
44
"description": "A library for creating and developing Ionic Framework mobile apps.",
55
"homepage": "http://ionicframework.com/",
66
"main": "index.js",

0 commit comments

Comments
 (0)