@@ -234,7 +234,6 @@ Api.prototype.prepare = function (cordovaProject) {
234234 */
235235Api . prototype . addPlugin = function ( plugin , installOptions ) {
236236 const xcodeproj = projectFile . parse ( this . locations ) ;
237- const self = this ;
238237
239238 installOptions = installOptions || { } ;
240239 installOptions . variables = installOptions . variables || { } ;
@@ -243,15 +242,15 @@ Api.prototype.addPlugin = function (plugin, installOptions) {
243242 installOptions . variables . PACKAGE_NAME = xcodeproj . getPackageName ( ) ;
244243 }
245244
246- return PluginManager . get ( self . platform , self . locations , xcodeproj )
245+ return PluginManager . get ( this . platform , this . locations , xcodeproj )
247246 . addPlugin ( plugin , installOptions )
248247 . then ( ( ) => {
249248 if ( plugin != null ) {
250- const headerTags = plugin . getHeaderFiles ( self . platform ) ;
249+ const headerTags = plugin . getHeaderFiles ( this . platform ) ;
251250 const bridgingHeaders = headerTags . filter ( obj => obj . type === 'BridgingHeader' ) ;
252251 if ( bridgingHeaders . length > 0 ) {
253- const project_dir = self . locations . root ;
254- const project_name = self . locations . xcodeCordovaProj . split ( '/' ) . pop ( ) ;
252+ const project_dir = this . locations . root ;
253+ const project_name = this . locations . xcodeCordovaProj . split ( '/' ) . pop ( ) ;
255254 const BridgingHeader = require ( './lib/BridgingHeader' ) . BridgingHeader ;
256255 const bridgingHeaderFile = new BridgingHeader ( path . join ( project_dir , project_name , 'Bridging-Header.h' ) ) ;
257256 events . emit ( 'verbose' , 'Adding Bridging-Headers since the plugin contained <header-file> with type="BridgingHeader"' ) ;
@@ -265,10 +264,10 @@ Api.prototype.addPlugin = function (plugin, installOptions) {
265264 } )
266265 . then ( ( ) => {
267266 if ( plugin != null ) {
268- const podSpecs = plugin . getPodSpecs ? plugin . getPodSpecs ( self . platform ) : [ ] ;
269- const frameworkTags = plugin . getFrameworks ( self . platform ) ;
267+ const podSpecs = plugin . getPodSpecs ? plugin . getPodSpecs ( this . platform ) : [ ] ;
268+ const frameworkTags = plugin . getFrameworks ( this . platform ) ;
270269 const frameworkPods = frameworkTags . filter ( obj => obj . type === 'podspec' ) ;
271- return self . addPodSpecs ( plugin , podSpecs , frameworkPods , installOptions ) ;
270+ return this . addPodSpecs ( plugin , podSpecs , frameworkPods , installOptions ) ;
272271 }
273272 } )
274273 // CB-11022 return non-falsy value to indicate
@@ -291,17 +290,16 @@ Api.prototype.addPlugin = function (plugin, installOptions) {
291290 */
292291Api . prototype . removePlugin = function ( plugin , uninstallOptions ) {
293292 const xcodeproj = projectFile . parse ( this . locations ) ;
294- const self = this ;
295293
296- return PluginManager . get ( self . platform , self . locations , xcodeproj )
294+ return PluginManager . get ( this . platform , this . locations , xcodeproj )
297295 . removePlugin ( plugin , uninstallOptions )
298296 . then ( ( ) => {
299297 if ( plugin != null ) {
300- const headerTags = plugin . getHeaderFiles ( self . platform ) ;
298+ const headerTags = plugin . getHeaderFiles ( this . platform ) ;
301299 const bridgingHeaders = headerTags . filter ( obj => obj . type === 'BridgingHeader' ) ;
302300 if ( bridgingHeaders . length > 0 ) {
303- const project_dir = self . locations . root ;
304- const project_name = self . locations . xcodeCordovaProj . split ( '/' ) . pop ( ) ;
301+ const project_dir = this . locations . root ;
302+ const project_name = this . locations . xcodeCordovaProj . split ( '/' ) . pop ( ) ;
305303 const BridgingHeader = require ( './lib/BridgingHeader' ) . BridgingHeader ;
306304 const bridgingHeaderFile = new BridgingHeader ( path . join ( project_dir , project_name , 'Bridging-Header.h' ) ) ;
307305 events . emit ( 'verbose' , 'Removing Bridging-Headers since the plugin contained <header-file> with type="BridgingHeader"' ) ;
@@ -315,10 +313,10 @@ Api.prototype.removePlugin = function (plugin, uninstallOptions) {
315313 } )
316314 . then ( ( ) => {
317315 if ( plugin != null ) {
318- const podSpecs = plugin . getPodSpecs ? plugin . getPodSpecs ( self . platform ) : [ ] ;
319- const frameworkTags = plugin . getFrameworks ( self . platform ) ;
316+ const podSpecs = plugin . getPodSpecs ? plugin . getPodSpecs ( this . platform ) : [ ] ;
317+ const frameworkTags = plugin . getFrameworks ( this . platform ) ;
320318 const frameworkPods = frameworkTags . filter ( obj => obj . type === 'podspec' ) ;
321- return self . removePodSpecs ( plugin , podSpecs , frameworkPods , uninstallOptions ) ;
319+ return this . removePodSpecs ( plugin , podSpecs , frameworkPods , uninstallOptions ) ;
322320 }
323321 } )
324322 // CB-11022 return non-falsy value to indicate
@@ -331,17 +329,15 @@ Api.prototype.removePlugin = function (plugin, uninstallOptions) {
331329 *
332330 * @param {PluginInfo } plugin A PluginInfo instance that represents plugin
333331 * that will be installed.
334- * @param {Object } podSpecs: the return value of plugin.getPodSpecs(self .platform)
332+ * @param {Object } podSpecs: the return value of plugin.getPodSpecs(this .platform)
335333 * @param {Object } frameworkPods: framework tags object with type === 'podspec'
336334 * @return {Promise } Return a promise
337335 */
338336
339337Api . prototype . addPodSpecs = function ( plugin , podSpecs , frameworkPods , installOptions ) {
340- const self = this ;
341-
342- const project_dir = self . locations . root ;
343- const project_name = self . locations . xcodeCordovaProj . split ( '/' ) . pop ( ) ;
344- const minDeploymentTarget = self . getPlatformInfo ( ) . projectConfig . getPreference ( 'deployment-target' , 'ios' ) ;
338+ const project_dir = this . locations . root ;
339+ const project_name = this . locations . xcodeCordovaProj . split ( '/' ) . pop ( ) ;
340+ const minDeploymentTarget = this . getPlatformInfo ( ) . projectConfig . getPreference ( 'deployment-target' , 'ios' ) ;
345341
346342 const Podfile = require ( './lib/Podfile' ) . Podfile ;
347343 const PodsJson = require ( './lib/PodsJson' ) . PodsJson ;
@@ -436,10 +432,10 @@ Api.prototype.addPodSpecs = function (plugin, podSpecs, frameworkPods, installOp
436432 if ( podfileFile . isDirty ( ) ) {
437433 podfileFile . write ( ) ;
438434 events . emit ( 'verbose' , 'Running `pod install` (to install plugins)' ) ;
439- projectFile . purgeProjectFileCache ( self . locations . root ) ;
435+ projectFile . purgeProjectFileCache ( this . locations . root ) ;
440436
441437 return podfileFile . install ( check_reqs . check_cocoapods )
442- . then ( ( ) => self . setSwiftVersionForCocoaPodsLibraries ( podsjsonFile ) ) ;
438+ . then ( ( ) => this . setSwiftVersionForCocoaPodsLibraries ( podsjsonFile ) ) ;
443439 } else {
444440 events . emit ( 'verbose' , 'Podfile unchanged, skipping `pod install`' ) ;
445441 }
@@ -452,16 +448,14 @@ Api.prototype.addPodSpecs = function (plugin, podSpecs, frameworkPods, installOp
452448 *
453449 * @param {PluginInfo } plugin A PluginInfo instance that represents plugin
454450 * that will be installed.
455- * @param {Object } podSpecs: the return value of plugin.getPodSpecs(self .platform)
451+ * @param {Object } podSpecs: the return value of plugin.getPodSpecs(this .platform)
456452 * @param {Object } frameworkPods: framework tags object with type === 'podspec'
457453 * @return {Promise } Return a promise
458454 */
459455
460456Api . prototype . removePodSpecs = function ( plugin , podSpecs , frameworkPods , uninstallOptions ) {
461- const self = this ;
462-
463- const project_dir = self . locations . root ;
464- const project_name = self . locations . xcodeCordovaProj . split ( '/' ) . pop ( ) ;
457+ const project_dir = this . locations . root ;
458+ const project_name = this . locations . xcodeCordovaProj . split ( '/' ) . pop ( ) ;
465459
466460 const Podfile = require ( './lib/Podfile' ) . Podfile ;
467461 const PodsJson = require ( './lib/PodsJson' ) . PodsJson ;
@@ -559,7 +553,7 @@ Api.prototype.removePodSpecs = function (plugin, podSpecs, frameworkPods, uninst
559553 events . emit ( 'verbose' , 'Running `pod install` (to uninstall pods)' ) ;
560554
561555 return podfileFile . install ( check_reqs . check_cocoapods )
562- . then ( ( ) => self . setSwiftVersionForCocoaPodsLibraries ( podsjsonFile ) ) ;
556+ . then ( ( ) => this . setSwiftVersionForCocoaPodsLibraries ( podsjsonFile ) ) ;
563557 } else {
564558 events . emit ( 'verbose' , 'Podfile unchanged, skipping `pod install`' ) ;
565559 }
@@ -574,13 +568,12 @@ Api.prototype.removePodSpecs = function (plugin, podSpecs, frameworkPods, uninst
574568 */
575569
576570Api . prototype . setSwiftVersionForCocoaPodsLibraries = function ( podsjsonFile ) {
577- const self = this ;
578571 let __dirty = false ;
579572 return check_reqs . check_cocoapods ( ) . then ( toolOptions => {
580573 if ( toolOptions . ignore ) {
581574 events . emit ( 'verbose' , '=== skip Swift Version Settings For Cocoapods Libraries' ) ;
582575 } else {
583- const podPbxPath = path . join ( self . root , 'Pods' , 'Pods.xcodeproj' , 'project.pbxproj' ) ;
576+ const podPbxPath = path . join ( this . root , 'Pods' , 'Pods.xcodeproj' , 'project.pbxproj' ) ;
584577 const podXcodeproj = xcode . project ( podPbxPath ) ;
585578 podXcodeproj . parseSync ( ) ;
586579 const podTargets = podXcodeproj . pbxNativeTargetSection ( ) ;
@@ -647,9 +640,8 @@ Api.prototype.setSwiftVersionForCocoaPodsLibraries = function (podsjsonFile) {
647640 * CordovaError instance.
648641 */
649642Api . prototype . build = function ( buildOptions ) {
650- const self = this ;
651643 return check_reqs . run ( )
652- . then ( ( ) => require ( './lib/build' ) . run . call ( self , buildOptions ) ) ;
644+ . then ( ( ) => require ( './lib/build' ) . run . call ( this , buildOptions ) ) ;
653645} ;
654646
655647/**
@@ -665,9 +657,8 @@ Api.prototype.build = function (buildOptions) {
665657 * successfully, or rejected with CordovaError.
666658 */
667659Api . prototype . run = function ( runOptions ) {
668- const self = this ;
669660 return check_reqs . run ( )
670- . then ( ( ) => require ( './lib/run' ) . run . call ( self , runOptions ) ) ;
661+ . then ( ( ) => require ( './lib/run' ) . run . call ( this , runOptions ) ) ;
671662} ;
672663
673664/**
@@ -677,10 +668,9 @@ Api.prototype.run = function (runOptions) {
677668 * CordovaError.
678669 */
679670Api . prototype . clean = function ( cleanOptions ) {
680- const self = this ;
681671 return check_reqs . run ( )
682- . then ( ( ) => require ( './lib/clean' ) . run . call ( self , cleanOptions ) )
683- . then ( ( ) => require ( './lib/prepare' ) . clean . call ( self , cleanOptions ) ) ;
672+ . then ( ( ) => require ( './lib/clean' ) . run . call ( this , cleanOptions ) )
673+ . then ( ( ) => require ( './lib/prepare' ) . clean . call ( this , cleanOptions ) ) ;
684674} ;
685675
686676/**
0 commit comments