@@ -5,24 +5,25 @@ import { HostInfo } from "./host-info";
5
5
import { AndroidLocalBuildRequirements } from "./local-build-requirements/android-local-build-requirements" ;
6
6
import { IosLocalBuildRequirements } from "./local-build-requirements/ios-local-build-requirements" ;
7
7
import { Helpers } from "./helpers" ;
8
+ import { IWarning } from "../typings/nativescript-doctor" ;
8
9
import * as semver from "semver" ;
9
10
10
11
export class Doctor {
11
12
private static MIN_SUPPORTED_POD_VERSION = "0.38.2" ;
12
13
13
- constructor ( private sysInfo : SysInfo ,
14
+ constructor ( private androidLocalBuildRequirements : AndroidLocalBuildRequirements ,
15
+ private helpers : Helpers ,
14
16
private hostInfo : HostInfo ,
15
- private androidLocalBuildRequirements : AndroidLocalBuildRequirements ,
16
- private iosLocalBuildRequirements : IosLocalBuildRequirements ,
17
- private helpers : Helpers ) { }
17
+ private iOSLocalBuildRequirements : IosLocalBuildRequirements ,
18
+ private sysInfo : SysInfo ) { }
18
19
19
20
public async canExecuteLocalBuild ( platform : string ) : Promise < boolean > {
20
21
this . validatePlatform ( platform ) ;
21
22
22
- if ( platform . toLocaleLowerCase ( ) === Constants . ANDROID_PLATFORM_NAME . toLocaleLowerCase ( ) ) {
23
+ if ( platform . toLowerCase ( ) === Constants . ANDROID_PLATFORM_NAME . toLowerCase ( ) ) {
23
24
return await this . androidLocalBuildRequirements . checkRequirements ( ) ;
24
- } else if ( platform . toLocaleLowerCase ( ) === Constants . IOS_PLATFORM_NAME . toLocaleLowerCase ( ) ) {
25
- return await this . iosLocalBuildRequirements . checkRequirements ( ) ;
25
+ } else if ( platform . toLowerCase ( ) === Constants . IOS_PLATFORM_NAME . toLowerCase ( ) ) {
26
+ return await this . iOSLocalBuildRequirements . checkRequirements ( ) ;
26
27
}
27
28
28
29
return false ;
@@ -93,31 +94,13 @@ export class Doctor {
93
94
+ `To be able to build such projects, verify that you have at least ${ Doctor . MIN_SUPPORTED_POD_VERSION } version installed.`
94
95
} ) ;
95
96
}
96
-
97
- if ( ! sysInfoData . monoVer || semver . lt ( sysInfoData . monoVer , "3.12.0" ) ) {
98
- result . push ( {
99
- warning : "WARNING: Mono 3.12 or later is not installed or not configured properly." ,
100
- additionalInformation : "You will not be able to work with Android devices in the device simulator or debug on connected Android devices." + EOL
101
- + "To be able to work with Android in the device simulator and debug on connected Android devices," + EOL
102
- + "download and install Mono 3.12 or later from http://www.mono-project.com/download/" + EOL
103
- } ) ;
104
- }
105
97
} else {
106
98
result . push ( {
107
99
warning : "NOTE: You can develop for iOS only on Mac OS X systems." ,
108
100
additionalInformation : "To be able to work with iOS devices and projects, you need Mac OS X Mavericks or later." + EOL
109
101
} ) ;
110
102
}
111
103
112
- if ( ! sysInfoData . itunesInstalled ) {
113
- result . push ( {
114
- warning : "WARNING: iTunes is not installed." ,
115
- additionalInformation : "You will not be able to work with iOS devices via cable connection." + EOL
116
- + "To be able to work with connected iOS devices," + EOL
117
- + "download and install iTunes from http://www.apple.com" + EOL
118
- } ) ;
119
- }
120
-
121
104
if ( ! sysInfoData . javaVer ) {
122
105
result . push ( {
123
106
warning : "WARNING: The Java Development Kit (JDK) is not installed or is not configured properly." ,
@@ -142,13 +125,7 @@ export class Doctor {
142
125
}
143
126
144
127
private isPlatformSupported ( platform : string ) : boolean {
145
- return Constants . SUPPORTED_PLATFORMS . reduce ( ( prevValue , currentValue ) => {
146
- if ( ! prevValue ) {
147
- return currentValue . toLocaleLowerCase ( ) === platform . toLocaleLowerCase ( ) ;
148
- } else {
149
- return prevValue ;
150
- }
151
- } , false ) ;
128
+ return Constants . SUPPORTED_PLATFORMS . map ( pl => pl . toLowerCase ( ) ) . indexOf ( platform . toLowerCase ( ) ) !== - 1 ;
152
129
}
153
130
154
131
private validatePlatform ( platform : string ) : void {
0 commit comments