microsoft/vscode-react-native

Public

mirrored from https://github.com/microsoft/vscode-react-nativeAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
bb77358c8dc7ea46fae9d6aa601a11fde8eed0fd

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

src/debugger/ios/deviceDeployer.ts

33lines · modeblame

488f1908Jimmy Thomson10 years ago1// Copyright (c) Microsoft Corporation. All rights reserved.
2// Licensed under the MIT license. See LICENSE file in the project root for details.
3
bc96b26bJimmy Thomson10 years ago4import * as path from "path";
5import * as Q from "q";
488f1908Jimmy Thomson10 years ago6
b0061ac6Meena Kunnathur Balakrishnan10 years ago7import {CommandExecutor} from "../../common/commandExecutor";
a9d96b7cdigeff10 years ago8import {Xcodeproj} from "../../common/ios/xcodeproj";
190e393cMeena Kunnathur Balakrishnan10 years ago9import {ErrorHelper} from "../../common/error/errorHelper";
10import {InternalErrorCode} from "../../common/error/internalErrorCode";
488f1908Jimmy Thomson10 years ago11
12export class DeviceDeployer {
13private projectRoot: string;
14
15constructor(projectRoot: string) {
398e2b0bMark Oswald10 years ago16this.projectRoot = projectRoot.match(/(.*)ios\/?$/) ? projectRoot.match(/(.*)ios\/?$/)[1] : projectRoot;
488f1908Jimmy Thomson10 years ago17}
18
19public deploy(): Q.Promise<void> {
bc96b26bJimmy Thomson10 years ago20return new Xcodeproj().findXcodeprojFile(this.projectRoot).then((projectFile: string) => {
21const projectName = path.basename(projectFile, path.extname(projectFile));
22const pathToCompiledApp = path.join(this.projectRoot, "ios", "build",
23"Build", "Products", "Debug-iphoneos", `${projectName}.app`);
24return new CommandExecutor(this.projectRoot)
323a3cc0Meena Kunnathur Balakrishnan10 years ago25.spawn("ideviceinstaller", ["-i", pathToCompiledApp]).catch((err) => {
cb6d0922digeff10 years ago26if ((<any>err).code === "ENOENT") {
190e393cMeena Kunnathur Balakrishnan10 years ago27throw ErrorHelper.getNestedError(err, InternalErrorCode.IDeviceInstallerNotFound);
bc96b26bJimmy Thomson10 years ago28}
29throw err;
30});
31});
488f1908Jimmy Thomson10 years ago32}
33}