New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

ios-sim-portable

Package Overview
Dependencies
Maintainers
2
Versions
90
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ios-sim-portable - npm Package Compare versions

Comparing version 1.0.13-beta to 1.0.13-delta

13

lib/command-executor.js
///<reference path="./.d.ts"/>
"use strict";
var fs = require("fs");
var path = require("path");
require("colors");

@@ -17,7 +19,10 @@ var errors = require("./errors");

try {
var command = new (require("./commands/" + commandName).Command)();
if (!command) {
errors.fail("Unable to resolve commandName %s", commandName);
var filePath = path.join(__dirname, "commands", commandName + ".js");
if (fs.existsSync(filePath)) {
var command = new (require(filePath).Command)();
if (!command) {
errors.fail("Unable to resolve commandName %s", commandName);
}
command.execute(commandArguments).wait();
}
command.execute(commandArguments).wait();
}

@@ -24,0 +29,0 @@ catch (e) {

@@ -5,2 +5,4 @@ ///<reference path="./.d.ts"/>

import Future = require("fibers/future");
import fs = require("fs");
import path = require("path");
import util = require("util");

@@ -24,8 +26,12 @@ require("colors");

try {
var command: ICommand = new (require("./commands/" + commandName).Command)();
if(!command) {
errors.fail("Unable to resolve commandName %s", commandName);
let filePath = path.join(__dirname, "commands", commandName + ".js");
if(fs.existsSync(filePath)) {
var command: ICommand = new (require(filePath).Command)();
if(!command) {
errors.fail("Unable to resolve commandName %s", commandName);
}
command.execute(commandArguments).wait();
}
command.execute(commandArguments).wait();
} catch(e) {

@@ -32,0 +38,0 @@ if(options.debug) {

@@ -9,2 +9,3 @@ ///<reference path="./.d.ts"/>

sendNotification(notification: string): IFuture<void>;
createSimulator(): IFuture<ISimulator>;
}

@@ -35,2 +36,3 @@

getDevices(): IFuture<IDevice[]>;
getAppContainer(deviceId: string, applicationIdentifier: string): IFuture<string>;
}

@@ -52,2 +54,3 @@

sendNotification(notification: string): IFuture<void>;
getApplicationPath(deviceId: string, applicationIdentifier: string): IFuture<string>;
}

@@ -54,0 +57,0 @@

@@ -46,5 +46,6 @@ ///<reference path="./.d.ts"/>

}
var libraryPath = require("./simctl");
var obj = new libraryPath.Simctl();
var result = obj.getAppContainer.apply(obj, args).wait();
var libraryPath = require("./iphone-simulator");
var obj = new libraryPath.iPhoneSimulator();
var simulator = obj.createSimulator().wait();
var result = simulator.getApplicationPath.apply(simulator, args).wait();
return result;

@@ -51,0 +52,0 @@ };

@@ -45,5 +45,6 @@ ///<reference path="./.d.ts"/>

return (...args: any[]) => {
let libraryPath = require("./simctl");
let obj = new libraryPath.Simctl()
let result = obj.getAppContainer.apply(obj, args).wait();
let libraryPath = require("./iphone-simulator");
let obj = new libraryPath.iPhoneSimulator();
let simulator = obj.createSimulator().wait();
let result = simulator.getApplicationPath.apply(simulator, args).wait();
return result;

@@ -50,0 +51,0 @@ }

@@ -42,2 +42,5 @@ ///<reference path="./.d.ts"/>

};
XCode5Simulator.prototype.getApplicationPath = function (deviceId, applicationIdentifier) {
return Future.fromResult("");
};
Object.defineProperty(XCode5Simulator.prototype, "deviceIdentifier", {

@@ -44,0 +47,0 @@ get: function () {

@@ -62,2 +62,6 @@ ///<reference path="./.d.ts"/>

public getApplicationPath(deviceId: string, applicationIdentifier: string): IFuture<string> {
return Future.fromResult("");
}
private get deviceIdentifier(): string {

@@ -64,0 +68,0 @@ let identifier = options.device || XCode5Simulator.DEFAULT_DEVICE_IDENTIFIER;

@@ -10,4 +10,9 @@ ///<reference path="./.d.ts"/>

var options = require("./options");
var fs = require("fs");
var Future = require("fibers/future");
var path = require("path");
var util = require("util");
var $ = require("nodobjc");
var bplistParser = require("bplist-parser");
var osenv = require("osenv");
var iPhoneSimulatorBaseLib = require("./iphone-interop-simulator-base");

@@ -35,2 +40,37 @@ var XCode6Simulator = (function (_super) {

};
XCode6Simulator.prototype.getApplicationPath = function (deviceId, applicationIdentifier) {
var _this = this;
return (function () {
var rootApplicationsPath = path.join(osenv.home(), "/Library/Developer/CoreSimulator/Devices/" + deviceId + "/data/Containers/Bundle/Application");
if (!fs.existsSync(rootApplicationsPath)) {
rootApplicationsPath = path.join(osenv.home(), "/Library/Developer/CoreSimulator/Devices/" + deviceId + "/data/Applications");
}
var applicationGuids = fs.readdirSync(rootApplicationsPath);
var result = null;
_.each(applicationGuids, function (applicationGuid) {
var fullApplicationPath = path.join(rootApplicationsPath, applicationGuid);
var applicationDirContents = fs.readdirSync(fullApplicationPath);
var applicationName = _.find(applicationDirContents, function (fileName) { return path.extname(fileName) === ".app"; });
var plistFilePath = path.join(fullApplicationPath, applicationName, "Info.plist");
var applicationData = _this.parseFile(plistFilePath).wait();
if (applicationData[0].CFBundleIdentifier === applicationIdentifier) {
result = path.join(fullApplicationPath, applicationName);
return false;
}
});
return result;
}).future()();
};
XCode6Simulator.prototype.parseFile = function (plistFilePath) {
var future = new Future();
bplistParser.parseFile(plistFilePath, function (err, obj) {
if (err) {
future.throw(err);
}
else {
future.return(obj);
}
});
return future;
};
Object.defineProperty(XCode6Simulator.prototype, "devices", {

@@ -37,0 +77,0 @@ get: function () {

@@ -6,5 +6,10 @@ ///<reference path="./.d.ts"/>

import * as utils from "./utils";
import * as fs from "fs";
import Future = require("fibers/future");
import * as path from "path";
import * as util from "util";
import * as os from "os";
let $ = require("nodobjc");
let bplistParser = require("bplist-parser");
let osenv = require("osenv");

@@ -43,2 +48,38 @@ import iPhoneSimulatorBaseLib = require("./iphone-interop-simulator-base");

public getApplicationPath(deviceId: string, applicationIdentifier: string): IFuture<string> {
return (() => {
let rootApplicationsPath = path.join(osenv.home(), `/Library/Developer/CoreSimulator/Devices/${deviceId}/data/Containers/Bundle/Application`);
if(!fs.existsSync(rootApplicationsPath)) {
rootApplicationsPath = path.join(osenv.home(), `/Library/Developer/CoreSimulator/Devices/${deviceId}/data/Applications`);
}
let applicationGuids = fs.readdirSync(rootApplicationsPath);
let result: string = null;
_.each(applicationGuids, applicationGuid => {
let fullApplicationPath = path.join(rootApplicationsPath, applicationGuid);
let applicationDirContents = fs.readdirSync(fullApplicationPath);
let applicationName = _.find(applicationDirContents, fileName => path.extname(fileName) === ".app");
let plistFilePath = path.join(fullApplicationPath, applicationName, "Info.plist");
let applicationData = this.parseFile(plistFilePath).wait();
if(applicationData[0].CFBundleIdentifier === applicationIdentifier) {
result = path.join(fullApplicationPath, applicationName);
return false;
}
});
return result;
}).future<string>()();
}
private parseFile(plistFilePath: string): IFuture<any> {
let future = new Future<any>();
bplistParser.parseFile(plistFilePath, (err: Error, obj: any) => {
if(err) {
future.throw(err);
} else {
future.return(obj);
}
});
return future;
}
private get devices(): IDevice[] {

@@ -45,0 +86,0 @@ if(!this.cachedDevices) {

@@ -60,2 +60,5 @@ ///<reference path="./.d.ts"/>

};
XCode7Simulator.prototype.getApplicationPath = function (deviceId, applicationIdentifier) {
return this.simctl.getAppContainer(deviceId, applicationIdentifier);
};
XCode7Simulator.prototype.getDeviceToRun = function () {

@@ -62,0 +65,0 @@ var _this = this;

@@ -73,2 +73,6 @@ ///<reference path="./.d.ts"/>

public getApplicationPath(deviceId: string, applicationIdentifier: string): IFuture<string> {
return this.simctl.getAppContainer(deviceId, applicationIdentifier);
}
private getDeviceToRun(): IFuture<IDevice> {

@@ -75,0 +79,0 @@ return (() => {

@@ -78,3 +78,3 @@ ///<reference path="./.d.ts"/>

private createSimulator(): IFuture<ISimulator> {
public createSimulator(): IFuture<ISimulator> {
return (() => {

@@ -81,0 +81,0 @@ let xcodeVersionData = xcode.getXcodeVersionData().wait();

@@ -8,3 +8,2 @@ ///<reference path="./.d.ts"/>

function Simctl() {
this.devices = null;
}

@@ -38,11 +37,2 @@ Simctl.prototype.launch = function (deviceId, applicationIdentifier) {

return (function () {
if (!_this.devices) {
_this.devices = _this.getDevicesCore().wait();
}
return _this.devices;
}).future()();
};
Simctl.prototype.getDevicesCore = function () {
var _this = this;
return (function () {
var rawDevices = _this.simctlExec("list", ["devices"]).wait();

@@ -49,0 +39,0 @@ // expect to get a listing like

@@ -10,3 +10,2 @@ ///<reference path="./.d.ts"/>

export class Simctl implements ISimctl {
private devices: IDevice[] = null;

@@ -47,12 +46,2 @@ public launch(deviceId: string, applicationIdentifier: string): IFuture<void> {

return (() => {
if(!this.devices) {
this.devices = this.getDevicesCore().wait();
}
return this.devices;
}).future<IDevice[]>()();
}
private getDevicesCore(): IFuture<IDevice[]> {
return (() => {
let rawDevices = this.simctlExec("list", ["devices"]).wait();

@@ -59,0 +48,0 @@

{
"name": "ios-sim-portable",
"version": "1.0.13-beta",
"version": "1.0.13-delta",
"description": "",

@@ -29,2 +29,3 @@ "main": "./lib/ios-sim.js",

"dependencies": {
"bplist-parser": "0.1.0",
"colors": "0.6.2",

@@ -34,2 +35,3 @@ "fibers": "https://github.com/icenium/node-fibers/tarball/v1.0.6.0",

"nodobjc": "https://github.com/telerik/NodObjC/tarball/v2.0.0.0",
"osenv": "0.1.3",
"yargs": "3.15.0"

@@ -36,0 +38,0 @@ },

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc