Skip to content

Fix cocoapods check and add unit tests for doctor service #1248

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

Merged
merged 1 commit into from
Nov 26, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/common
2 changes: 1 addition & 1 deletion lib/services/android-project-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject

// this call will fail in case `android` is not set correctly.
this.$androidToolsInfo.getPathToAndroidExecutable().wait();
this.$androidToolsInfo.validateJavacVersion(this.$sysInfo.getSysInfo().wait().javacVersion, {showWarningsAsErrors: true}).wait();
this.$androidToolsInfo.validateJavacVersion(this.$sysInfo.getSysInfo(path.join(__dirname, "..", "..", "package.json")).wait().javacVersion, {showWarningsAsErrors: true}).wait();
}).future<void>()();
}

Expand Down
3 changes: 2 additions & 1 deletion lib/services/doctor-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"use strict";
import {EOL} from "os";
import * as semver from "semver";
import * as path from "path";

class DoctorService implements IDoctorService {
private static MIN_SUPPORTED_POD_VERSION = "0.38.2";
Expand All @@ -13,7 +14,7 @@ class DoctorService implements IDoctorService {

public printWarnings(): boolean {
let result = false;
let sysInfo = this.$sysInfo.getSysInfo().wait();
let sysInfo = this.$sysInfo.getSysInfo(path.join(__dirname, "..", "..", "package.json")).wait();

if (!sysInfo.adbVer) {
this.$logger.warn("WARNING: adb from the Android SDK is not installed or is not configured properly.");
Expand Down
8 changes: 5 additions & 3 deletions lib/sys-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,25 @@
"use strict";

import {SysInfoBase} from "./common/sys-info-base";
import * as path from "path";

export class SysInfo extends SysInfoBase {
constructor(protected $childProcess: IChildProcess,
protected $hostInfo: IHostInfo,
protected $iTunesValidator: Mobile.IiTunesValidator,
protected $logger: ILogger,
protected $winreg: IWinReg,
private $androidToolsInfo: IAndroidToolsInfo) {
super($childProcess, $hostInfo, $iTunesValidator, $logger);
super($childProcess, $hostInfo, $iTunesValidator, $logger, $winreg);
}

public getSysInfo(androidToolsInfo?: {pathToAdb: string, pathToAndroid: string}): IFuture<ISysInfoData> {
public getSysInfo(pathToPackageJson: string, androidToolsInfo?: {pathToAdb: string, pathToAndroid: string}): IFuture<ISysInfoData> {
return ((): ISysInfoData => {
let defaultAndroidToolsInfo = {
pathToAdb: this.$androidToolsInfo.getPathToAdbFromAndroidHome().wait(),
pathToAndroid: this.$androidToolsInfo.getPathToAndroidExecutable().wait()
};
return super.getSysInfo(androidToolsInfo || defaultAndroidToolsInfo).wait();
return super.getSysInfo(pathToPackageJson || path.join(__dirname, "..", "package.json"), androidToolsInfo || defaultAndroidToolsInfo).wait();
}).future<ISysInfoData>()();
}
}
Expand Down