4
4
import child_process = require( "child_process" ) ;
5
5
import fs = require( "fs" ) ;
6
6
import Future = require( "fibers/future" ) ;
7
+ import os = require( "os" ) ;
7
8
import path = require( "path" ) ;
8
9
import util = require( "util" ) ;
9
10
@@ -35,7 +36,6 @@ export class iPhoneSimulator implements IiPhoneSimulator {
35
36
}
36
37
37
38
public printDeviceTypes ( ) : IFuture < void > {
38
-
39
39
var action = ( ) => {
40
40
var simulator = this . createSimulator ( ) ;
41
41
_ . each ( simulator . validDeviceIdentifiers , ( identifier : any ) => console . log ( identifier ) ) ;
@@ -44,6 +44,30 @@ export class iPhoneSimulator implements IiPhoneSimulator {
44
44
return this . execute ( action , { canRunMainLoop : false } ) ;
45
45
}
46
46
47
+ public printSDKS ( ) : IFuture < void > {
48
+ var action = ( ) => {
49
+ var systemRootClass = this . getClassByName ( "DTiPhoneSimulatorSystemRoot" ) ;
50
+ var roots = systemRootClass ( "knownRoots" ) ;
51
+ var count = roots ( "count" ) ;
52
+
53
+ var sdks : ISdk [ ] = [ ] ;
54
+ for ( var index = 0 ; index < count ; index ++ ) {
55
+ var root = roots ( "objectAtIndex" , index ) ;
56
+
57
+ var displayName = root ( "sdkDisplayName" ) . toString ( ) ;
58
+ var version = root ( "sdkVersion" ) . toString ( ) ;
59
+ var rootPath = root ( "sdkRootPath" ) . toString ( ) ;
60
+
61
+ sdks . push ( new Sdk ( displayName , version , rootPath ) ) ;
62
+ }
63
+
64
+ sdks = _ . sortBy ( sdks , ( sdk : ISdk ) => sdk . version ) ;
65
+ _ . each ( sdks , ( sdk : ISdk ) => console . log ( sdk . sdkInfo ( ) + os . EOL ) ) ;
66
+ } ;
67
+
68
+ return this . execute ( action , { canRunMainLoop : false } ) ;
69
+ }
70
+
47
71
private execute ( action : ( appPath ?: string ) => any , opts : IExecuteOptions ) : IFuture < void > {
48
72
return ( ( ) => {
49
73
$ . importFramework ( iPhoneSimulator . FOUNDATION_FRAMEWORK_NAME ) ;
@@ -207,4 +231,16 @@ export class iPhoneSimulator implements IiPhoneSimulator {
207
231
208
232
return simulator ;
209
233
}
234
+ }
235
+
236
+ class Sdk implements ISdk {
237
+ constructor ( public displayName : string ,
238
+ public version : string ,
239
+ public rootPath : string ) { }
240
+
241
+ public sdkInfo ( ) : string {
242
+ return [ util . format ( " Display Name: %s" , this . displayName ) ,
243
+ util . format ( " Version: %s" , this . version ) ,
244
+ util . format ( " Root path: %s" , this . rootPath ) ] . join ( os . EOL ) ;
245
+ }
210
246
}
0 commit comments