-
-
Notifications
You must be signed in to change notification settings - Fork 197
doctor doesn't crash on missing xcode tools #3043
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -95,7 +95,7 @@ class DoctorService implements IDoctorService { | |
result = true; | ||
} | ||
|
||
if (await this.$xcprojService.verifyXcproj(false)) { | ||
if (sysInfo.cocoapodVer && sysInfo.cocoapodVer && await this.$xcprojService.verifyXcproj(false)) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe this check should be: if (sysInfo.xcodeVer && sysInfo.cocoapodVer && ...) |
||
result = true; | ||
} | ||
} else { | ||
|
@@ -123,28 +123,15 @@ class DoctorService implements IDoctorService { | |
} | ||
} | ||
|
||
let versionsInformation: IVersionInformation[] = []; | ||
try { | ||
versionsInformation = await this.$versionsService.getComponentsForUpdate(); | ||
this.printVersionsInformation(versionsInformation); | ||
await this.$versionsService.getComponentsForUpdate(); | ||
} catch (err) { | ||
this.$logger.error("Cannot get the latest versions information from npm. Please try again later."); | ||
} | ||
|
||
return doctorResult; | ||
} | ||
|
||
private printVersionsInformation(versionsInformation: IVersionInformation[]) { | ||
if (versionsInformation && versionsInformation.length) { | ||
let table: any = this.$versionsService.createTableWithVersionsInformation(versionsInformation); | ||
|
||
this.$logger.warn("Updates available"); | ||
this.$logger.out(table.toString() + EOL); | ||
} else { | ||
this.$logger.out("Your components are up-to-date." + EOL); | ||
} | ||
} | ||
|
||
private async promptForDocs(link: string): Promise<void> { | ||
if (await this.$prompter.confirm("Do you want to visit the official documentation?", () => helpers.isInteractive())) { | ||
this.$opener.open(link); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
import { EOL } from "os"; | ||
import * as constants from "../constants"; | ||
import * as semver from "semver"; | ||
import * as path from "path"; | ||
|
@@ -14,7 +15,8 @@ class VersionsService implements IVersionsService { | |
private $npmInstallationManager: INpmInstallationManager, | ||
private $injector: IInjector, | ||
private $staticConfig: Config.IStaticConfig, | ||
private $pluginsService: IPluginsService) { | ||
private $pluginsService: IPluginsService, | ||
private $logger: ILogger) { | ||
this.projectData = this.getProjectData(); | ||
} | ||
|
||
|
@@ -84,7 +86,7 @@ class VersionsService implements IVersionsService { | |
return runtimesVersions; | ||
} | ||
|
||
public async getComponentsForUpdate(): Promise<IVersionInformation[]> { | ||
public async getComponentsForUpdate() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this method needs return type |
||
let allComponents: IVersionInformation[] = await this.getAllComponentsVersions(); | ||
let componentsForUpdate: IVersionInformation[] = []; | ||
|
||
|
@@ -94,7 +96,18 @@ class VersionsService implements IVersionsService { | |
} | ||
}); | ||
|
||
return componentsForUpdate; | ||
this.printVersionsInformation(componentsForUpdate, allComponents); | ||
} | ||
|
||
private printVersionsInformation(versionsInformation: IVersionInformation[], allComponents: IVersionInformation[]) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this method needs return type |
||
if (versionsInformation && versionsInformation.length) { | ||
let table: any = this.createTableWithVersionsInformation(versionsInformation); | ||
|
||
this.$logger.warn("Updates available"); | ||
this.$logger.out(table.toString() + EOL); | ||
} else { | ||
this.$logger.out(`Your components are up-to-date: ${EOL}${allComponents.map(component => component.componentName)}${EOL}`); | ||
} | ||
} | ||
|
||
public async getAllComponentsVersions(): Promise<IVersionInformation[]> { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In case the method is void, its name is incorrect as it does not get anything