Skip to content

Commit

Permalink
Fixed many bugs with handling simulators including autoselecting ios …
Browse files Browse the repository at this point in the history
…and watch sims.
  • Loading branch information
cb1kenobi committed Jul 30, 2015
1 parent e5ecf1b commit 34bf34c
Show file tree
Hide file tree
Showing 6 changed files with 1,449 additions and 778 deletions.
1 change: 1 addition & 0 deletions index.js
Expand Up @@ -18,6 +18,7 @@ const
magik = exports.magik = require('./lib/utilities').magik,
provisioning = exports.provisioning = require('./lib/provisioning'),
simulator = exports.simulator = require('./lib/simulator'),
utilities = exports.utilities = require('./lib/utilities'),
xcode = exports.xcode = require('./lib/xcode');

var cache;
Expand Down
17 changes: 11 additions & 6 deletions lib/device.js
Expand Up @@ -40,8 +40,9 @@ exports.install = install;
function detect(options, callback) {
return magik(options, callback, function (emitter, options, callback) {
if (cache && !options.bypassCache) {
emitter.emit('detected', cache);
return callback(null, cache);
var dupe = JSON.parse(JSON.stringify(cache));
emitter.emit('detected', dupe);
return callback(null, dupe);
}

iosDevice.devices(function (err, devices) {
Expand All @@ -50,13 +51,17 @@ function detect(options, callback) {
return callback(err);
}

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

emitter.emit('detected', cache);
return callback(null, cache);
// the cache must be a clean copy that we'll clone for subsequent detect() calls
// because we can't allow the cache to be modified by reference
cache = JSON.parse(JSON.stringify(results));

emitter.emit('detected', results);
return callback(null, results);
});
});
};
Expand Down
Binary file modified lib/iphone_sim_hide.scpt
Binary file not shown.

0 comments on commit 34bf34c

Please sign in to comment.