@@ -24,7 +24,7 @@ const shell = require('shelljs');
24
24
const util = require ( 'util' ) ;
25
25
const versions = require ( './versions' ) ;
26
26
27
- const SUPPORTED_OS_PLATFORMS = [ 'darwin' ] ;
27
+ const SUPPORTED_OS_PLATFORMS = [ 'darwin' ] ;
28
28
29
29
const XCODEBUILD_MIN_VERSION = '9.0.0' ;
30
30
const XCODEBUILD_NOT_FOUND_MESSAGE =
@@ -63,9 +63,9 @@ module.exports.check_ios_deploy = function () {
63
63
64
64
module . exports . check_os = function ( ) {
65
65
// Build iOS apps available for OSX platform only, so we reject on others platforms
66
- return os_platform_is_supported ( ) ?
67
- Q . resolve ( process . platform ) :
68
- Q . reject ( 'Cordova tooling for iOS requires Apple macOS' ) ;
66
+ return os_platform_is_supported ( )
67
+ ? Q . resolve ( process . platform )
68
+ : Q . reject ( 'Cordova tooling for iOS requires Apple macOS' ) ;
69
69
} ;
70
70
71
71
function os_platform_is_supported ( ) {
@@ -78,8 +78,8 @@ function check_cocoapod_tool (toolChecker) {
78
78
return toolChecker ( 'pod' , COCOAPODS_MIN_VERSION , COCOAPODS_NOT_FOUND_MESSAGE , 'CocoaPods' ) ;
79
79
} else {
80
80
return Q . resolve ( {
81
- ' ignore' : true ,
82
- ' ignoreMessage' : `CocoaPods check and installation ignored on ${ process . platform } `
81
+ ignore : true ,
82
+ ignoreMessage : `CocoaPods check and installation ignored on ${ process . platform } `
83
83
} ) ;
84
84
}
85
85
}
@@ -92,10 +92,10 @@ module.exports.check_cocoapods_repo_size = function () {
92
92
return check_cocoapod_tool ( )
93
93
. then ( function ( toolOptions ) {
94
94
// check size of ~/.cocoapods repo
95
- let commandString = util . format ( 'du -sh %s/.cocoapods' , process . env . HOME ) ;
96
- let command = shell . exec ( commandString , { silent : true } ) ;
95
+ const commandString = util . format ( 'du -sh %s/.cocoapods' , process . env . HOME ) ;
96
+ const command = shell . exec ( commandString , { silent : true } ) ;
97
97
// command.output is e.g "750M path/to/.cocoapods", we just scan the number
98
- let size = toolOptions . ignore ? 0 : parseFloat ( command . output ) ;
98
+ const size = toolOptions . ignore ? 0 : parseFloat ( command . output ) ;
99
99
100
100
if ( toolOptions . ignore || command . code === 0 ) { // success, parse output
101
101
return Q . resolve ( size , toolOptions ) ;
@@ -128,8 +128,8 @@ module.exports.check_cocoapods = function (toolChecker) {
128
128
return toolOptions ;
129
129
}
130
130
131
- let code = shell . exec ( 'pod repo | grep -e "^0 repos"' , { silent : true } ) . code ;
132
- let repoIsSynced = ( code !== 0 ) ;
131
+ const code = shell . exec ( 'pod repo | grep -e "^0 repos"' , { silent : true } ) . code ;
132
+ const repoIsSynced = ( code !== 0 ) ;
133
133
134
134
if ( repoIsSynced ) {
135
135
// return check_cocoapods_repo_size();
@@ -153,17 +153,17 @@ function checkTool (tool, minVersion, message, toolFriendlyName) {
153
153
toolFriendlyName = toolFriendlyName || tool ;
154
154
155
155
// Check whether tool command is available at all
156
- let tool_command = shell . which ( tool ) ;
156
+ const tool_command = shell . which ( tool ) ;
157
157
if ( ! tool_command ) {
158
158
return Q . reject ( toolFriendlyName + ' was not found. ' + ( message || '' ) ) ;
159
159
}
160
160
161
161
// check if tool version is greater than specified one
162
162
return versions . get_tool_version ( tool ) . then ( function ( version ) {
163
163
version = version . trim ( ) ;
164
- return versions . compareVersions ( version , minVersion ) >= 0 ?
165
- Q . resolve ( { ' version' : version } ) :
166
- Q . reject ( 'Cordova needs ' + toolFriendlyName + ' version ' + minVersion +
164
+ return versions . compareVersions ( version , minVersion ) >= 0
165
+ ? Q . resolve ( { version : version } )
166
+ : Q . reject ( 'Cordova needs ' + toolFriendlyName + ' version ' + minVersion +
167
167
' or greater, you have version ' + version + '. ' + ( message || '' ) ) ;
168
168
} ) ;
169
169
}
@@ -175,7 +175,7 @@ function checkTool (tool, minVersion, message, toolFriendlyName) {
175
175
* @param {Boolean } isFatal Marks the requirement as fatal. If such requirement will fail
176
176
* next requirements' checks will be skipped.
177
177
*/
178
- let Requirement = function ( id , name , isFatal ) {
178
+ const Requirement = function ( id , name , isFatal ) {
179
179
this . id = id ;
180
180
this . name = name ;
181
181
this . installed = false ;
@@ -190,18 +190,17 @@ let Requirement = function (id, name, isFatal) {
190
190
* @return Promise<Requirement[]> Array of requirements. Due to implementation, promise is always fulfilled.
191
191
*/
192
192
module . exports . check_all = function ( ) {
193
-
194
193
const requirements = [
195
194
new Requirement ( 'os' , 'Apple macOS' , true ) ,
196
195
new Requirement ( 'xcode' , 'Xcode' ) ,
197
196
new Requirement ( 'ios-deploy' , 'ios-deploy' ) ,
198
197
new Requirement ( 'CocoaPods' , 'CocoaPods' )
199
198
] ;
200
199
201
- let result = [ ] ;
200
+ const result = [ ] ;
202
201
let fatalIsHit = false ;
203
202
204
- let checkFns = [
203
+ const checkFns = [
205
204
module . exports . check_os ,
206
205
module . exports . check_xcodebuild ,
207
206
module . exports . check_ios_deploy ,
@@ -215,7 +214,7 @@ module.exports.check_all = function () {
215
214
// we don't need to check others
216
215
if ( fatalIsHit ) return Q ( ) ;
217
216
218
- let requirement = requirements [ idx ] ;
217
+ const requirement = requirements [ idx ] ;
219
218
return checkFn ( )
220
219
. then ( function ( version ) {
221
220
requirement . installed = true ;
0 commit comments