Commit 283f27d4 authored by Chris Bracken's avatar Chris Bracken Committed by GitHub

Clarify libimobiledevice installation status message (#12303)

Differentiate between 'not installed' and 'not working' and emit a more
targeted message.
parent 1a309702
...@@ -125,10 +125,17 @@ class IOSWorkflow extends DoctorValidator implements Workflow { ...@@ -125,10 +125,17 @@ class IOSWorkflow extends DoctorValidator implements Workflow {
if (hasHomebrew) { if (hasHomebrew) {
brewStatus = ValidationType.installed; brewStatus = ValidationType.installed;
if (!await iMobileDevice.isWorking) { if (!iMobileDevice.isInstalled) {
brewStatus = ValidationType.partial; brewStatus = ValidationType.partial;
messages.add(new ValidationMessage.error( messages.add(new ValidationMessage.error(
'libimobiledevice and ideviceinstaller are not installed or require updating. To update, run:\n' 'libimobiledevice and ideviceinstaller are not installed. To install, run:\n'
' brew install --HEAD libimobiledevice\n'
' brew install ideviceinstaller'
));
} else if (!await iMobileDevice.isWorking) {
brewStatus = ValidationType.partial;
messages.add(new ValidationMessage.error(
'libimobiledevice and ideviceinstaller may require updating. To update, run:\n'
' brew uninstall --ignore-dependencies libimobiledevice\n' ' brew uninstall --ignore-dependencies libimobiledevice\n'
' brew install --HEAD libimobiledevice\n' ' brew install --HEAD libimobiledevice\n'
' brew install ideviceinstaller' ' brew install ideviceinstaller'
......
...@@ -161,6 +161,21 @@ void main() { ...@@ -161,6 +161,21 @@ void main() {
final IOSWorkflowTestTarget workflow = new IOSWorkflowTestTarget(); final IOSWorkflowTestTarget workflow = new IOSWorkflowTestTarget();
final ValidationResult result = await workflow.validate(); final ValidationResult result = await workflow.validate();
expect(result.type, ValidationType.partial); expect(result.type, ValidationType.partial);
}, overrides: <Type, Generator>{
IMobileDevice: () => new MockIMobileDevice(isInstalled: false, isWorking: false),
Xcode: () => xcode,
CocoaPods: () => cocoaPods,
});
testUsingContext('Emits partial status when libimobiledevice is installed but not working', () async {
when(xcode.isInstalled).thenReturn(true);
when(xcode.xcodeVersionText)
.thenReturn('Xcode 8.2.1\nBuild version 8C1002\n');
when(xcode.isInstalledAndMeetsVersionCheck).thenReturn(true);
when(xcode.eulaSigned).thenReturn(true);
final IOSWorkflowTestTarget workflow = new IOSWorkflowTestTarget();
final ValidationResult result = await workflow.validate();
expect(result.type, ValidationType.partial);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
IMobileDevice: () => new MockIMobileDevice(isWorking: false), IMobileDevice: () => new MockIMobileDevice(isWorking: false),
Xcode: () => xcode, Xcode: () => xcode,
...@@ -281,7 +296,13 @@ final ProcessResult exitsHappy = new ProcessResult( ...@@ -281,7 +296,13 @@ final ProcessResult exitsHappy = new ProcessResult(
); );
class MockIMobileDevice extends IMobileDevice { class MockIMobileDevice extends IMobileDevice {
MockIMobileDevice({bool isWorking: true}) : isWorking = new Future<bool>.value(isWorking); MockIMobileDevice({
this.isInstalled: true,
bool isWorking: true,
}) : isWorking = new Future<bool>.value(isWorking);
@override
final bool isInstalled;
@override @override
final Future<bool> isWorking; final Future<bool> isWorking;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment