ios-sim-portable
Advanced tools
Comparing version 1.0.3 to 1.0.4
#!/usr/bin/env node | ||
require("../lib/ios-sim.js"); |
@@ -0,0 +0,0 @@ ///<reference path="./.d.ts"/> |
@@ -0,0 +0,0 @@ ///<reference path="./.d.ts"/> |
@@ -0,0 +0,0 @@ ///<reference path=".././.d.ts"/> |
@@ -0,0 +0,0 @@ ///<reference path=".././.d.ts"/> |
@@ -0,0 +0,0 @@ ///<reference path=".././.d.ts"/> |
@@ -0,0 +0,0 @@ ///<reference path=".././.d.ts"/> |
@@ -0,0 +0,0 @@ ///<reference path=".././.d.ts"/> |
@@ -0,0 +0,0 @@ ///<reference path=".././.d.ts"/> |
@@ -0,0 +0,0 @@ ///<reference path=".././.d.ts"/> |
@@ -0,0 +0,0 @@ ///<reference path=".././.d.ts"/> |
///<reference path="./.d.ts"/> | ||
"use strict"; | ||
//# sourceMappingURL=declarations.js.map |
@@ -20,3 +20,4 @@ ///<reference path="./.d.ts"/> | ||
device: any; // NodObjC wrapper to device | ||
deviceTypeIdentifier: string; | ||
deviceIdentifier: string; | ||
fullDeviceIdentifier: string; | ||
runtimeVersion: string; | ||
@@ -31,2 +32,3 @@ } | ||
validDeviceIdentifiers: string[]; | ||
deviceIdentifiersInfo: string[]; | ||
setSimulatedDevice(config: any): void; | ||
@@ -33,0 +35,0 @@ } |
@@ -0,0 +0,0 @@ // Type definitions for node-fibers |
@@ -0,0 +0,0 @@ /************************************************ |
@@ -0,0 +0,0 @@ declare module "NodObjC" { |
@@ -0,0 +0,0 @@ ///<reference path="./.d.ts"/> |
@@ -0,0 +0,0 @@ ///<reference path="./.d.ts"/> |
///<reference path="./.d.ts"/> | ||
"use strict"; | ||
global._ = require("underscore"); | ||
global._ = require("lodash"); | ||
@@ -5,0 +5,0 @@ var Fiber = require("fibers"); |
///<reference path="./.d.ts"/> | ||
"use strict"; | ||
global._ = require("underscore"); | ||
global._ = require("lodash"); | ||
@@ -5,0 +5,0 @@ import Fiber = require("fibers"); |
@@ -18,2 +18,10 @@ ///<reference path="./.d.ts"/> | ||
Object.defineProperty(XCode5Simulator.prototype, "deviceIdentifiersInfo", { | ||
get: function () { | ||
return _.keys(XCode5Simulator.allowedDeviceIdentifiers); | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
XCode5Simulator.prototype.setSimulatedDevice = function (config) { | ||
@@ -20,0 +28,0 @@ config("setSimulatedDeviceInfoName", $(this.deviceIdentifier)); |
@@ -29,2 +29,6 @@ ///<reference path="./.d.ts"/> | ||
public get deviceIdentifiersInfo(): string[] { | ||
return _.keys(XCode5Simulator.allowedDeviceIdentifiers); | ||
} | ||
public setSimulatedDevice(config:any): void { | ||
@@ -31,0 +35,0 @@ config("setSimulatedDeviceInfoName", $(this.deviceIdentifier)); |
@@ -16,26 +16,17 @@ ///<reference path="./.d.ts"/> | ||
get: function () { | ||
var simDeviceSet = $.classDefinition.getClassByName("SimDeviceSet"); | ||
var devicesInfo = []; | ||
var devices = this.getDevicesInfo(); | ||
return _.map(devices, function (device) { | ||
return device.deviceIdentifier; | ||
}); | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
if (simDeviceSet) { | ||
var deviceSet = simDeviceSet("defaultSet"); | ||
var devices = deviceSet("availableDevices"); | ||
var count = devices("count"); | ||
for (var index = 0; index < count; index++) { | ||
var device = devices("objectAtIndex", index); | ||
var deviceIdentifier = device("deviceType")("identifier").toString(); | ||
var deviceIdentifierPrefixIndex = deviceIdentifier.indexOf(XCode6Simulator.DEFAULT_DEVICE_IDENTIFIER); | ||
var deviceIdentifierWithoutPrefix = deviceIdentifier.substring(deviceIdentifierPrefixIndex + XCode6Simulator.DEVICE_IDENTIFIER_PREFIX.length + 2); | ||
var runtimeVersion = device("runtime")("versionString").toString(); | ||
var deviceInfo = [ | ||
util.format("Device Identifier: %s", deviceIdentifierWithoutPrefix), | ||
util.format("Runtime Version: %s", runtimeVersion)].join(os.EOL); | ||
devicesInfo.push(deviceInfo + os.EOL); | ||
} | ||
} | ||
return devicesInfo; | ||
Object.defineProperty(XCode6Simulator.prototype, "deviceIdentifiersInfo", { | ||
get: function () { | ||
var devices = this.getDevicesInfo(); | ||
return _.map(devices, function (device) { | ||
return util.format("Device Identifier: %s. %sRuntime Version: %s %s", device.fullDeviceIdentifier, os.EOL, device.runtimeVersion, os.EOL); | ||
}); | ||
}, | ||
@@ -51,2 +42,6 @@ enumerable: true, | ||
XCode6Simulator.prototype.getDevicesInfo = function () { | ||
return _(this.getAvailableDevices()).map(_.identity).flatten().value(); | ||
}; | ||
Object.defineProperty(XCode6Simulator.prototype, "deviceIdentifier", { | ||
@@ -68,9 +63,19 @@ get: function () { | ||
var device = devices("objectAtIndex", index); | ||
var deviceTypeIdentifier = device("deviceType")("identifier").toString(); | ||
var deviceIdentifier = device("deviceType")("identifier").toString(); | ||
var deviceIdentifierPrefixIndex = deviceIdentifier.indexOf(XCode6Simulator.DEVICE_IDENTIFIER_PREFIX); | ||
var deviceIdentifierWithoutPrefix = deviceIdentifier.substring(deviceIdentifierPrefixIndex + XCode6Simulator.DEVICE_IDENTIFIER_PREFIX.length + 1); | ||
var runtimeVersion = device("runtime")("versionString").toString(); | ||
this.availableDevices[deviceTypeIdentifier] = { | ||
if (!this.availableDevices[deviceIdentifier]) { | ||
this.availableDevices[deviceIdentifier] = []; | ||
} | ||
this.availableDevices[deviceIdentifier].push({ | ||
device: device, | ||
deviceTypeIdentifier: deviceTypeIdentifier, | ||
deviceIdentifier: deviceIdentifierWithoutPrefix, | ||
fullDeviceIdentifier: this.buildFullDeviceIdentifier(deviceIdentifier), | ||
runtimeVersion: runtimeVersion | ||
}; | ||
}); | ||
} | ||
@@ -84,8 +89,8 @@ } | ||
XCode6Simulator.prototype.getDeviceByIdentifier = function (deviceIdentifier) { | ||
var fullDeviceIdentifier = util.format("%s.%s", XCode6Simulator.DEVICE_IDENTIFIER_PREFIX, deviceIdentifier); | ||
var availableDevices = this.getAvailableDevices(); | ||
if (!_.isEmpty(availableDevices)) { | ||
var fullDeviceIdentifier = this.buildFullDeviceIdentifier(deviceIdentifier); | ||
var selectedDevice = availableDevices[fullDeviceIdentifier]; | ||
if (selectedDevice) { | ||
return selectedDevice.device; | ||
return selectedDevice[0].device; | ||
} | ||
@@ -96,2 +101,6 @@ } | ||
}; | ||
XCode6Simulator.prototype.buildFullDeviceIdentifier = function (deviceIdentifier) { | ||
return util.format("%s.%s", XCode6Simulator.DEVICE_IDENTIFIER_PREFIX, deviceIdentifier); | ||
}; | ||
XCode6Simulator.DEVICE_IDENTIFIER_PREFIX = "com.apple.CoreSimulator.SimDeviceType"; | ||
@@ -98,0 +107,0 @@ XCode6Simulator.DEFAULT_DEVICE_IDENTIFIER = "iPhone-4s"; |
@@ -16,3 +16,3 @@ ///<reference path="./.d.ts"/> | ||
private availableDevices: IDictionary<IDevice>; | ||
private availableDevices: IDictionary<IDevice[]>; | ||
@@ -24,25 +24,9 @@ constructor() { | ||
public get validDeviceIdentifiers(): string[] { | ||
var simDeviceSet = $.classDefinition.getClassByName("SimDeviceSet"); | ||
var devicesInfo: string[] = []; | ||
var devices = this.getDevicesInfo(); | ||
return _.map(devices, device => device.deviceIdentifier); | ||
} | ||
if(simDeviceSet) { | ||
var deviceSet = simDeviceSet("defaultSet"); | ||
var devices = deviceSet("availableDevices"); | ||
var count = devices("count"); | ||
for(var index=0; index < count; index++) { | ||
var device = devices("objectAtIndex", index); | ||
var deviceIdentifier = device("deviceType")("identifier").toString(); | ||
var deviceIdentifierPrefixIndex = deviceIdentifier.indexOf(XCode6Simulator.DEFAULT_DEVICE_IDENTIFIER); | ||
var deviceIdentifierWithoutPrefix = deviceIdentifier.substring(deviceIdentifierPrefixIndex + XCode6Simulator.DEVICE_IDENTIFIER_PREFIX.length + 2); | ||
var runtimeVersion = device("runtime")("versionString").toString(); | ||
var deviceInfo = [util.format("Device Identifier: %s", deviceIdentifierWithoutPrefix), | ||
util.format("Runtime Version: %s", runtimeVersion)].join(os.EOL); | ||
devicesInfo.push(deviceInfo + os.EOL); | ||
} | ||
} | ||
return devicesInfo; | ||
public get deviceIdentifiersInfo(): string[] { | ||
var devices = this.getDevicesInfo(); | ||
return _.map(devices, device => util.format("Device Identifier: %s. %sRuntime Version: %s %s", device.fullDeviceIdentifier, os.EOL, device.runtimeVersion, os.EOL)); | ||
} | ||
@@ -55,2 +39,9 @@ | ||
private getDevicesInfo(): IDevice[] { | ||
return <IDevice[]> _(this.getAvailableDevices()) | ||
.map(_.identity) | ||
.flatten() | ||
.value(); | ||
} | ||
private get deviceIdentifier(): string { | ||
@@ -60,3 +51,3 @@ return options.device || XCode6Simulator.DEFAULT_DEVICE_IDENTIFIER; | ||
private getAvailableDevices(): IDictionary<IDevice> { | ||
private getAvailableDevices(): IDictionary<IDevice[]> { | ||
if(_.isEmpty(this.availableDevices)) { | ||
@@ -69,9 +60,19 @@ var deviceSet = $.classDefinition.getClassByName("SimDeviceSet")("defaultSet"); | ||
var device = devices("objectAtIndex", index); | ||
var deviceTypeIdentifier = device("deviceType")("identifier").toString(); | ||
var deviceIdentifier = device("deviceType")("identifier").toString(); | ||
var deviceIdentifierPrefixIndex = deviceIdentifier.indexOf(XCode6Simulator.DEVICE_IDENTIFIER_PREFIX); | ||
var deviceIdentifierWithoutPrefix = deviceIdentifier.substring(deviceIdentifierPrefixIndex + XCode6Simulator.DEVICE_IDENTIFIER_PREFIX.length + 1); | ||
var runtimeVersion = device("runtime")("versionString").toString(); | ||
this.availableDevices[deviceTypeIdentifier] = { | ||
if(!this.availableDevices[deviceIdentifier]) { | ||
this.availableDevices[deviceIdentifier] = []; | ||
} | ||
this.availableDevices[deviceIdentifier].push({ | ||
device: device, | ||
deviceTypeIdentifier: deviceTypeIdentifier, | ||
deviceIdentifier: deviceIdentifierWithoutPrefix, | ||
fullDeviceIdentifier: this.buildFullDeviceIdentifier(deviceIdentifier), | ||
runtimeVersion: runtimeVersion | ||
}; | ||
}); | ||
} | ||
@@ -85,8 +86,8 @@ } | ||
private getDeviceByIdentifier(deviceIdentifier: string): any { | ||
var fullDeviceIdentifier = util.format("%s.%s", XCode6Simulator.DEVICE_IDENTIFIER_PREFIX, deviceIdentifier); | ||
var availableDevices = this.getAvailableDevices(); | ||
if(!_.isEmpty(availableDevices)) { | ||
var fullDeviceIdentifier = this.buildFullDeviceIdentifier(deviceIdentifier); | ||
var selectedDevice = availableDevices[fullDeviceIdentifier]; | ||
if(selectedDevice) { | ||
return selectedDevice.device; | ||
return selectedDevice[0].device; | ||
} | ||
@@ -97,2 +98,6 @@ } | ||
} | ||
private buildFullDeviceIdentifier(deviceIdentifier: string): string { | ||
return util.format("%s.%s", XCode6Simulator.DEVICE_IDENTIFIER_PREFIX, deviceIdentifier); | ||
} | ||
} |
@@ -33,3 +33,3 @@ ///<reference path="./.d.ts"/> | ||
var simulator = _this.createSimulator(); | ||
_.each(simulator.validDeviceIdentifiers, function (identifier) { | ||
_.each(simulator.deviceIdentifiersInfo, function (identifier) { | ||
return console.log(identifier); | ||
@@ -36,0 +36,0 @@ }); |
@@ -43,3 +43,3 @@ ///<reference path="./.d.ts"/> | ||
var simulator = this.createSimulator(); | ||
_.each(simulator.validDeviceIdentifiers, (identifier: any) => console.log(identifier)); | ||
_.each(simulator.deviceIdentifiersInfo, (identifier: any) => console.log(identifier)); | ||
} | ||
@@ -46,0 +46,0 @@ |
@@ -0,0 +0,0 @@ ///<reference path=".d.ts"/> |
@@ -0,0 +0,0 @@ ///<reference path=".d.ts"/> |
@@ -0,0 +0,0 @@ function stringify(arr, delimiter) { |
@@ -0,0 +0,0 @@ export function stringify(arr: string[], delimiter?: string): string { |
{ | ||
"name": "ios-sim-portable", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "", | ||
@@ -11,4 +11,4 @@ "main": "./lib/ios-sim.js", | ||
"bin": { | ||
"ios-sim-portable": "./bin/ios-sim-portable.js", | ||
"isim": "./bin/ios-sim-portable.js" | ||
"ios-sim-portable": "./bin/ios-sim-portable.js", | ||
"isim": "./bin/ios-sim-portable.js" | ||
}, | ||
@@ -30,16 +30,16 @@ "repository": { | ||
"dependencies": { | ||
"NodObjC": "https://github.com/telerik/NodObjC/tarball/master", | ||
"colors": "0.6.2", | ||
"fibers": "https://github.com/icenium/node-fibers/tarball/v1.0.5.1", | ||
"NodObjC": "https://github.com/telerik/NodObjC/tarball/master", | ||
"underscore": "1.6.0", | ||
"lodash": "3.2.0", | ||
"yargs": "1.2.2" | ||
}, | ||
"devDependencies": { | ||
"grunt-contrib-clean": "0.5.0", | ||
"grunt": "0.4.2", | ||
"grunt-ts": "1.11.2" | ||
"grunt-contrib-clean": "0.5.0", | ||
"grunt": "0.4.2", | ||
"grunt-ts": "1.11.2" | ||
}, | ||
"engines": { | ||
"node": ">=0.10.26 <0.10.34 || >=0.10.35 <0.11.0" | ||
"node": ">=0.10.26 <0.10.34 || >=0.10.35" | ||
} | ||
} |
@@ -0,0 +0,0 @@ var fs = require("fs"); |
@@ -0,0 +0,0 @@ ios-sim-portable |
@@ -0,0 +0,0 @@ --[]-- |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
268830
7855
37
2
+ Addedlodash@3.2.0
+ Addedlodash@3.2.0(transitive)
- Removedunderscore@1.6.0
- Removedunderscore@1.6.0(transitive)