@@ -25,16 +25,25 @@ export class iPhoneSimulator implements IiPhoneSimulator {
25
25
this . simulator = this . createSimulator ( ) . wait ( ) ;
26
26
}
27
27
28
- public get validDeviceIdentifiers ( ) : string [ ] {
29
- var devices = this . simulator . getDevices ( ) . wait ( ) ;
30
- return _ . map ( devices , device => device . id ) ;
31
- }
32
-
33
28
public run ( applicationPath : string , applicationIdentifier : string ) : IFuture < void > {
34
29
if ( ! fs . existsSync ( applicationPath ) ) {
35
30
errors . fail ( "Path does not exist " , applicationPath ) ;
36
31
}
37
32
33
+ if ( options . device ) {
34
+ let deviceNames = _ . unique ( _ . map ( this . simulator . getDevices ( ) . wait ( ) , ( device : IDevice ) => device . name ) ) ;
35
+ if ( ! _ . contains ( deviceNames , options . device ) ) {
36
+ errors . fail ( `Unable to find device ${ options . device } . The valid device names are ${ deviceNames . join ( ", " ) } ` ) ;
37
+ }
38
+ }
39
+
40
+ if ( options . sdkVersion ) {
41
+ let runtimeVersions = _ . unique ( _ . map ( this . simulator . getDevices ( ) . wait ( ) , ( device : IDevice ) => device . runtimeVersion ) ) ;
42
+ if ( ! _ . contains ( runtimeVersions , options . sdkVersion ) ) {
43
+ errors . fail ( `Unable to find sdk ${ options . sdkVersion } . The valid runtime versions are ${ runtimeVersions . join ( ", " ) } ` ) ;
44
+ }
45
+ }
46
+
38
47
return this . simulator . run ( applicationPath , applicationIdentifier ) ;
39
48
}
40
49
@@ -48,9 +57,13 @@ export class iPhoneSimulator implements IiPhoneSimulator {
48
57
public printSDKS ( ) : IFuture < void > {
49
58
return ( ( ) => {
50
59
let sdks = this . simulator . getSdks ( ) . wait ( ) ;
51
- _ . each ( sdks , ( sdk ) => console . log ( [ util . format ( " Display Name: %s" , sdk . displayName ) ,
52
- util . format ( " Version: %s" , sdk . version ) ,
53
- util . format ( " Root path: %s" , sdk . rootPath ) ] . join ( os . EOL ) ) ) ;
60
+ _ . each ( sdks , ( sdk ) => {
61
+ let output = ` Display Name: ${ sdk . displayName } ${ os . EOL } Version: ${ sdk . version } ${ os . EOL } ` ;
62
+ if ( sdk . rootPath ) {
63
+ output += ` Root path: ${ sdk . rootPath } ${ os . EOL } ` ;
64
+ }
65
+ console . log ( output ) ;
66
+ } ) ;
54
67
} ) . future < void > ( ) ( ) ;
55
68
}
56
69
0 commit comments