Skip to content
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

Support for xcode7 #33

Merged
merged 13 commits into from
Oct 28, 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
15 changes: 9 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
.DS_Store

*.js
!/*.js
!bin/ios-sim-portable.js
*.js.map
Expand All @@ -10,15 +13,15 @@ lib-cov
*.out
*.pid
*.gz
*.tgz
*.tmp
*.tgz
*.tmp
tscommand*.tmp.txt
.tscache/
/lib/.d.ts

.idea/
.idea/

test-reports.xml

npm-debug.log
node_modules
npm-debug.log
node_modules
52 changes: 52 additions & 0 deletions lib/child-process.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
///<reference path="./.d.ts"/>
"use strict";

import * as child_process from "child_process";
import * as errors from "./errors";
import Future = require("fibers/future");
import * as util from "util";

export function exec(command: string): IFuture<any> {
var future = new Future<any>();

child_process.exec(command, (error: Error, stdout: NodeBuffer, stderr: NodeBuffer) => {
if(error) {
errors.fail(`Error ${error.message} while executing ${command}.`);
} else {
future.return(stdout ? stdout.toString() : "");
}
});

return future;
}

export function spawn(command: string, args: string[]): IFuture<string> {
let future = new Future<string>();
let capturedOut = "";
let capturedErr = "";

let childProcess = child_process.spawn(command, args);

if(childProcess.stdout) {
childProcess.stdout.on("data", (data: string) => {
capturedOut += data;
});
}

if(childProcess.stderr) {
childProcess.stderr.on("data", (data: string) => {
capturedErr += data;
});
}

childProcess.on("close", (arg: any) => {
var exitCode = typeof arg === 'number' ? arg : arg && arg.code;
if(exitCode === 0) {
future.return(capturedOut ? capturedOut.trim() : null);
} else {
future.throw(util.format("Command %s with arguments %s failed with exit code %s. Error output: \n %s", command, args.join(" "), exitCode, capturedErr));
}
});

return future;
}
14 changes: 0 additions & 14 deletions lib/commands/launch.js

This file was deleted.

2 changes: 1 addition & 1 deletion lib/commands/launch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ import iphoneSimulatorLibPath = require("./../iphone-simulator");
export class Command implements ICommand {
public execute(args: string[]): IFuture<void> {
var iphoneSimulator = new iphoneSimulatorLibPath.iPhoneSimulator();
return iphoneSimulator.run(args[0]);
return iphoneSimulator.run(args[0], args[1]);
}
}
37 changes: 29 additions & 8 deletions lib/declarations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"use strict";

interface IiPhoneSimulator {
run(appName: string): IFuture<void>;
run(applicationPath: string, applicationIdentifier: string): IFuture<void>;
printDeviceTypes(): IFuture<void>;
printSDKS(): IFuture<void>;
sendNotification(notification: string): IFuture<void>;
Expand All @@ -17,22 +17,38 @@ interface ICommandExecutor {
}

interface IDevice {
device: any; // nodobjc wrapper to device
deviceIdentifier: string;
fullDeviceIdentifier: string;
name: string;
id: string;
fullId: string;
runtimeVersion: string;
state?: string;
rawDevice?: any; // NodObjC wrapper to device
}

interface ISimctl {
launch(deviceId: string, applicationIdentifier: string): IFuture<void>;
install(deviceId: string, applicationPath: string): IFuture<void>;
uninstall(deviceId: string, applicationIdentifier: string): IFuture<void>;
notifyPost(deviceId: string, notification: string): IFuture<void>;
getDevices(): IFuture<IDevice[]>;
}

interface IDictionary<T> {
[key: string]: T;
}

interface ISimulator {
validDeviceIdentifiers: string[];
deviceIdentifiersInfo: string[];
interface IInteropSimulator {
getDevices(): IFuture<IDevice[]>;
setSimulatedDevice(config: any): void;
}

interface ISimulator {
getDevices(): IFuture<IDevice[]>;
getSdks(): IFuture<ISdk[]>;
run(applicationPath: string, applicationIdentifier: string): IFuture<void>;
sendNotification(notification: string): IFuture<void>;
}

interface IExecuteOptions {
canRunMainLoop: boolean;
appPath?: string;
Expand All @@ -42,5 +58,10 @@ interface ISdk {
displayName: string;
version: string;
rootPath: string;
sdkInfo(): string;
}

interface IXcodeVersionData {
major: string;
minor: string;
build: string;
}
Loading