@@ -733,27 +733,29 @@ Start.initCordovaNoCli = function initCordova(options, appSetup) {
733733} ;
734734
735735Start . 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
820822Start . updateConfigXml = function ( targetPath , packageName , appName ) {
821823 var q = Q . defer ( ) ;
0 commit comments