mirror of
https://github.com/status-im/react-native.git
synced 2025-01-09 17:15:54 +00:00
48ab5eb436
Summary: At the moment the run-ios command from the react-native cli does only work for simulators. The pull request adds a new option to the existing command: **"--device 'device-name'" which installs and launches an iOS application on a connected device.** This makes it easier to build a test environment using react-native for connected devices. I've tested my code with the following commands: react-native run-ios --device "Not existing device" react-native run-ios --device react-native run-ios --device "name-of-a-simulator" react-native run-ios --device "name-of-connected-device" Output of the first three commands: ![example_error_output](https://cloud.githubusercontent.com/assets/9102810/17669443/f53d5948-630d-11e6-9a80-7df2f352c6a3.png) Additional to the manual command tests i've added a test file 'parseIOSDevicesList-test.js'. I used **ios-deploy** In order to launch and install the .app-bundle on a connected device. ios-deploy on github: Closes https://github.com/facebook/react-native/pull/9414 Differential Revision: D3821638 Pulled By: javache fbshipit-source-id: c07b7bf25283a966e45613a22ed3184bb1aac714
39 lines
994 B
JavaScript
39 lines
994 B
JavaScript
/**
|
|
* Copyright (c) 2015-present, Facebook, Inc.
|
|
* All rights reserved.
|
|
*
|
|
* This source code is licensed under the BSD-style license found in the
|
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
*
|
|
* @flow
|
|
*/
|
|
'use strict';
|
|
|
|
type IOSDeviceInfo = {
|
|
name: string;
|
|
udid: string;
|
|
version: string;
|
|
}
|
|
|
|
/**
|
|
* Parses the output of `xcrun simctl list devices` command
|
|
*/
|
|
function parseIOSDevicesList(text: string): Array<IOSDeviceInfo> {
|
|
const devices = [];
|
|
text.split('\n').forEach((line) => {
|
|
const device = line.match(/(.*?) \((.*?)\) \[(.*?)\]/);
|
|
const noSimulator = line.match(/(.*?) \((.*?)\) \[(.*?)\] \((.*?)\)/);
|
|
if (device != null && noSimulator == null){
|
|
var name = device[1];
|
|
var version = device[2];
|
|
var udid = device[3];
|
|
devices.push({udid, name, version});
|
|
}
|
|
});
|
|
|
|
return devices;
|
|
}
|
|
|
|
module.exports = parseIOSDevicesList;
|