@@ -5,24 +5,25 @@ import { HostInfo } from "./host-info";
55import { AndroidLocalBuildRequirements } from "./local-build-requirements/android-local-build-requirements" ;
66import { IosLocalBuildRequirements } from "./local-build-requirements/ios-local-build-requirements" ;
77import { Helpers } from "./helpers" ;
8+ import { IWarning } from "../typings/nativescript-doctor" ;
89import * as semver from "semver" ;
910
1011export class Doctor {
1112 private static MIN_SUPPORTED_POD_VERSION = "0.38.2" ;
1213
13- constructor ( private sysInfo : SysInfo ,
14+ constructor ( private androidLocalBuildRequirements : AndroidLocalBuildRequirements ,
15+ private helpers : Helpers ,
1416 private hostInfo : HostInfo ,
15- private androidLocalBuildRequirements : AndroidLocalBuildRequirements ,
16- private iosLocalBuildRequirements : IosLocalBuildRequirements ,
17- private helpers : Helpers ) { }
17+ private iOSLocalBuildRequirements : IosLocalBuildRequirements ,
18+ private sysInfo : SysInfo ) { }
1819
1920 public async canExecuteLocalBuild ( platform : string ) : Promise < boolean > {
2021 this . validatePlatform ( platform ) ;
2122
22- if ( platform . toLocaleLowerCase ( ) === Constants . ANDROID_PLATFORM_NAME . toLocaleLowerCase ( ) ) {
23+ if ( platform . toLowerCase ( ) === Constants . ANDROID_PLATFORM_NAME . toLowerCase ( ) ) {
2324 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 ( ) ;
2627 }
2728
2829 return false ;
@@ -93,31 +94,13 @@ export class Doctor {
9394 + `To be able to build such projects, verify that you have at least ${ Doctor . MIN_SUPPORTED_POD_VERSION } version installed.`
9495 } ) ;
9596 }
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- }
10597 } else {
10698 result . push ( {
10799 warning : "NOTE: You can develop for iOS only on Mac OS X systems." ,
108100 additionalInformation : "To be able to work with iOS devices and projects, you need Mac OS X Mavericks or later." + EOL
109101 } ) ;
110102 }
111103
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-
121104 if ( ! sysInfoData . javaVer ) {
122105 result . push ( {
123106 warning : "WARNING: The Java Development Kit (JDK) is not installed or is not configured properly." ,
@@ -142,13 +125,7 @@ export class Doctor {
142125 }
143126
144127 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 ;
152129 }
153130
154131 private validatePlatform ( platform : string ) : void {
0 commit comments