Created
April 29, 2015 05:39
-
-
Save xedef/5d5094d0b063876094fa to your computer and use it in GitHub Desktop.
Generate iOS Simulators IDs for a given iOS version
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Usage: | |
* node ios-device-ids.js <ios_version> | |
*/ | |
var ioslib = require('ioslib'), | |
_ = require('underscore'), | |
args = process.argv.slice(2); | |
if (args && args[0]) | |
{ | |
var version = args[0] + ''; | |
ioslib.simulator.detect(function(err, result){ | |
if (_.has(result.simulators, version)) | |
{ | |
var recipes = loadSimulators(result.simulators[version]); | |
console.log(JSON.stringify(recipes)); | |
} else { | |
console.error('iOS SDK version "%s" not installed', version); | |
} | |
}); | |
} | |
function loadSimulators(simulators) | |
{ | |
var recipes = {}; | |
_.each(simulators, function(simulator){ | |
var recipeId = simulator.deviceType.toLowerCase().replace(/ /g, ''); | |
recipes[recipeId] = ['-C', simulator.udid]; | |
}); | |
return recipes; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment