Skip to content

Commit 1dc9b59

Browse files
FatmeFatme
authored andcommitted
Merge pull request #33 from telerik/fatme/sdk-version
Support for xcode7
2 parents 84a61e2 + 41a34ce commit 1dc9b59

20 files changed

+867
-827
lines changed

.gitignore

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
.DS_Store
2+
3+
*.js
14
!/*.js
25
!bin/ios-sim-portable.js
36
*.js.map
@@ -10,15 +13,15 @@ lib-cov
1013
*.out
1114
*.pid
1215
*.gz
13-
*.tgz
14-
*.tmp
16+
*.tgz
17+
*.tmp
1518
tscommand*.tmp.txt
1619
.tscache/
1720
/lib/.d.ts
18-
19-
.idea/
21+
22+
.idea/
2023

2124
test-reports.xml
2225

23-
npm-debug.log
24-
node_modules
26+
npm-debug.log
27+
node_modules

lib/child-process.ts

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
///<reference path="./.d.ts"/>
2+
"use strict";
3+
4+
import * as child_process from "child_process";
5+
import * as errors from "./errors";
6+
import Future = require("fibers/future");
7+
import * as util from "util";
8+
9+
export function exec(command: string): IFuture<any> {
10+
var future = new Future<any>();
11+
12+
child_process.exec(command, (error: Error, stdout: NodeBuffer, stderr: NodeBuffer) => {
13+
if(error) {
14+
errors.fail(`Error ${error.message} while executing ${command}.`);
15+
} else {
16+
future.return(stdout ? stdout.toString() : "");
17+
}
18+
});
19+
20+
return future;
21+
}
22+
23+
export function spawn(command: string, args: string[]): IFuture<string> {
24+
let future = new Future<string>();
25+
let capturedOut = "";
26+
let capturedErr = "";
27+
28+
let childProcess = child_process.spawn(command, args);
29+
30+
if(childProcess.stdout) {
31+
childProcess.stdout.on("data", (data: string) => {
32+
capturedOut += data;
33+
});
34+
}
35+
36+
if(childProcess.stderr) {
37+
childProcess.stderr.on("data", (data: string) => {
38+
capturedErr += data;
39+
});
40+
}
41+
42+
childProcess.on("close", (arg: any) => {
43+
var exitCode = typeof arg === 'number' ? arg : arg && arg.code;
44+
if(exitCode === 0) {
45+
future.return(capturedOut ? capturedOut.trim() : null);
46+
} else {
47+
future.throw(util.format("Command %s with arguments %s failed with exit code %s. Error output: \n %s", command, args.join(" "), exitCode, capturedErr));
48+
}
49+
});
50+
51+
return future;
52+
}

lib/commands/launch.js

Lines changed: 0 additions & 14 deletions
This file was deleted.

lib/commands/launch.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ import iphoneSimulatorLibPath = require("./../iphone-simulator");
77
export class Command implements ICommand {
88
public execute(args: string[]): IFuture<void> {
99
var iphoneSimulator = new iphoneSimulatorLibPath.iPhoneSimulator();
10-
return iphoneSimulator.run(args[0]);
10+
return iphoneSimulator.run(args[0], args[1]);
1111
}
1212
}

lib/declarations.ts

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"use strict";
33

44
interface IiPhoneSimulator {
5-
run(appName: string): IFuture<void>;
5+
run(applicationPath: string, applicationIdentifier: string): IFuture<void>;
66
printDeviceTypes(): IFuture<void>;
77
printSDKS(): IFuture<void>;
88
sendNotification(notification: string): IFuture<void>;
@@ -17,22 +17,38 @@ interface ICommandExecutor {
1717
}
1818

1919
interface IDevice {
20-
device: any; // nodobjc wrapper to device
21-
deviceIdentifier: string;
22-
fullDeviceIdentifier: string;
20+
name: string;
21+
id: string;
22+
fullId: string;
2323
runtimeVersion: string;
24+
state?: string;
25+
rawDevice?: any; // NodObjC wrapper to device
26+
}
27+
28+
interface ISimctl {
29+
launch(deviceId: string, applicationIdentifier: string): IFuture<void>;
30+
install(deviceId: string, applicationPath: string): IFuture<void>;
31+
uninstall(deviceId: string, applicationIdentifier: string): IFuture<void>;
32+
notifyPost(deviceId: string, notification: string): IFuture<void>;
33+
getDevices(): IFuture<IDevice[]>;
2434
}
2535

2636
interface IDictionary<T> {
2737
[key: string]: T;
2838
}
2939

30-
interface ISimulator {
31-
validDeviceIdentifiers: string[];
32-
deviceIdentifiersInfo: string[];
40+
interface IInteropSimulator {
41+
getDevices(): IFuture<IDevice[]>;
3342
setSimulatedDevice(config: any): void;
3443
}
3544

45+
interface ISimulator {
46+
getDevices(): IFuture<IDevice[]>;
47+
getSdks(): IFuture<ISdk[]>;
48+
run(applicationPath: string, applicationIdentifier: string): IFuture<void>;
49+
sendNotification(notification: string): IFuture<void>;
50+
}
51+
3652
interface IExecuteOptions {
3753
canRunMainLoop: boolean;
3854
appPath?: string;
@@ -42,5 +58,10 @@ interface ISdk {
4258
displayName: string;
4359
version: string;
4460
rootPath: string;
45-
sdkInfo(): string;
61+
}
62+
63+
interface IXcodeVersionData {
64+
major: string;
65+
minor: string;
66+
build: string;
4667
}

0 commit comments

Comments
 (0)