cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From macdo...@apache.org
Subject [1/3] ios commit: CB-9328 Use ios-sim as a node module, not a CLI utility
Date Tue, 22 Sep 2015 16:51:33 GMT
Repository: cordova-ios
Updated Branches:
  refs/heads/master cbe21f885 -> 89eac6c93


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/89eac6c9/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/mkdir.js
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/mkdir.js b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/mkdir.js
new file mode 100644
index 0000000..5a7088f
--- /dev/null
+++ b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/mkdir.js
@@ -0,0 +1,68 @@
+var common = require('./common');
+var fs = require('fs');
+var path = require('path');
+
+// Recursively creates 'dir'
+function mkdirSyncRecursive(dir) {
+  var baseDir = path.dirname(dir);
+
+  // Base dir exists, no recursion necessary
+  if (fs.existsSync(baseDir)) {
+    fs.mkdirSync(dir, parseInt('0777', 8));
+    return;
+  }
+
+  // Base dir does not exist, go recursive
+  mkdirSyncRecursive(baseDir);
+
+  // Base dir created, can create dir
+  fs.mkdirSync(dir, parseInt('0777', 8));
+}
+
+//@
+//@ ### mkdir([options ,] dir [, dir ...])
+//@ ### mkdir([options ,] dir_array)
+//@ Available options:
+//@
+//@ + `p`: full path (will create intermediate dirs if necessary)
+//@
+//@ Examples:
+//@
+//@ ```javascript
+//@ mkdir('-p', '/tmp/a/b/c/d', '/tmp/e/f/g');
+//@ mkdir('-p', ['/tmp/a/b/c/d', '/tmp/e/f/g']); // same as above
+//@ ```
+//@
+//@ Creates directories.
+function _mkdir(options, dirs) {
+  options = common.parseOptions(options, {
+    'p': 'fullpath'
+  });
+  if (!dirs)
+    common.error('no paths given');
+
+  if (typeof dirs === 'string')
+    dirs = [].slice.call(arguments, 1);
+  // if it's array leave it as it is
+
+  dirs.forEach(function(dir) {
+    if (fs.existsSync(dir)) {
+      if (!options.fullpath)
+          common.error('path already exists: ' + dir, true);
+      return; // skip dir
+    }
+
+    // Base dir does not exist, and no -p option given
+    var baseDir = path.dirname(dir);
+    if (!fs.existsSync(baseDir) && !options.fullpath) {
+      common.error('no such file or directory: ' + baseDir, true);
+      return; // skip dir
+    }
+
+    if (options.fullpath)
+      mkdirSyncRecursive(dir);
+    else
+      fs.mkdirSync(dir, parseInt('0777', 8));
+  });
+} // mkdir
+module.exports = _mkdir;

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/89eac6c9/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/mv.js
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/mv.js b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/mv.js
new file mode 100644
index 0000000..11f9607
--- /dev/null
+++ b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/mv.js
@@ -0,0 +1,80 @@
+var fs = require('fs');
+var path = require('path');
+var common = require('./common');
+
+//@
+//@ ### mv(source [, source ...], dest')
+//@ ### mv(source_array, dest')
+//@ Available options:
+//@
+//@ + `f`: force
+//@
+//@ Examples:
+//@
+//@ ```javascript
+//@ mv('-f', 'file', 'dir/');
+//@ mv('file1', 'file2', 'dir/');
+//@ mv(['file1', 'file2'], 'dir/'); // same as above
+//@ ```
+//@
+//@ Moves files. The wildcard `*` is accepted.
+function _mv(options, sources, dest) {
+  options = common.parseOptions(options, {
+    'f': 'force'
+  });
+
+  // Get sources, dest
+  if (arguments.length < 3) {
+    common.error('missing <source> and/or <dest>');
+  } else if (arguments.length > 3) {
+    sources = [].slice.call(arguments, 1, arguments.length - 1);
+    dest = arguments[arguments.length - 1];
+  } else if (typeof sources === 'string') {
+    sources = [sources];
+  } else if ('length' in sources) {
+    sources = sources; // no-op for array
+  } else {
+    common.error('invalid arguments');
+  }
+
+  sources = common.expand(sources);
+
+  var exists = fs.existsSync(dest),
+      stats = exists && fs.statSync(dest);
+
+  // Dest is not existing dir, but multiple sources given
+  if ((!exists || !stats.isDirectory()) && sources.length > 1)
+    common.error('dest is not a directory (too many sources)');
+
+  // Dest is an existing file, but no -f given
+  if (exists && stats.isFile() && !options.force)
+    common.error('dest file already exists: ' + dest);
+
+  sources.forEach(function(src) {
+    if (!fs.existsSync(src)) {
+      common.error('no such file or directory: '+src, true);
+      return; // skip file
+    }
+
+    // If here, src exists
+
+    // When copying to '/path/dir':
+    //    thisDest = '/path/dir/file1'
+    var thisDest = dest;
+    if (fs.existsSync(dest) && fs.statSync(dest).isDirectory())
+      thisDest = path.normalize(dest + '/' + path.basename(src));
+
+    if (fs.existsSync(thisDest) && !options.force) {
+      common.error('dest file already exists: ' + thisDest, true);
+      return; // skip file
+    }
+
+    if (path.resolve(src) === path.dirname(path.resolve(thisDest))) {
+      common.error('cannot move to self: '+src, true);
+      return; // skip file
+    }
+
+    fs.renameSync(src, thisDest);
+  }); // forEach(src)
+} // mv
+module.exports = _mv;

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/89eac6c9/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/popd.js
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/popd.js b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/popd.js
new file mode 100644
index 0000000..11ea24f
--- /dev/null
+++ b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/popd.js
@@ -0,0 +1 @@
+// see dirs.js
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/89eac6c9/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/pushd.js
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/pushd.js b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/pushd.js
new file mode 100644
index 0000000..11ea24f
--- /dev/null
+++ b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/pushd.js
@@ -0,0 +1 @@
+// see dirs.js
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/89eac6c9/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/pwd.js
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/pwd.js b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/pwd.js
new file mode 100644
index 0000000..41727bb
--- /dev/null
+++ b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/pwd.js
@@ -0,0 +1,11 @@
+var path = require('path');
+var common = require('./common');
+
+//@
+//@ ### pwd()
+//@ Returns the current directory.
+function _pwd(options) {
+  var pwd = path.resolve(process.cwd());
+  return common.ShellString(pwd);
+}
+module.exports = _pwd;

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/89eac6c9/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/rm.js
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/rm.js b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/rm.js
new file mode 100644
index 0000000..3abe6e1
--- /dev/null
+++ b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/rm.js
@@ -0,0 +1,145 @@
+var common = require('./common');
+var fs = require('fs');
+
+// Recursively removes 'dir'
+// Adapted from https://github.com/ryanmcgrath/wrench-js
+//
+// Copyright (c) 2010 Ryan McGrath
+// Copyright (c) 2012 Artur Adib
+//
+// Licensed under the MIT License
+// http://www.opensource.org/licenses/mit-license.php
+function rmdirSyncRecursive(dir, force) {
+  var files;
+
+  files = fs.readdirSync(dir);
+
+  // Loop through and delete everything in the sub-tree after checking it
+  for(var i = 0; i < files.length; i++) {
+    var file = dir + "/" + files[i],
+        currFile = fs.lstatSync(file);
+
+    if(currFile.isDirectory()) { // Recursive function back to the beginning
+      rmdirSyncRecursive(file, force);
+    }
+
+    else if(currFile.isSymbolicLink()) { // Unlink symlinks
+      if (force || isWriteable(file)) {
+        try {
+          common.unlinkSync(file);
+        } catch (e) {
+          common.error('could not remove file (code '+e.code+'): ' + file, true);
+        }
+      }
+    }
+
+    else // Assume it's a file - perhaps a try/catch belongs here?
+      if (force || isWriteable(file)) {
+        try {
+          common.unlinkSync(file);
+        } catch (e) {
+          common.error('could not remove file (code '+e.code+'): ' + file, true);
+        }
+      }
+  }
+
+  // Now that we know everything in the sub-tree has been deleted, we can delete the main directory.
+  // Huzzah for the shopkeep.
+
+  var result;
+  try {
+    result = fs.rmdirSync(dir);
+  } catch(e) {
+    common.error('could not remove directory (code '+e.code+'): ' + dir, true);
+  }
+
+  return result;
+} // rmdirSyncRecursive
+
+// Hack to determine if file has write permissions for current user
+// Avoids having to check user, group, etc, but it's probably slow
+function isWriteable(file) {
+  var writePermission = true;
+  try {
+    var __fd = fs.openSync(file, 'a');
+    fs.closeSync(__fd);
+  } catch(e) {
+    writePermission = false;
+  }
+
+  return writePermission;
+}
+
+//@
+//@ ### rm([options ,] file [, file ...])
+//@ ### rm([options ,] file_array)
+//@ Available options:
+//@
+//@ + `-f`: force
+//@ + `-r, -R`: recursive
+//@
+//@ Examples:
+//@
+//@ ```javascript
+//@ rm('-rf', '/tmp/*');
+//@ rm('some_file.txt', 'another_file.txt');
+//@ rm(['some_file.txt', 'another_file.txt']); // same as above
+//@ ```
+//@
+//@ Removes files. The wildcard `*` is accepted.
+function _rm(options, files) {
+  options = common.parseOptions(options, {
+    'f': 'force',
+    'r': 'recursive',
+    'R': 'recursive'
+  });
+  if (!files)
+    common.error('no paths given');
+
+  if (typeof files === 'string')
+    files = [].slice.call(arguments, 1);
+  // if it's array leave it as it is
+
+  files = common.expand(files);
+
+  files.forEach(function(file) {
+    if (!fs.existsSync(file)) {
+      // Path does not exist, no force flag given
+      if (!options.force)
+        common.error('no such file or directory: '+file, true);
+
+      return; // skip file
+    }
+
+    // If here, path exists
+
+    var stats = fs.lstatSync(file);
+    if (stats.isFile() || stats.isSymbolicLink()) {
+
+      // Do not check for file writing permissions
+      if (options.force) {
+        common.unlinkSync(file);
+        return;
+      }
+
+      if (isWriteable(file))
+        common.unlinkSync(file);
+      else
+        common.error('permission denied: '+file, true);
+
+      return;
+    } // simple file
+
+    // Path is an existing directory, but no -r flag given
+    if (stats.isDirectory() && !options.recursive) {
+      common.error('path is a directory', true);
+      return; // skip path
+    }
+
+    // Recursively remove existing directory
+    if (stats.isDirectory() && options.recursive) {
+      rmdirSyncRecursive(file, options.force);
+    }
+  }); // forEach(file)
+} // rm
+module.exports = _rm;

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/89eac6c9/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/sed.js
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/sed.js b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/sed.js
new file mode 100644
index 0000000..9783252
--- /dev/null
+++ b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/sed.js
@@ -0,0 +1,43 @@
+var common = require('./common');
+var fs = require('fs');
+
+//@
+//@ ### sed([options ,] search_regex, replace_str, file)
+//@ Available options:
+//@
+//@ + `-i`: Replace contents of 'file' in-place. _Note that no backups will be created!_
+//@
+//@ Examples:
+//@
+//@ ```javascript
+//@ sed('-i', 'PROGRAM_VERSION', 'v0.1.3', 'source.js');
+//@ sed(/.*DELETE_THIS_LINE.*\n/, '', 'source.js');
+//@ ```
+//@
+//@ Reads an input string from `file` and performs a JavaScript `replace()` on the input
+//@ using the given search regex and replacement string. Returns the new string after replacement.
+function _sed(options, regex, replacement, file) {
+  options = common.parseOptions(options, {
+    'i': 'inplace'
+  });
+
+  if (typeof replacement === 'string')
+    replacement = replacement; // no-op
+  else if (typeof replacement === 'number')
+    replacement = replacement.toString(); // fallback
+  else
+    common.error('invalid replacement string');
+
+  if (!file)
+    common.error('no file given');
+
+  if (!fs.existsSync(file))
+    common.error('no such file or directory: ' + file);
+
+  var result = fs.readFileSync(file, 'utf8').replace(regex, replacement);
+  if (options.inplace)
+    fs.writeFileSync(file, result, 'utf8');
+
+  return common.ShellString(result);
+}
+module.exports = _sed;

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/89eac6c9/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/tempdir.js
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/tempdir.js b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/tempdir.js
new file mode 100644
index 0000000..45953c2
--- /dev/null
+++ b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/tempdir.js
@@ -0,0 +1,56 @@
+var common = require('./common');
+var os = require('os');
+var fs = require('fs');
+
+// Returns false if 'dir' is not a writeable directory, 'dir' otherwise
+function writeableDir(dir) {
+  if (!dir || !fs.existsSync(dir))
+    return false;
+
+  if (!fs.statSync(dir).isDirectory())
+    return false;
+
+  var testFile = dir+'/'+common.randomFileName();
+  try {
+    fs.writeFileSync(testFile, ' ');
+    common.unlinkSync(testFile);
+    return dir;
+  } catch (e) {
+    return false;
+  }
+}
+
+
+//@
+//@ ### tempdir()
+//@
+//@ Examples:
+//@
+//@ ```javascript
+//@ var tmp = tempdir(); // "/tmp" for most *nix platforms
+//@ ```
+//@
+//@ Searches and returns string containing a writeable, platform-dependent temporary directory.
+//@ Follows Python's [tempfile algorithm](http://docs.python.org/library/tempfile.html#tempfile.tempdir).
+function _tempDir() {
+  var state = common.state;
+  if (state.tempDir)
+    return state.tempDir; // from cache
+
+  state.tempDir = writeableDir(os.tempDir && os.tempDir()) || // node 0.8+
+                  writeableDir(process.env['TMPDIR']) ||
+                  writeableDir(process.env['TEMP']) ||
+                  writeableDir(process.env['TMP']) ||
+                  writeableDir(process.env['Wimp$ScrapDir']) || // RiscOS
+                  writeableDir('C:\\TEMP') || // Windows
+                  writeableDir('C:\\TMP') || // Windows
+                  writeableDir('\\TEMP') || // Windows
+                  writeableDir('\\TMP') || // Windows
+                  writeableDir('/tmp') ||
+                  writeableDir('/var/tmp') ||
+                  writeableDir('/usr/tmp') ||
+                  writeableDir('.'); // last resort
+
+  return state.tempDir;
+}
+module.exports = _tempDir;

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/89eac6c9/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/test.js
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/test.js b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/test.js
new file mode 100644
index 0000000..8a4ac7d
--- /dev/null
+++ b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/test.js
@@ -0,0 +1,85 @@
+var common = require('./common');
+var fs = require('fs');
+
+//@
+//@ ### test(expression)
+//@ Available expression primaries:
+//@
+//@ + `'-b', 'path'`: true if path is a block device
+//@ + `'-c', 'path'`: true if path is a character device
+//@ + `'-d', 'path'`: true if path is a directory
+//@ + `'-e', 'path'`: true if path exists
+//@ + `'-f', 'path'`: true if path is a regular file
+//@ + `'-L', 'path'`: true if path is a symboilc link
+//@ + `'-p', 'path'`: true if path is a pipe (FIFO)
+//@ + `'-S', 'path'`: true if path is a socket
+//@
+//@ Examples:
+//@
+//@ ```javascript
+//@ if (test('-d', path)) { /* do something with dir */ };
+//@ if (!test('-f', path)) continue; // skip if it's a regular file
+//@ ```
+//@
+//@ Evaluates expression using the available primaries and returns corresponding value.
+function _test(options, path) {
+  if (!path)
+    common.error('no path given');
+
+  // hack - only works with unary primaries
+  options = common.parseOptions(options, {
+    'b': 'block',
+    'c': 'character',
+    'd': 'directory',
+    'e': 'exists',
+    'f': 'file',
+    'L': 'link',
+    'p': 'pipe',
+    'S': 'socket'
+  });
+
+  var canInterpret = false;
+  for (var key in options)
+    if (options[key] === true) {
+      canInterpret = true;
+      break;
+    }
+
+  if (!canInterpret)
+    common.error('could not interpret expression');
+
+  if (options.link) {
+    try {
+      return fs.lstatSync(path).isSymbolicLink();
+    } catch(e) {
+      return false;
+    }
+  }
+
+  if (!fs.existsSync(path))
+    return false;
+
+  if (options.exists)
+    return true;
+
+  var stats = fs.statSync(path);
+
+  if (options.block)
+    return stats.isBlockDevice();
+
+  if (options.character)
+    return stats.isCharacterDevice();
+
+  if (options.directory)
+    return stats.isDirectory();
+
+  if (options.file)
+    return stats.isFile();
+
+  if (options.pipe)
+    return stats.isFIFO();
+
+  if (options.socket)
+    return stats.isSocket();
+} // test
+module.exports = _test;

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/89eac6c9/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/to.js
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/to.js b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/to.js
new file mode 100644
index 0000000..f029999
--- /dev/null
+++ b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/to.js
@@ -0,0 +1,29 @@
+var common = require('./common');
+var fs = require('fs');
+var path = require('path');
+
+//@
+//@ ### 'string'.to(file)
+//@
+//@ Examples:
+//@
+//@ ```javascript
+//@ cat('input.txt').to('output.txt');
+//@ ```
+//@
+//@ Analogous to the redirection operator `>` in Unix, but works with JavaScript strings (such as
+//@ those returned by `cat`, `grep`, etc). _Like Unix redirections, `to()` will overwrite any existing file!_
+function _to(options, file) {
+  if (!file)
+    common.error('wrong arguments');
+
+  if (!fs.existsSync( path.dirname(file) ))
+      common.error('no such file or directory: ' + path.dirname(file));
+
+  try {
+    fs.writeFileSync(file, this.toString(), 'utf8');
+  } catch(e) {
+    common.error('could not write to file (code '+e.code+'): '+file, true);
+  }
+}
+module.exports = _to;

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/89eac6c9/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/toEnd.js
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/toEnd.js b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/toEnd.js
new file mode 100644
index 0000000..f6d099d
--- /dev/null
+++ b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/toEnd.js
@@ -0,0 +1,29 @@
+var common = require('./common');
+var fs = require('fs');
+var path = require('path');
+
+//@
+//@ ### 'string'.toEnd(file)
+//@
+//@ Examples:
+//@
+//@ ```javascript
+//@ cat('input.txt').toEnd('output.txt');
+//@ ```
+//@
+//@ Analogous to the redirect-and-append operator `>>` in Unix, but works with JavaScript strings (such as
+//@ those returned by `cat`, `grep`, etc).
+function _toEnd(options, file) {
+  if (!file)
+    common.error('wrong arguments');
+
+  if (!fs.existsSync( path.dirname(file) ))
+      common.error('no such file or directory: ' + path.dirname(file));
+
+  try {
+    fs.appendFileSync(file, this.toString(), 'utf8');
+  } catch(e) {
+    common.error('could not append to file (code '+e.code+'): '+file, true);
+  }
+}
+module.exports = _toEnd;

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/89eac6c9/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/which.js
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/which.js b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/which.js
new file mode 100644
index 0000000..fadb96c
--- /dev/null
+++ b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/which.js
@@ -0,0 +1,79 @@
+var common = require('./common');
+var fs = require('fs');
+var path = require('path');
+
+// Cross-platform method for splitting environment PATH variables
+function splitPath(p) {
+  for (i=1;i<2;i++) {}
+
+  if (!p)
+    return [];
+
+  if (common.platform === 'win')
+    return p.split(';');
+  else
+    return p.split(':');
+}
+
+//@
+//@ ### which(command)
+//@
+//@ Examples:
+//@
+//@ ```javascript
+//@ var nodeExec = which('node');
+//@ ```
+//@
+//@ Searches for `command` in the system's PATH. On Windows looks for `.exe`, `.cmd`, and `.bat` extensions.
+//@ Returns string containing the absolute path to the command.
+function _which(options, cmd) {
+  if (!cmd)
+    common.error('must specify command');
+
+  var pathEnv = process.env.path || process.env.Path || process.env.PATH,
+      pathArray = splitPath(pathEnv),
+      where = null;
+
+  // No relative/absolute paths provided?
+  if (cmd.search(/\//) === -1) {
+    // Search for command in PATH
+    pathArray.forEach(function(dir) {
+      if (where)
+        return; // already found it
+
+      var attempt = path.resolve(dir + '/' + cmd);
+      if (fs.existsSync(attempt)) {
+        where = attempt;
+        return;
+      }
+
+      if (common.platform === 'win') {
+        var baseAttempt = attempt;
+        attempt = baseAttempt + '.exe';
+        if (fs.existsSync(attempt)) {
+          where = attempt;
+          return;
+        }
+        attempt = baseAttempt + '.cmd';
+        if (fs.existsSync(attempt)) {
+          where = attempt;
+          return;
+        }
+        attempt = baseAttempt + '.bat';
+        if (fs.existsSync(attempt)) {
+          where = attempt;
+          return;
+        }
+      } // if 'win'
+    });
+  }
+
+  // Command not found anywhere?
+  if (!fs.existsSync(cmd) && !where)
+    return null;
+
+  where = where || path.resolve(cmd);
+
+  return common.ShellString(where);
+}
+module.exports = _which;

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/89eac6c9/bin/node_modules/ios-sim/node_modules/simctl/node_modules/tail/README.md
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/node_modules/simctl/node_modules/tail/README.md b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/tail/README.md
new file mode 100644
index 0000000..eec282c
--- /dev/null
+++ b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/tail/README.md
@@ -0,0 +1,72 @@
+#tail
+
+To install:
+
+```bash
+npm install tail
+```
+
+#Use:
+```javascript
+Tail = require('tail').Tail;
+
+tail = new Tail("fileToTail");
+
+tail.on("line", function(data) {
+  console.log(data);
+});
+
+tail.on("error", function(error) {
+  console.log('ERROR: ', error);
+});
+````
+
+Tail constructor accepts few parameters:
+
+```javascript
+
+var fileToTail = "/path/to/fileToTail.txt";
+var lineSeparator= "\n";
+var fromBeginning = false;
+var watchOptions = {}; \\ as per node fs.watch documentations
+
+new Tail(fileToTail, lineSeparator, watchOptions,fromBeginning)
+```
+
+* `fileToTail` is the name (inclusive of the path) of the file to tail
+* `lineSeparator` is the line separator token (default "\n")
+* `watchOptions` is the full set of options that can be passed to `fs.watch` as per node documentation (default: {})
+* `fromBeginning` force the tail of the file from the very beginning of it instead of from the first new line that will be appended(default: "\n")
+
+The only mandatory one is the first, i.e. the the file you want to tail.
+
+Tail emits two type of events:
+
+* line
+```
+function(data){}
+```
+* error
+```
+function(exception){}
+```
+
+If you simply want to stop the tail:
+
+```javascript
+tail.unwatch()
+```
+
+And to start watching again:
+```javascript
+tail.watch()
+```
+
+#Want to fork ?
+
+Tail is written in [CoffeeScript](http://jashkenas.github.com/coffee-script/).
+
+The Cakefile generates the javascript that is then published to npm.
+
+#License
+MIT. Please see License file for more details.

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/89eac6c9/bin/node_modules/ios-sim/node_modules/simctl/node_modules/tail/package.json
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/node_modules/simctl/node_modules/tail/package.json b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/tail/package.json
new file mode 100644
index 0000000..2b76510
--- /dev/null
+++ b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/tail/package.json
@@ -0,0 +1,57 @@
+{
+  "author": {
+    "name": "Luca Grulla"
+  },
+  "contributors": [
+    {
+      "name": "Luca Grulla"
+    },
+    {
+      "name": "Tom Hall"
+    },
+    {
+      "name": "Andy Kent"
+    }
+  ],
+  "name": "tail",
+  "description": "tail a file in node",
+  "version": "0.4.0",
+  "repository": {
+    "type": "git",
+    "url": "git://github.com/lucagrulla/node-tail.git"
+  },
+  "main": "tail",
+  "engines": {
+    "node": ">= 0.4.0"
+  },
+  "dependencies": {},
+  "devDependencies": {
+    "coffee-script": "1.7.1"
+  },
+  "bugs": {
+    "url": "https://github.com/lucagrulla/node-tail/issues"
+  },
+  "homepage": "https://github.com/lucagrulla/node-tail",
+  "_id": "tail@0.4.0",
+  "scripts": {},
+  "_shasum": "d29de72750cc99db1e053aff13c359ecfb713002",
+  "_from": "tail@>=0.4.0 <0.5.0",
+  "_npmVersion": "1.4.15",
+  "_npmUser": {
+    "name": "lucagrulla",
+    "email": "luca.grulla@gmail.com"
+  },
+  "maintainers": [
+    {
+      "name": "lucagrulla",
+      "email": "luca.grulla@gmail.com"
+    }
+  ],
+  "dist": {
+    "shasum": "d29de72750cc99db1e053aff13c359ecfb713002",
+    "tarball": "http://registry.npmjs.org/tail/-/tail-0.4.0.tgz"
+  },
+  "directories": {},
+  "_resolved": "https://registry.npmjs.org/tail/-/tail-0.4.0.tgz",
+  "readme": "ERROR: No README data found!"
+}

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/89eac6c9/bin/node_modules/ios-sim/node_modules/simctl/node_modules/tail/tail.js
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/node_modules/simctl/node_modules/tail/tail.js b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/tail/tail.js
new file mode 100644
index 0000000..061ceab
--- /dev/null
+++ b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/tail/tail.js
@@ -0,0 +1,147 @@
+// Generated by CoffeeScript 1.6.2
+var Tail, environment, events, fs,
+  __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
+  __hasProp = {}.hasOwnProperty,
+  __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
+
+events = require("events");
+
+fs = require('fs');
+
+environment = process.env['NODE_ENV'] || 'development';
+
+Tail = (function(_super) {
+  __extends(Tail, _super);
+
+  Tail.prototype.readBlock = function() {
+    var block, stream,
+      _this = this;
+
+    if (this.queue.length >= 1) {
+      block = this.queue.shift();
+      if (block.end > block.start) {
+        stream = fs.createReadStream(this.filename, {
+          start: block.start,
+          end: block.end - 1,
+          encoding: "utf-8"
+        });
+        stream.on('error', function(error) {
+          console.log("Tail error:" + error);
+          return _this.emit('error', error);
+        });
+        stream.on('end', function() {
+          if (_this.queue.length >= 1) {
+            return _this.internalDispatcher.emit("next");
+          }
+        });
+        return stream.on('data', function(data) {
+          var chunk, parts, _i, _len, _results;
+
+          _this.buffer += data;
+          parts = _this.buffer.split(_this.separator);
+          _this.buffer = parts.pop();
+          _results = [];
+          for (_i = 0, _len = parts.length; _i < _len; _i++) {
+            chunk = parts[_i];
+            _results.push(_this.emit("line", chunk));
+          }
+          return _results;
+        });
+      }
+    }
+  };
+
+  function Tail(filename, separator, fsWatchOptions, frombeginning) {
+    var stats,
+      _this = this;
+
+    this.filename = filename;
+    this.separator = separator != null ? separator : '\n';
+    this.fsWatchOptions = fsWatchOptions != null ? fsWatchOptions : {};
+    this.frombeginning = frombeginning != null ? frombeginning : false;
+    this.readBlock = __bind(this.readBlock, this);
+    this.buffer = '';
+    this.internalDispatcher = new events.EventEmitter();
+    this.queue = [];
+    this.isWatching = false;
+    stats = fs.statSync(this.filename);
+    this.internalDispatcher.on('next', function() {
+      return _this.readBlock();
+    });
+    this.pos = this.frombeginning ? 0 : stats.size;
+    this.watch();
+  }
+
+  Tail.prototype.watch = function() {
+    var _this = this;
+
+    if (this.isWatching) {
+      return;
+    }
+    this.isWatching = true;
+    if (fs.watch) {
+      return this.watcher = fs.watch(this.filename, this.fsWatchOptions, function(e) {
+        return _this.watchEvent(e);
+      });
+    } else {
+      return fs.watchFile(this.filename, this.fsWatchOptions, function(curr, prev) {
+        return _this.watchFileEvent(curr, prev);
+      });
+    }
+  };
+
+  Tail.prototype.watchEvent = function(e) {
+    var stats,
+      _this = this;
+
+    if (e === 'change') {
+      stats = fs.statSync(this.filename);
+      if (stats.size < this.pos) {
+        this.pos = stats.size;
+      }
+      if (stats.size > this.pos) {
+        this.queue.push({
+          start: this.pos,
+          end: stats.size
+        });
+        this.pos = stats.size;
+        if (this.queue.length === 1) {
+          return this.internalDispatcher.emit("next");
+        }
+      }
+    } else if (e === 'rename') {
+      this.unwatch();
+      return setTimeout((function() {
+        return _this.watch();
+      }), 1000);
+    }
+  };
+
+  Tail.prototype.watchFileEvent = function(curr, prev) {
+    if (curr.size > prev.size) {
+      this.queue.push({
+        start: prev.size,
+        end: curr.size
+      });
+      if (this.queue.length === 1) {
+        return this.internalDispatcher.emit("next");
+      }
+    }
+  };
+
+  Tail.prototype.unwatch = function() {
+    if (fs.watch && this.watcher) {
+      this.watcher.close();
+      this.pos = 0;
+    } else {
+      fs.unwatchFile(this.filename);
+    }
+    this.isWatching = false;
+    return this.queue = [];
+  };
+
+  return Tail;
+
+})(events.EventEmitter);
+
+exports.Tail = Tail;

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/89eac6c9/bin/node_modules/ios-sim/node_modules/simctl/package.json
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/node_modules/simctl/package.json b/bin/node_modules/ios-sim/node_modules/simctl/package.json
new file mode 100644
index 0000000..b07f754
--- /dev/null
+++ b/bin/node_modules/ios-sim/node_modules/simctl/package.json
@@ -0,0 +1,49 @@
+{
+  "name": "simctl",
+  "version": "0.0.6",
+  "description": "library for Xcode simctl utility on OS X",
+  "repository": {
+    "type": "git",
+    "url": "git+https://github.com/phonegap/simctl.git"
+  },
+  "main": "simctl.js",
+  "dependencies": {
+    "shelljs": "^0.2.6",
+    "tail": "^0.4.0"
+  },
+  "keywords": [
+    "simctl",
+    "iOS Simulator"
+  ],
+  "author": {
+    "name": "Shazron Abdullah"
+  },
+  "license": "MIT",
+  "gitHead": "0a13de1e055ee1f10985d5ee8cdba7cfa9227d6d",
+  "bugs": {
+    "url": "https://github.com/phonegap/simctl/issues"
+  },
+  "homepage": "https://github.com/phonegap/simctl",
+  "_id": "simctl@0.0.6",
+  "scripts": {},
+  "_shasum": "a7c820436bb42ad90cfbbeb19736a5d48688513f",
+  "_from": "simctl@>=0.0.6 <0.0.7",
+  "_npmVersion": "1.4.14",
+  "_npmUser": {
+    "name": "shazron",
+    "email": "shazron@gmail.com"
+  },
+  "maintainers": [
+    {
+      "name": "shazron",
+      "email": "shazron@gmail.com"
+    }
+  ],
+  "dist": {
+    "shasum": "a7c820436bb42ad90cfbbeb19736a5d48688513f",
+    "tarball": "http://registry.npmjs.org/simctl/-/simctl-0.0.6.tgz"
+  },
+  "directories": {},
+  "_resolved": "https://registry.npmjs.org/simctl/-/simctl-0.0.6.tgz",
+  "readme": "ERROR: No README data found!"
+}

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/89eac6c9/bin/node_modules/ios-sim/node_modules/simctl/simctl.js
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/node_modules/simctl/simctl.js b/bin/node_modules/ios-sim/node_modules/simctl/simctl.js
new file mode 100644
index 0000000..91512ed
--- /dev/null
+++ b/bin/node_modules/ios-sim/node_modules/simctl/simctl.js
@@ -0,0 +1,195 @@
+/*
+The MIT License (MIT)
+
+Copyright (c) 2014 Shazron Abdullah.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+*/
+
+var shell = require('shelljs'),
+    path = require('path'),
+    util = require('util'),
+    Tail = require('tail').Tail,
+    SimCtlExtensions = require('./lib/simctl-extensions'),
+    SimCtlListParser = require('./lib/simctl-list-parser');
+
+
+exports = module.exports = {
+    
+    set noxpc(b) {
+        this._noxpc = b;
+    },
+    
+    get noxpc() {
+        return this._noxpc;
+    },
+    
+    extensions : SimCtlExtensions,
+    
+    check_prerequisites : function() {
+        var command = util.format('xcrun simctl help');
+        var obj = shell.exec(command, {silent: true});
+
+        if (obj.code !== 0) {
+            obj.output  = 'simctl was not found.\n';
+            obj.output += 'Check that you have Xcode 6.x installed:\n';
+            obj.output += '\txcodebuild --version';
+            obj.output += 'Check that you have Xcode 6.x selected:\n';
+            obj.output += '\txcode-select --print-path';
+        }
+        
+        return obj;
+    },
+    
+    create : function(name, device_type_id, runtime_id) {
+        var command = util.format('xcrun simctl create "%s" "%s" "%s"', name, device_type_id, runtime_id);
+        return shell.exec(command);
+    },
+    
+    del : function(device) {
+        var command = util.format('xcrun simctl delete "%s"', device);
+        return shell.exec(command);
+    },
+    
+    erase : function(device) {
+        var command = util.format('xcrun simctl erase "%s"', device);
+        return shell.exec(command);
+    },
+    
+    boot : function(device) {
+        var command = util.format('xcrun simctl boot "%s"', device);
+        return shell.exec(command);
+    },
+    
+    shutdown : function(device) {
+        var command = util.format('xcrun simctl shutdown "%s"', device);
+        return shell.exec(command);
+    },
+    
+    rename : function(device, name) {
+        var command = util.format('xcrun simctl rename "%s" "%s"', device, name);
+        return shell.exec(command);
+    },
+    
+    getenv : function(device, variable_name) {
+        var command = util.format('xcrun simctl getenv "%s" "%s"', device, variable_name);
+        return shell.exec(command);
+    },
+    
+    openurl : function(device, url) {
+        var command = util.format('xcrun simctl openurl "%s" "%s"', device, url);
+        return shell.exec(command);
+    },
+    
+    addphoto : function(device, path) {
+        var command = util.format('xcrun simctl addphoto "%s" "%s"', device, path);
+        return shell.exec(command);
+    },
+    
+    install : function(device, path) {
+        var command = util.format('xcrun simctl install "%s" "%s"', device, path);
+        return shell.exec(command);
+    },
+    
+    uninstall : function(device, app_identifier) {
+        var command = util.format('xcrun simctl uninstall "%s" "%s"', device, app_identifier);
+        return shell.exec(command);
+    },
+    
+    launch : function(wait_for_debugger, device, app_identifier, argv) {
+        var wait_flag = '';
+        if (wait_for_debugger) {
+            wait_flag = '--wait-for-debugger';
+        }
+        
+        var argv_expanded = '';
+        if (argv.length > 0) {
+            argv_expanded = argv.map(function(arg){
+                return "'" + arg + "'";
+            }).join(" "); 
+        }
+        
+        var command = util.format('xcrun simctl launch %s "%s" "%s" %s', wait_flag, device, app_identifier, argv_expanded);
+        return shell.exec(command);
+    },
+    
+    spawn : function(wait_for_debugger, arch, device, path_to_executable, argv) {
+        var wait_flag = '';
+        if (wait_for_debugger) {
+            wait_flag = '--wait-for-debugger';
+        }
+
+        var arch_flag = '';
+        if (arch) {
+            arch_flag = util.format('--arch="%s"', arch);
+        }
+        
+        var argv_expanded = '';
+        if (argv.length > 0) {
+            argv_expanded = argv.map(function(arg){
+                return "'" + arg + "'";
+            }).join(" "); 
+        }
+        
+        var command = util.format('xcrun simctl spawn %s %s "%s" "%s" %s', wait_flag, arch_flag, device, path_to_executable, argv_expanded);
+        return shell.exec(command);
+    },
+    
+    list : function(options) {
+        var sublist = '';
+        options = options || {};
+        
+        if (options.devices) {
+            sublist = 'devices';
+        } else if (options.devicetypes) {
+            sublist = 'devicetypes';
+        } else if (options.runtimes) {
+            sublist = 'runtimes';
+        }
+        
+        var command = util.format('xcrun simctl list %s', sublist);
+        var obj = shell.exec(command, { silent: options.silent });
+
+        if (obj.code === 0) {
+            try {
+                var parser = new SimCtlListParser();
+                obj.json = parser.parse(obj.output);
+            } catch(err) {
+                console.error(err.stack);
+            }
+        }
+
+        return obj;
+    },
+    
+    notify_post : function(device, notification_name) {
+        var command = util.format('xcrun simctl notify_post "%s" "%s"', device, notification_name);
+        return shell.exec(command);
+    },
+    
+    icloud_sync : function(device) {
+        var command = util.format('xcrun simctl icloud_sync "%s"', device);
+        return shell.exec(command);
+    },
+    
+    help : function(subcommand) {
+        var command = util.format('xcrun simctl help "%s"', subcommand);
+        return shell.exec(command);
+    }
+};
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/89eac6c9/bin/node_modules/ios-sim/package.json
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/package.json b/bin/node_modules/ios-sim/package.json
new file mode 100644
index 0000000..22b00d5
--- /dev/null
+++ b/bin/node_modules/ios-sim/package.json
@@ -0,0 +1,45 @@
+{
+  "name": "ios-sim",
+  "version": "5.0.0",
+  "os": [
+    "darwin"
+  ],
+  "preferGlobal": "true",
+  "description": "launch iOS apps into the iOS Simulator from the command line (Xcode 6.0+)",
+  "main": "ios-sim.js",
+  "repository": {
+    "type": "git",
+    "url": "git+https://github.com/phonegap/ios-sim.git"
+  },
+  "engines": {
+    "node": ">=0.10.0"
+  },
+  "keywords": [
+    "ios-sim",
+    "iOS Simulator"
+  ],
+  "bin": {
+    "ios-sim": "./bin/ios-sim"
+  },
+  "bugs": {
+    "url": "https://github.com/phonegap/ios-sim/issues"
+  },
+  "author": {
+    "name": "Shazron Abdullah"
+  },
+  "license": "MIT",
+  "dependencies": {
+    "simctl": "^0.0.6",
+    "nopt": "1.0.9",
+    "bplist-parser": "^0.0.6"
+  },
+  "readme": "ios-sim\n=======\n\nSupports Xcode 6 only since version 3.x.\n\nThe ios-sim tool is a command-line utility that launches an iOS application on the iOS Simulator. This allows for niceties such as automated testing without having to open Xcode.\n\nFeatures\n--------\n\n* Choose the device family to simulate, i.e. iPhone or iPad. Run using \"showdevicetypes\" option to see available device types, and pass it in as the \"devicetypeid\" parameter.\n\nSee the `--help` option for more info.\n\nThe unimplemented options below are in the [backlog](https://github.com/phonegap/ios-sim/milestones/ios-sim%204.2.0)\n\nUsage\n-----\n\n```\n\n    Usage: ios-sim <command> <options> [--args ...]\n        \n    Commands:\n      showsdks                        List the available iOS SDK versions\n      showdevicetypes                 List the available device types\n      launch <application path>       Launch the application at the specified path on the iOS Simulator\n      start         
                   Launch iOS Simulator without an app\n      install <application path>      Install the application at the specified path on the iOS Simulator without launching the app\n\n    Options:\n      --version                       Print the version of ios-sim\n      --help                          Show this help text\n      --exit                          Exit after startup\n      --log <log file path>           The path where log of the app running in the Simulator will be redirected to\n      --devicetypeid <device type>    The id of the device type that should be simulated (Xcode6+). Use 'showdevicetypes' to list devices.\n                                      e.g \"com.apple.CoreSimulator.SimDeviceType.Resizable-iPhone6, 8.0\"\n                                  \n    Removed in version 4.x:\n      --stdout <stdout file path>     The path where stdout of the simulator will be redirected to (defaults to stdout of ios-sim)\n      --stderr <stderr file path>     The path w
 here stderr of the simulator will be redirected to (defaults to stderr of ios-sim)\n      --sdk <sdkversion>              The iOS SDK version to run the application on (defaults to the latest)\n      --family <device family>        The device type that should be simulated (defaults to `iphone')\n      --retina                        Start a retina device\n      --tall                          In combination with --retina flag, start the tall version of the retina device (e.g. iPhone 5 (4-inch))\n      --64bit                         In combination with --retina flag and the --tall flag, start the 64bit version of the tall retina device (e.g. iPhone 5S (4-inch 64bit))\n                                    \n    Unimplemented in this version:\n      --verbose                       Set the output level to verbose\n      --timeout <seconds>             The timeout time to wait for a response from the Simulator. Default value: 30 seconds\n      --args <...>                    All followin
 g arguments will be passed on to the application\n      --env <environment file path>   A plist file containing environment key-value pairs that should be set\n      --setenv NAME=VALUE             Set an environment variable\n                                  \n```\n\nInstallation\n------------\n\nChoose one of the following installation methods.\n\n### Node JS\n\nInstall using node.js (at least 0.10.20):\n\n    $ npm install ios-sim -g\n\n### Zip\n\nDownload a zip file:\n\n    $ curl -L https://github.com/phonegap/ios-sim/archive/master.zip -o ios-sim.zip\n    $ unzip ios-sim.zip\n\n### Git\n\nDownload using git clone:\n\n    $ git clone git://github.com/phonegap/ios-sim.git\n\nTroubleshooting\n---------------\n\nMake sure you enable Developer Mode on your machine:\n\n    $ DevToolsSecurity -enable\n\nMake sure multiple instances of launchd_sim are not running:\n\n    $ killall launchd_sim\n\nLicense\n-------\n\nThis project is available under the MIT license. See [LICENSE][licens
 e].\n\n[license]: https://github.com/phonegap/ios-sim/blob/master/LICENSE\n",
+  "readmeFilename": "README.md",
+  "gitHead": "314f6f7456ab2bbe19f4d3786c5c06cb5d5f159a",
+  "homepage": "https://github.com/phonegap/ios-sim#readme",
+  "_id": "ios-sim@5.0.0",
+  "scripts": {},
+  "_shasum": "f5423f42ef6316cb10f65a77d16731c4f3e2438d",
+  "_from": "../../ios-sim",
+  "_resolved": "file:../../ios-sim"
+}

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/89eac6c9/bin/node_modules/ios-sim/resources/buildbox/build.sh
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/resources/buildbox/build.sh b/bin/node_modules/ios-sim/resources/buildbox/build.sh
new file mode 100755
index 0000000..4e33b66
--- /dev/null
+++ b/bin/node_modules/ios-sim/resources/buildbox/build.sh
@@ -0,0 +1,3 @@
+#!/usr/bin/env bash
+echo "$ rake build"
+rake build
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/89eac6c9/bin/node_modules/ios-sim/src/cli.js
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/src/cli.js b/bin/node_modules/ios-sim/src/cli.js
new file mode 100644
index 0000000..2b822e4
--- /dev/null
+++ b/bin/node_modules/ios-sim/src/cli.js
@@ -0,0 +1,102 @@
+/*
+The MIT License (MIT)
+
+Copyright (c) 2014 Shazron Abdullah
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+*/
+
+var path = require('path'),
+    command_lib = require('./commands'),
+    help = require('./help'),
+    nopt;
+
+/*
+ * init
+ *
+ * initializes nopt and simctl
+ * nopt, and simctl are require()d in try-catch below to print a nice error
+ * message if one of them is not installed.
+ */
+function init() {
+    try {
+        nopt = require('nopt');
+        command_lib.init();
+    } catch (e) {
+        console.error(
+            'Please run npm install from this directory:\n\t' +
+            path.dirname(__dirname)
+        );
+        process.exit(2);
+    }
+};
+
+function cli(inputArgs) {
+    
+    var knownOpts =
+        { 'version' : Boolean
+        , 'help' : Boolean
+        , 'verbose' : Boolean
+        , 'exit' : Boolean
+        , 'use-gdb' : Boolean
+        , 'uuid' : String
+        , 'env' : String
+        , 'setenv' : String
+        , 'stdout' : path
+        , 'stderr' : path
+        , 'timeout' : Number
+        , 'args' : Array
+        , 'devicetypeid' : String
+    };
+
+    var shortHands = null;
+
+    // If no inputArgs given, use process.argv.
+    inputArgs = inputArgs || process.argv;
+    
+    init();
+
+    var args = nopt(knownOpts, shortHands, inputArgs);
+
+    process.on('uncaughtException', function(err){
+        if (!args.verbose) {
+            console.error(err.message);
+        } else {
+            console.error(err.stack);
+        }
+        process.exit(1);
+    });
+    
+    var cmd = args.argv.remain[0];
+    
+    // some options do *not* need commands and can be run
+    if (args.help) {
+        help();
+    } else if (args.version) {
+        console.log(require('../package').version);
+    } else if (cmd && command_lib[cmd]) { // command found
+        command_lib[cmd](args);
+    } else {
+        help();
+        process.exit(1);
+    }
+}
+
+module.exports = cli;
+

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/89eac6c9/bin/node_modules/ios-sim/src/commands.js
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/src/commands.js b/bin/node_modules/ios-sim/src/commands.js
new file mode 100644
index 0000000..3d87cba
--- /dev/null
+++ b/bin/node_modules/ios-sim/src/commands.js
@@ -0,0 +1,81 @@
+/*
+The MIT License (MIT)
+
+Copyright (c) 2014 Shazron Abdullah
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+*/
+
+var path = require('path'),
+    fs = require('fs'),
+    help = require('./help'),
+    lib = require('./lib'),
+    util = require('util');
+    
+var command_lib = {
+    
+    init : function() {
+        lib.init();
+    },
+    
+    showsdks : function(args) {
+        lib.showsdks();
+    },
+    
+    showdevicetypes : function(args) {
+        lib.showdevicetypes();
+    },
+    
+    launch : function(args) {
+        var wait_for_debugger = false,
+            app_path;
+        
+        if (args.argv.remain.length < 2) {
+            help();
+            process.exit(1);
+        }
+        
+        app_path = args.argv.remain[1];
+        
+        lib.launch(app_path, devicetypeid, log, exit, args.args);
+    },
+
+    install : function(args) {
+        var app_identifier,
+            argv,
+            app_path,
+            info_plist_path;
+
+        if (args.argv.remain.length < 2) {
+            help();
+            process.exit(1);
+        }
+        
+        app_path = args.argv.remain[1];
+
+        lib.install(app_path, devicetypeid, log, exit);
+    },
+    
+    start : function(args) {
+        lib.start(args.devicetypeid);
+    }
+}
+
+module.exports = command_lib;
+

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/89eac6c9/bin/node_modules/ios-sim/src/help.js
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/src/help.js b/bin/node_modules/ios-sim/src/help.js
new file mode 100644
index 0000000..9176d95
--- /dev/null
+++ b/bin/node_modules/ios-sim/src/help.js
@@ -0,0 +1,41 @@
+/*
+The MIT License (MIT)
+
+Copyright (c) 2014 Shazron Abdullah
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+*/
+
+var fs = require('fs'),
+    path = require('path');
+
+function help() {
+    var docdir = path.join(__dirname, '..', 'doc');
+    var helpfile = path.join(docdir, 'help.txt');
+    
+    if (fs.existsSync(helpfile)) {
+        var s = fs.readFileSync(helpfile).toString('utf8');
+        console.log(s);
+    } else {
+        console.log("Help file missing.");
+    }
+};
+
+module.exports = help;
+

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/89eac6c9/bin/node_modules/ios-sim/src/lib.js
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/src/lib.js b/bin/node_modules/ios-sim/src/lib.js
new file mode 100644
index 0000000..dee5b8e
--- /dev/null
+++ b/bin/node_modules/ios-sim/src/lib.js
@@ -0,0 +1,382 @@
+/*
+The MIT License (MIT)
+
+Copyright (c) 2014 Shazron Abdullah
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+*/
+
+var path = require('path'),
+    fs = require('fs'),
+    help = require('./help'),
+    util = require('util'),
+    simctl,
+    bplist;
+    
+function findFirstAvailableDevice(list) {
+    /*
+        // Example result:
+        {
+            name : 'iPhone 6',
+            id : 'A1193D97-F5EE-468D-9DBA-786F403766E6',
+            runtime : 'iOS 8.3'
+        }
+    */
+    
+    // the object to return
+    var ret_obj = {
+        name : null,
+        id : null,
+        runtime : null
+    };
+    
+    var available_runtimes = {};
+    
+    list.runtimes.forEach(function(runtime) {
+        if (runtime.available) {
+            available_runtimes[ runtime.name ] = true;
+        }
+    });
+    
+    
+    list.devices.some(function(deviceGroup) {
+        deviceGroup.devices.some(function(device){
+            if (available_runtimes[deviceGroup.runtime]) {
+                ret_obj = {
+                    name : device.name,
+                    id : device.id,
+                    runtime : deviceGroup.runtime
+                };
+                return true;
+            }
+            return false;
+        });
+        return false;
+    });
+    
+    return ret_obj;
+}
+    
+function findRuntimesGroupByDeviceProperty(list, deviceProperty, availableOnly) {
+    /*
+        // Example result:
+        {
+            "iPhone 6" : [ "iOS 8.2", "iOS 8.3"],
+            "iPhone 6 Plus" : [ "iOS 8.2", "iOS 8.3"]
+        } 
+    */
+    
+    var runtimes = {};
+    var available_runtimes = {};
+    
+    list.runtimes.forEach(function(runtime) {
+        if (runtime.available) {
+            available_runtimes[ runtime.name ] = true;
+        }
+    });
+    
+    list.devices.forEach(function(deviceGroup) {
+        deviceGroup.devices.forEach(function(device){
+            var devicePropertyValue = device[deviceProperty];
+            
+            if (!runtimes[devicePropertyValue]) {
+                runtimes[devicePropertyValue] = [];
+            }
+            if (availableOnly) {
+                if (available_runtimes[deviceGroup.runtime]) {
+                    runtimes[devicePropertyValue].push(deviceGroup.runtime);
+                }
+            } else {
+                runtimes[devicePropertyValue].push(deviceGroup.runtime);
+            }
+        });
+    });
+    
+    return runtimes;
+}
+
+function findAvailableRuntime(list, device_name) {
+
+    var all_druntimes = findRuntimesGroupByDeviceProperty(list, "name", true);
+    var druntime = all_druntimes[device_name];
+    var runtime_found = druntime && druntime.length > 0;
+
+    if (!runtime_found) {
+        console.error(util.format('No available runtimes could be found for "%s".', device_name));
+        process.exit(1);
+    }
+    
+    // return most modern runtime
+    return druntime.sort().pop();
+}
+
+function getDeviceFromDeviceTypeId(devicetypeid) {
+    /*
+        // Example result:
+        {
+            name : 'iPhone 6',
+            id : 'A1193D97-F5EE-468D-9DBA-786F403766E6',
+            runtime : 'iOS 8.3'
+        }
+    */
+    
+    // the object to return
+    var ret_obj = {
+        name : null,
+        id : null,
+        runtime : null
+    };
+    
+    var options = { 'silent': true };
+    var list = simctl.list(options).json;
+    
+    var arr = [];
+    if (devicetypeid) {
+        arr = devicetypeid.split(',');
+    }
+    
+    // get the devicetype from --devicetypeid
+    // --devicetypeid is a string in the form "devicetype, runtime_version" (optional: runtime_version)
+    var devicetype = null;
+    if (arr.length < 1) {
+      var dv = findFirstAvailableDevice(list);
+      console.error(util.format('--devicetypeid was not specified, using first available device: %s.', dv.name));
+      return dv;
+    } else {
+        devicetype = arr[0].trim();
+        if (arr.length > 1) {
+            ret_obj.runtime = arr[1].trim();
+        }
+    }
+    
+    // check whether devicetype has the "com.apple.CoreSimulator.SimDeviceType." prefix, if not, add it
+    var prefix = 'com.apple.CoreSimulator.SimDeviceType.';
+    if (devicetype.indexOf(prefix) != 0) {
+        devicetype = prefix + devicetype;
+    }
+    
+    // now find the devicename from the devicetype
+    var devicename_found = list.devicetypes.some(function(deviceGroup) {
+        if (deviceGroup.id === devicetype) {
+            ret_obj.name = deviceGroup.name;
+            return true;
+        }
+        
+        return false;
+    });
+    
+    // device name not found, exit
+    if (!devicename_found) {
+      console.error(util.format('Device type "%s" could not be found.', devicetype));
+      process.exit(1);
+    }
+    
+    // if runtime_version was not specified, we use a default. Use first available that has the device
+    if (!ret_obj.runtime) {
+        ret_obj.runtime = findAvailableRuntime(list, ret_obj.name);
+    }
+    
+    // prepend iOS to runtime version, if necessary
+    if (ret_obj.runtime.indexOf('iOS') === -1) {
+        ret_obj.runtime = util.format('iOS %s', ret_obj.runtime);
+    }
+    
+    // now find the deviceid (by runtime and devicename)
+    var deviceid_found = list.devices.some(function(deviceGroup) {
+        if (deviceGroup.runtime === ret_obj.runtime) { // found the runtime, now find the actual device matching devicename
+            return deviceGroup.devices.some(function(device) {
+                if (device.name === ret_obj.name) {
+                    ret_obj.id = device.id;
+                    return true;
+                }
+                return false;
+            });
+        }
+        return false;
+    });
+    
+    if (!deviceid_found) {
+        console.error(util.format('Device id for device name "%s" and runtime "%s" could not be found, or is not available.', ret_obj.name, ret_obj.runtime));
+        process.exit(1);
+    }
+    
+    return ret_obj;
+}
+
+var lib = {
+    
+    init : function() {
+        if (!simctl) {
+            simctl = require('simctl');
+        }
+        var output = simctl.check_prerequisites();
+        if (output.code !== 0) {
+            console.error(output.output);
+            process.exit(2);
+        }
+        
+        if (!bplist) {
+            bplist = require('bplist-parser');
+        }
+    },
+    
+    showsdks : function(args) {
+        var options = { silent: true, runtimes: true };
+        var list = simctl.list(options).json;
+        
+        console.log("Simulator SDK Roots:");
+        list.runtimes.forEach(function(runtime) {
+            if (runtime.available) {
+                console.log(util.format("'%s' (%s)", runtime.name, runtime.build));
+                console.log(util.format("\t(unknown)"));
+            }
+        });
+    },
+    
+    getdevicetypes : function(args) {
+        var options = { silent: true };
+        var list = simctl.list(options).json;
+        
+        var druntimes = findRuntimesGroupByDeviceProperty(list, "name", true);
+        var name_id_map = {};
+        
+        list.devicetypes.forEach(function(device) {
+            name_id_map[ device.name ] = device.id;
+        });
+        
+        var list = [];
+        for (var deviceName in druntimes) {
+            var runtimes = druntimes[ deviceName ];
+            runtimes.forEach(function(runtime){
+                // remove "iOS" prefix in runtime, remove prefix "com.apple.CoreSimulator.SimDeviceType." in id
+                list.push(util.format("%s, %s", name_id_map[ deviceName ].replace(/^com.apple.CoreSimulator.SimDeviceType./, ''), runtime.replace(/^iOS /, '')));
+            });
+        }
+        return list;
+    },
+    
+    showdevicetypes : function(args) {
+        var options = { silent: true };
+        var list = simctl.list(options).json;
+        
+        var druntimes = findRuntimesGroupByDeviceProperty(list, "name", true);
+        var name_id_map = {};
+        
+        list.devicetypes.forEach(function(device) {
+            name_id_map[ device.name ] = device.id;
+        });
+        
+        for (var deviceName in druntimes) {
+            var runtimes = druntimes[ deviceName ];
+            runtimes.forEach(function(runtime){
+                // remove "iOS" prefix in runtime, remove prefix "com.apple.CoreSimulator.SimDeviceType." in id
+                console.log(util.format("%s, %s", name_id_map[ deviceName ].replace(/^com.apple.CoreSimulator.SimDeviceType./, ''), runtime.replace(/^iOS /, '')));
+            });
+        }
+    },
+    
+    launch : function(app_path, devicetypeid, log, exit, argv) {
+        var wait_for_debugger = false,
+            info_plist_path,
+            app_identifier;
+
+        info_plist_path = path.join(app_path,'Info.plist');
+        if (!fs.existsSync(info_plist_path)) {
+            console.error(info_plist_path + " file not found.");
+            process.exit(1);
+        }
+
+        bplist.parseFile(info_plist_path, function(err, obj) {
+          
+            if (err) {
+              throw err;
+            }
+
+            app_identifier = obj[0].CFBundleIdentifier;
+            argv = argv || [];
+
+            // get the deviceid from --devicetypeid
+            // --devicetypeid is a string in the form "devicetype, runtime_version" (optional: runtime_version)
+            var device = getDeviceFromDeviceTypeId(devicetypeid);
+            
+            // so now we have the deviceid, we can proceed
+            simctl.extensions.start(device.id);
+            simctl.install(device.id, app_path);
+            simctl.launch(wait_for_debugger, device.id, app_identifier, argv);
+            simctl.extensions.log(device.id, log);
+            if (log) {
+                console.log(util.format("logPath: %s", path.resolve(log)));
+            }
+            if (exit) {
+                process.exit(0);
+            }
+        });
+    },
+
+    install : function(app_path, info_plist_path, devicetypeid, log, exit) {
+        var wait_for_debugger = false,
+            info_plist_path,
+            app_identifier;
+
+        info_plist_path = path.join(app_path,'Info.plist');
+        if (!fs.existsSync(info_plist_path)) {
+            console.error(info_plist_path + " file not found.");
+            process.exit(1);
+        }
+        
+        bplist.parseFile(info_plist_path, function(err, obj) {
+          
+            if (err) {
+              throw err;
+            }
+
+            app_identifier = obj[0].CFBundleIdentifier;
+
+            // get the deviceid from --devicetypeid
+            // --devicetypeid is a string in the form "devicetype, runtime_version" (optional: runtime_version)
+            var device = getDeviceFromDeviceTypeId(devicetypeid);
+            
+            // so now we have the deviceid, we can proceed
+            simctl.extensions.start(device.id);
+            simctl.install(device.id, app_path);
+            
+            simctl.extensions.log(device.id, log);
+            if (log) {
+                console.log(util.format("logPath: %s", path.resolve(log)));
+            }
+            if (exit) {
+                process.exit(0);
+            }
+        });
+    },
+    
+    start : function(devicetypeid) {
+        var device = {};
+        try  {
+            device = getDeviceFromDeviceTypeId(devicetypeid);
+        } catch (e) {
+            console.error(e);
+        }
+
+        simctl.extensions.start(device.id);
+    }
+}
+
+module.exports = lib;
+

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/89eac6c9/bin/templates/scripts/cordova/lib/list-emulator-images
----------------------------------------------------------------------
diff --git a/bin/templates/scripts/cordova/lib/list-emulator-images b/bin/templates/scripts/cordova/lib/list-emulator-images
index 0b8ab82..87a5ad2 100755
--- a/bin/templates/scripts/cordova/lib/list-emulator-images
+++ b/bin/templates/scripts/cordova/lib/list-emulator-images
@@ -22,6 +22,7 @@
 /*jshint node: true*/
 
 var Q = require('q'),
+    iossim = require('ios-sim'),
     exec = require('child_process').exec,
     check_reqs = require('./check_reqs');
 
@@ -30,15 +31,10 @@ var Q = require('q'),
  * @return {Promise} Promise fulfilled with list of devices available for simulation
  */
 function listEmulatorImages () {
-    return check_reqs.check_ios_sim().then(function () {
-        return Q.nfcall(exec, 'ios-sim showdevicetypes 2>&1 | ' +
-            'sed "s/com.apple.CoreSimulator.SimDeviceType.//g"');
-    }).then(function (stdio) {
-        // Exec promise resolves with array [stout, stderr], and we need stdout only
-        return stdio[0].trim().split('\n');
-    }).catch(console.log.bind(console));
+    return Q.resolve(iossim.getdevicetypes());
 }
 
+
 exports.run = listEmulatorImages;
 
 // Check if module is started as separate script.

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/89eac6c9/bin/templates/scripts/cordova/lib/run.js
----------------------------------------------------------------------
diff --git a/bin/templates/scripts/cordova/lib/run.js b/bin/templates/scripts/cordova/lib/run.js
index 3e4c0ac..76ab93d 100644
--- a/bin/templates/scripts/cordova/lib/run.js
+++ b/bin/templates/scripts/cordova/lib/run.js
@@ -20,10 +20,11 @@
 /*jshint node: true*/
 
 var Q = require('q'),
-    nopt  = require('nopt'),
-    path  = require('path'),
-    build = require('./build'),
-    spawn = require('./spawn'),
+    nopt   = require('nopt'),
+    path   = require('path'),
+    iossim = require('ios-sim'),
+    build  = require('./build'),
+    spawn  = require('./spawn'),
     check_reqs = require('./check_reqs');
 
 var cordovaPath = path.join(__dirname, '..');
@@ -71,8 +72,6 @@ module.exports.run = function (argv) {
         if (devices.length > 0 && !(args.emulator)) {
             useDevice = true;
             return check_reqs.check_ios_deploy();
-        } else {
-            return check_reqs.check_ios_sim();
         }
     }).then(function () {
         if (!args.nobuild) {
@@ -168,13 +167,8 @@ function deployToSim(appPath, target) {
 
 function startSim(appPath, target) {
     var logPath = path.join(cordovaPath, 'console.log');
-    var simArgs = ['launch', appPath,
-        '--devicetypeid', 'com.apple.CoreSimulator.SimDeviceType.' + target,
-        // We need to redirect simulator output here to use cordova/log command
-        // TODO: Is there any other way to get emulator's output to use in log command?
-        '--stderr', logPath, '--stdout', logPath,
-        '--exit'];
-    return spawn('ios-sim', simArgs);
+
+    return iossim.launch(appPath, 'com.apple.CoreSimulator.SimDeviceType.' + target, logPath, '--exit');
 }
 
 function listDevices() {
@@ -218,4 +212,4 @@ module.exports.help = function () {
     console.log('    run --emulator --debug');
     console.log('');
     process.exit(0);
-};
\ No newline at end of file
+};


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


Mime
View raw message