How to use node-ios-device - 10 common examples

To help you get started, we’ve selected a few node-ios-device examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github appcelerator / titanium_mobile / node_modules / ioslib / lib / device.js View on Github external
timer = setTimeout(function () {
						// logs quieted down, go ahead and install
						state = INSTALLING;
						iosDevice.installApp(udid, appPath, function (err) {
							if (err) {
								emitter.emit('error', err);
								trackOff();
								logOff && logOff();
							} else {
								emitter.emit('installed');
							}
							callback(err);
						});
					}, 500);
				} else if (state == INSTALLING) {
github appcelerator / ioslib / lib / device.js View on Github external
return magik(options, null, function (handle, options) {
		if (!appPath) {
			return handle.emit('error', new Error(__('Missing app path argument')));
		}

		if (!fs.existsSync(appPath)) {
			return handle.emit('error', new Error(__('App path does not exist: ' + appPath)));
		}

		handle.stop = function () {}; // for stopping logging

		iosDevice.installApp(udid, appPath, function (err) {
			if (err) {
				return handle.emit('error', err);
			}

			handle.emit('installed');

			if (options.logPort) {
				var logHandle = iosDevice
					.log(udid, options.logPort)
					.on('log', function (msg) {
						handle.emit('log', msg);
					})
					.on('app-started', function () {
						handle.emit('app-started');
					})
					.on('app-quit', function () {
github appcelerator / titanium_mobile / node_modules / ioslib / lib / device.js View on Github external
process.nextTick(function () {
		try {
			logOff = iosDevice.log(udid, function (msg) {
				if (state == PUMPING_LOG) {
					// we create a timer here so that if we haven't received any messages for a
					// half second, then the log must be caught up and we're ready to install
					clearTimeout(timer);
					timer = setTimeout(function () {
						// logs quieted down, go ahead and install
						state = INSTALLING;
						iosDevice.installApp(udid, appPath, function (err) {
							if (err) {
								emitter.emit('error', err);
								trackOff();
								logOff && logOff();
							} else {
								emitter.emit('installed');
							}
							callback(err);
github appcelerator / titanium_mobile / node_modules / ioslib / lib / device.js View on Github external
return emitter;
	}

	var appName = options.appName || path.basename(appPath).replace(/\.app$/, ''),
		installedRegExp = new RegExp(' installd\\[.* Installing .*' + appId),
		logRegExp = new RegExp(' ' + appName + '\\[(\\d+)\\][^:]+: (.*)'),
		quitRegExp = new RegExp(' backboardd\\[[^:]+: Application .+\\:' + appId + '\\['),
		lastLineWasOurs = false,
		PUMPING_LOG = 1,
		INSTALLING = 2,
		INSTALLED = 3,
		RUNNING = 4,
		state = PUMPING_LOG,
		timer = null,
		logOff,
		trackOff = iosDevice.trackDevices(function (err, devices) {
			if (!devices.some(function (device) { return device.udid === udid; })) {
				trackOff();
				logOff && logOff();
				if (state === RUNNING) {
					emitter.emit('app-quit');
				}
				emitter.emit('disconnect');
			}
		});

	process.nextTick(function () {
		try {
			logOff = iosDevice.log(udid, function (msg) {
				if (state == PUMPING_LOG) {
					// we create a timer here so that if we haven't received any messages for a
					// half second, then the log must be caught up and we're ready to install
github appcelerator / titanium_mobile / node_modules / ioslib / lib / device.js View on Github external
var err = new Error(__('Unsupported platform "%s"', process.platform));
			emitter.emit('error', err);
			callback(err);
		});
		return emitter;
	}

	if (cache && !options.bypassCache) {
		process.nextTick(function () {
			emitter.emit('detected', cache);
			callback(null, cache);
		});
		return emitter;
	}

	iosDevice.devices(function (err, devices) {
		process.nextTick(function () {
			if (err) {
				emitter.emit('error', err);
				return callback(err);
			}

			cache = {
				devices: JSON.parse(JSON.stringify(devices)),
				issues: []
			};

			emitter.emit('detected', cache);
			callback(null, cache);
		});
	});
github appcelerator / ioslib / lib / device.js View on Github external
iosDevice.installApp(udid, appPath, function (err) {
			if (err) {
				return handle.emit('error', err);
			}

			handle.emit('installed');

			if (options.logPort) {
				var logHandle = iosDevice
					.log(udid, options.logPort)
					.on('log', function (msg) {
						handle.emit('log', msg);
					})
					.on('app-started', function () {
						handle.emit('app-started');
					})
					.on('app-quit', function () {
						handle.emit('app-quit');
					})
					.on('disconnect', function () {
						handle.emit('disconnect');
					})
					.on('error', function (err) {
						handle.emit('log-error', err);
					});
github appcelerator / titanium_mobile / iphone / cli / lib / detect.js View on Github external
exports.detectDevices = function detectDevices(finished) {
	iosDevice.devices(function (err, devices) {
		if (err) {
			finished(err);
		} else {
			devices.unshift({
				udid: 'itunes',
				name: __('iTunes Sync')
			});
			finished(null, devices.map(function (d) {
				d.id = d.udid;
				return d;
			}));
		}
	});
};
github jeffbonnes / ti-adp / hooks / hook.js View on Github external
function checkAttachedDevices(info) {
	if (process.argv.indexOf('--auto-device') !== -1) {
		logger.info('Getting details of attached devices.');
		iosDevice.devices(function(err, devices) {
			logger.info("Found " + devices.length + " connected devices");
			if (devices.length == 1) {
				selectedDevice = devices[0];
				logger.info('Attached device name: ' + selectedDevice.name);
				device.name = selectedDevice.name;
				device.UDID = selectedDevice.udid;
				getPPDetails(info);
			} else if (devices.length > 1) {
				//prompt user to select the device
				promptToSelectDevice(devices, function(selected) {
					selectedDevice = JSON.parse(selected);
					logger.info('Selected device name' + selectedDevice.name);
					device.name = selectedDevice.name;
					device.UDID = selectedDevice.udid;
					addCliArg(cli, 'C', selectedDevice.udid);
					getPPDetails(info);
github appcelerator / ioslib / src / devices.js View on Github external
return tailgate('ioslib:devices', () => new Promise((resolve, reject) => {
		iosDevice.devices((err, devices) => {
			return err ? reject(err) : resolve(devices.map(d => new Device(d)));
		});
	}));
}

node-ios-device

Simple library for listing and installing apps on iOS devices

Apache-2.0
Latest version published 5 months ago

Package Health Score

62 / 100
Full package analysis