calabash/run_loop — pull request #80 by jmoody (2014-11-27 13:27:48+00:00)
Title: Ensure compatible arch before launching on device

### Motivation

**Before launching an app on iOS, ensure that the architecture of the CFBundleExecutable is compatible with the target device.** [#75](https://github.com/calabash/run_loop/issues/75)

If the binary and the _simulator_ target are not compatible, an error will raised _before_ launch.

```
RunLoop::IncompatibleArchitecture: Binary at:
/Users/moody/git/run-loop/spec/resources/lipo/x86_64/chou.app/chou
does not contain a compatible architecture for target device.
Expected 'i386' but found ["x86_64"].
```

### Todo

- [ ] I think we need some error handling in the RunLoop::Lipo class.

### Missing behaviors

There are two compatibility checks that are missing: is the binary compatible with a _physical device_ and is the binary compatible with the _form factor_.

Checks against physical devices will require integrating a tool like `ideviceinfo` because we cannot find information about a device's instruction set using Xcode tools; all we have is the UDID.

We _can_ check that the binary is compatibility with the form factor (e.g. Is this an iPad only app?) by inspecting the Info.plist. This behavior belongs in another PR.

### Testing

```
$ be rake spec/integration/simulator_compatibility_spec.rb
Simulator/Binary Compatibility Check
raises an error if libraries are not compatible
targeting i386 simulator with binary that contains only a x86_64 slice
target only has arm slices
can launch if library is FAT
targeting x86_64 simulator with binary that contains only a i386 slice
can launch if libraries are compatible
```

@krukow @svevang