You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ma...@apache.org on 2015/09/14 19:19:12 UTC

[1/3] ios commit: CB-9328 Use ios-sim as a node module, not a CLI utility

Repository: cordova-ios
Updated Branches:
  refs/heads/CB-9328 d050f499a -> e1b4a533a (forced update)


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/e1b4a533/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/e1b4a533/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/e1b4a533/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/e1b4a533/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/e1b4a533/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/e1b4a533/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/e1b4a533/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/e1b4a533/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/e1b4a533/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/e1b4a533/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/e1b4a533/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/e1b4a533/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/e1b4a533/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/e1b4a533/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/e1b4a533/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/e1b4a533/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/e1b4a533/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/e1b4a533/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/e1b4a533/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/e1b4a533/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/e1b4a533/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/e1b4a533/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/e1b4a533/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/e1b4a533/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/e1b4a533/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


[2/3] ios commit: CB-9328 Use ios-sim as a node module, not a CLI utility

Posted by ma...@apache.org.
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/e1b4a533/bin/node_modules/ios-sim/node_modules/simctl/lib/simctl-extensions.js
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/node_modules/simctl/lib/simctl-extensions.js b/bin/node_modules/ios-sim/node_modules/simctl/lib/simctl-extensions.js
new file mode 100644
index 0000000..07c0e96
--- /dev/null
+++ b/bin/node_modules/ios-sim/node_modules/simctl/lib/simctl-extensions.js
@@ -0,0 +1,69 @@
+/*
+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'),
+    fs = require('fs'),
+    util = require('util'),
+    Tail = require('tail').Tail;
+
+
+var extensions = {
+    start : function(deviceid) {
+        if (!deviceid) {
+            var command = 'open -a "iOS Simulator"';
+            return shell.exec(command, { silent: true } );
+        } else {
+            var command = util.format('xcrun instruments -w "%s"', deviceid);
+            return shell.exec(command, { silent: true } );
+        }
+    },
+    
+    log : function(deviceid, filepath) {
+        var tail = new Tail(
+            path.join(process.env.HOME, 'Library/Logs/CoreSimulator', deviceid, 'system.log')
+        );
+
+        tail.on("line", function(data) {
+            if (filepath) {
+                fs.appendFile(filepath, data + "\n", function(error) {
+                    if (error) {
+                        console.error('ERROR: ', error);
+                        throw error;
+                    }
+                });
+            } else {
+                console.log(data);
+            }
+        });
+
+        tail.on("error", function(error) {
+            console.error('ERROR: ', error);
+        });
+        
+        return tail;
+    }
+};
+
+exports = module.exports = extensions;

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/e1b4a533/bin/node_modules/ios-sim/node_modules/simctl/lib/simctl-list-parser.js
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/node_modules/simctl/lib/simctl-list-parser.js b/bin/node_modules/ios-sim/node_modules/simctl/lib/simctl-list-parser.js
new file mode 100644
index 0000000..bf8279c
--- /dev/null
+++ b/bin/node_modules/ios-sim/node_modules/simctl/lib/simctl-list-parser.js
@@ -0,0 +1,198 @@
+/*
+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 SimctlListParserMode = {
+    'device' : 0,
+    'devicetype': 1,
+    'runtime': 2
+};
+
+function SimctlListParser() {
+    this._result = {
+        'devices' : [],
+        'devicetypes' : [],
+        'runtimes' : []
+    };
+    
+    this._mode = null;
+    this._deviceRuntime = null;
+};
+
+SimctlListParser.prototype.parse = function(text) {
+    var that = this;
+    clearResult.apply(this);
+    
+    text.split(/\r?\n/).forEach(function(line){
+        parseLine.apply(that, [line]);
+     });
+     changeMode.apply(this);
+     
+     return this._result;
+};
+
+function clearResult() {
+    this._result = {
+        'devices' : [],
+        'devicetypes' : [],
+        'runtimes' : []
+    };
+}
+
+function changeMode(line) {
+    endParse.apply(this);
+    
+    if (line && line.indexOf('Devices') !== -1) {
+        this._mode = SimctlListParserMode.device;
+    } else if (line && line.indexOf('Device Types') !== -1) {
+        this._mode = SimctlListParserMode.devicetype;
+    } else if (line && line.indexOf('Runtimes') !== -1) {
+        this._mode = SimctlListParserMode.runtime;
+    } else {
+        this._mode = null;
+    }
+};
+
+function endParse() {
+    switch(this._mode) {
+    case SimctlListParserMode.device:
+        if (this._deviceRuntime) {
+            this._result.devices.push(this._deviceRuntime);
+        }
+        break;
+    }
+}
+
+function parseLine(line) {
+    
+    if (line.indexOf('==') === 0) {
+        changeMode.apply(this, [line]);
+        return;
+    }
+    
+    switch (this._mode) {
+        case SimctlListParserMode.device:
+            parseDevice.apply(this, [line]);
+            break;
+        case SimctlListParserMode.devicetype:
+            parseDeviceType.apply(this, [line]);
+            break;
+        case SimctlListParserMode.runtime:
+            parseRuntime.apply(this, [line]);
+            break;
+    }
+}
+
+function parseDevice(line) {
+    if (line.indexOf('--') === 0) {
+        changeDeviceRuntime.apply(this, [line]);
+        return;
+    }
+    
+    // example: iPhone 4s (3717C817-6AD7-42B8-ACF3-405CB9E96375) (Shutdown) (unavailable)
+    // the last capture group might not be there if available
+    
+    var available = false;
+    
+    var regExp = /(.*)\(([^)]+)\)\s\(([^)]+)\)\s\(([^)]+)\)/;
+    var matches = regExp.exec(line);
+    if (!matches) {
+        regExp = /(.*)\(([^)]+)\)\s\(([^)]+)\)/;
+        matches = regExp.exec(line);
+        available = true;
+    }
+    
+    if (matches) {
+        var obj = {
+            'name' : matches[1].trim(),
+            'id' : matches[2].trim(),
+            'state' : matches[3].trim(),
+            'available' : available
+        };
+    
+        this._deviceRuntime.devices.push(obj);
+    }
+}
+
+function changeDeviceRuntime(line) {
+    if (this._deviceRuntime) {
+        this._result.devices.push(this._deviceRuntime);
+    }
+    
+    var runtime = line;
+    var regExp = /--\s(.*)\s--/;
+    var matches = regExp.exec(line);
+    
+    if (matches) {
+        runtime = matches[1];
+    }
+
+    var obj = {
+        'runtime' : runtime,
+        'devices' : []
+    };
+    
+    this._deviceRuntime = obj;
+}
+
+function parseDeviceType(line) {
+    // Example: 'iPhone 4s (com.apple.CoreSimulator.SimDeviceType.iPhone-4s)'
+    var regExp = /(.*)\(([^)]+)\)/;
+    var matches = regExp.exec(line);
+    
+    if (matches) {
+        var obj = {
+            'name' : matches[1].trim(),
+            'id' : matches[2].trim()
+        };
+    
+        this._result.devicetypes.push(obj);
+    }
+}
+
+function parseRuntime(line) {
+    // Example: iOS 7.0 (7.0 - Unknown) (com.apple.CoreSimulator.SimRuntime.iOS-7-0) (unavailable, runtime path not found)
+    // the last capture group might not be there if available
+    var available = false;
+
+    var regExp = /(.*)\(([^)]+)\)\s\(([^)]+)\)\s\(([^)]+)\)/;
+    var matches = regExp.exec(line);
+    if (!matches) {
+        regExp = /(.*)\(([^)]+)\)\s\(([^)]+)\)/;
+        matches = regExp.exec(line);
+        available = true;
+    }
+    
+    if (matches) {
+        var obj = {
+            'name' : matches[1].trim(),
+            'build' : matches[2].trim(),
+            'id' : matches[3].trim(),
+            'available' : available
+        };
+    
+        this._result.runtimes.push(obj);
+    }
+}
+
+exports = module.exports = SimctlListParser;

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/e1b4a533/bin/node_modules/ios-sim/node_modules/simctl/node_modules/.bin/shjs
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/node_modules/simctl/node_modules/.bin/shjs b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/.bin/shjs
new file mode 120000
index 0000000..a044997
--- /dev/null
+++ b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/.bin/shjs
@@ -0,0 +1 @@
+../shelljs/bin/shjs
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/e1b4a533/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/.documentup.json
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/.documentup.json b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/.documentup.json
new file mode 100644
index 0000000..57fe301
--- /dev/null
+++ b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/.documentup.json
@@ -0,0 +1,6 @@
+{
+  "name": "ShellJS",
+  "twitter": [
+    "r2r"
+  ]
+}

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/e1b4a533/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/.jshintrc
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/.jshintrc b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/.jshintrc
new file mode 100644
index 0000000..a80c559
--- /dev/null
+++ b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/.jshintrc
@@ -0,0 +1,7 @@
+{
+  "loopfunc": true,
+  "sub": true,
+  "undef": true,
+  "unused": true,
+  "node": true
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/e1b4a533/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/.npmignore
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/.npmignore b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/.npmignore
new file mode 100644
index 0000000..6b20c38
--- /dev/null
+++ b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/.npmignore
@@ -0,0 +1,2 @@
+test/
+tmp/
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/e1b4a533/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/.travis.yml
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/.travis.yml b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/.travis.yml
new file mode 100644
index 0000000..99cdc74
--- /dev/null
+++ b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/.travis.yml
@@ -0,0 +1,5 @@
+language: node_js
+node_js:
+  - "0.8"
+  - "0.10"
+  - "0.11"

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/e1b4a533/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/LICENSE
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/LICENSE b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/LICENSE
new file mode 100644
index 0000000..1b35ee9
--- /dev/null
+++ b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/LICENSE
@@ -0,0 +1,26 @@
+Copyright (c) 2012, Artur Adib <aa...@mozilla.com>
+All rights reserved.
+
+You may use this project under the terms of the New BSD license as follows:
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+    * Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+    * Neither the name of Artur Adib nor the
+      names of the contributors may be used to endorse or promote products
+      derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
+ARE DISCLAIMED. IN NO EVENT SHALL ARTUR ADIB BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 
+THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/e1b4a533/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/README.md
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/README.md b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/README.md
new file mode 100644
index 0000000..9120623
--- /dev/null
+++ b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/README.md
@@ -0,0 +1,552 @@
+# ShellJS - Unix shell commands for Node.js [![Build Status](https://secure.travis-ci.org/arturadib/shelljs.png)](http://travis-ci.org/arturadib/shelljs)
+
+ShellJS is a portable **(Windows/Linux/OS X)** implementation of Unix shell commands on top of the Node.js API. You can use it to eliminate your shell script's dependency on Unix while still keeping its familiar and powerful commands. You can also install it globally so you can run it from outside Node projects - say goodbye to those gnarly Bash scripts!
+
+The project is [unit-tested](http://travis-ci.org/arturadib/shelljs) and battled-tested in projects like:
+
++ [PDF.js](http://github.com/mozilla/pdf.js) - Firefox's next-gen PDF reader
++ [Firebug](http://getfirebug.com/) - Firefox's infamous debugger
++ [JSHint](http://jshint.com) - Most popular JavaScript linter
++ [Zepto](http://zeptojs.com) - jQuery-compatible JavaScript library for modern browsers
++ [Yeoman](http://yeoman.io/) - Web application stack and development tool
++ [Deployd.com](http://deployd.com) - Open source PaaS for quick API backend generation
+
+and [many more](https://npmjs.org/browse/depended/shelljs).
+
+## Installing
+
+Via npm:
+
+```bash
+$ npm install [-g] shelljs
+```
+
+If the global option `-g` is specified, the binary `shjs` will be installed. This makes it possible to
+run ShellJS scripts much like any shell script from the command line, i.e. without requiring a `node_modules` folder:
+
+```bash
+$ shjs my_script
+```
+
+You can also just copy `shell.js` into your project's directory, and `require()` accordingly.
+
+
+## Examples
+
+### JavaScript
+
+```javascript
+require('shelljs/global');
+
+if (!which('git')) {
+  echo('Sorry, this script requires git');
+  exit(1);
+}
+
+// Copy files to release dir
+mkdir('-p', 'out/Release');
+cp('-R', 'stuff/*', 'out/Release');
+
+// Replace macros in each .js file
+cd('lib');
+ls('*.js').forEach(function(file) {
+  sed('-i', 'BUILD_VERSION', 'v0.1.2', file);
+  sed('-i', /.*REMOVE_THIS_LINE.*\n/, '', file);
+  sed('-i', /.*REPLACE_LINE_WITH_MACRO.*\n/, cat('macro.js'), file);
+});
+cd('..');
+
+// Run external tool synchronously
+if (exec('git commit -am "Auto-commit"').code !== 0) {
+  echo('Error: Git commit failed');
+  exit(1);
+}
+```
+
+### CoffeeScript
+
+```coffeescript
+require 'shelljs/global'
+
+if not which 'git'
+  echo 'Sorry, this script requires git'
+  exit 1
+
+# Copy files to release dir
+mkdir '-p', 'out/Release'
+cp '-R', 'stuff/*', 'out/Release'
+
+# Replace macros in each .js file
+cd 'lib'
+for file in ls '*.js'
+  sed '-i', 'BUILD_VERSION', 'v0.1.2', file
+  sed '-i', /.*REMOVE_THIS_LINE.*\n/, '', file
+  sed '-i', /.*REPLACE_LINE_WITH_MACRO.*\n/, cat 'macro.js', file
+cd '..'
+
+# Run external tool synchronously
+if (exec 'git commit -am "Auto-commit"').code != 0
+  echo 'Error: Git commit failed'
+  exit 1
+```
+
+## Global vs. Local
+
+The example above uses the convenience script `shelljs/global` to reduce verbosity. If polluting your global namespace is not desirable, simply require `shelljs`.
+
+Example:
+
+```javascript
+var shell = require('shelljs');
+shell.echo('hello world');
+```
+
+## Make tool
+
+A convenience script `shelljs/make` is also provided to mimic the behavior of a Unix Makefile. In this case all shell objects are global, and command line arguments will cause the script to execute only the corresponding function in the global `target` object. To avoid redundant calls, target functions are executed only once per script.
+
+Example (CoffeeScript):
+
+```coffeescript
+require 'shelljs/make'
+
+target.all = ->
+  target.bundle()
+  target.docs()
+
+target.bundle = ->
+  cd __dirname
+  mkdir 'build'
+  cd 'lib'
+  (cat '*.js').to '../build/output.js'
+
+target.docs = ->
+  cd __dirname
+  mkdir 'docs'
+  cd 'lib'
+  for file in ls '*.js'
+    text = grep '//@', file     # extract special comments
+    text.replace '//@', ''      # remove comment tags
+    text.to 'docs/my_docs.md'
+```
+
+To run the target `all`, call the above script without arguments: `$ node make`. To run the target `docs`: `$ node make docs`, and so on.
+
+
+
+<!-- 
+
+  DO NOT MODIFY BEYOND THIS POINT - IT'S AUTOMATICALLY GENERATED
+
+-->
+
+
+## Command reference
+
+
+All commands run synchronously, unless otherwise stated.
+
+
+### cd('dir')
+Changes to directory `dir` for the duration of the script
+
+
+### pwd()
+Returns the current directory.
+
+
+### ls([options ,] path [,path ...])
+### ls([options ,] path_array)
+Available options:
+
++ `-R`: recursive
++ `-A`: all files (include files beginning with `.`, except for `.` and `..`)
+
+Examples:
+
+```javascript
+ls('projs/*.js');
+ls('-R', '/users/me', '/tmp');
+ls('-R', ['/users/me', '/tmp']); // same as above
+```
+
+Returns array of files in the given path, or in current directory if no path provided.
+
+
+### find(path [,path ...])
+### find(path_array)
+Examples:
+
+```javascript
+find('src', 'lib');
+find(['src', 'lib']); // same as above
+find('.').filter(function(file) { return file.match(/\.js$/); });
+```
+
+Returns array of all files (however deep) in the given paths.
+
+The main difference from `ls('-R', path)` is that the resulting file names
+include the base directories, e.g. `lib/resources/file1` instead of just `file1`.
+
+
+### cp([options ,] source [,source ...], dest)
+### cp([options ,] source_array, dest)
+Available options:
+
++ `-f`: force
++ `-r, -R`: recursive
+
+Examples:
+
+```javascript
+cp('file1', 'dir1');
+cp('-Rf', '/tmp/*', '/usr/local/*', '/home/tmp');
+cp('-Rf', ['/tmp/*', '/usr/local/*'], '/home/tmp'); // same as above
+```
+
+Copies files. The wildcard `*` is accepted.
+
+
+### 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.
+
+
+### 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.
+
+
+### 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.
+
+
+### 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.
+
+
+### cat(file [, file ...])
+### cat(file_array)
+
+Examples:
+
+```javascript
+var str = cat('file*.txt');
+var str = cat('file1', 'file2');
+var str = cat(['file1', 'file2']); // same as above
+```
+
+Returns a string containing the given file, or a concatenated string
+containing the files if more than one file is given (a new line character is
+introduced between each file). Wildcard `*` accepted.
+
+
+### '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!_
+
+
+### '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).
+
+
+### 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.
+
+
+### grep([options ,] regex_filter, file [, file ...])
+### grep([options ,] regex_filter, file_array)
+Available options:
+
++ `-v`: Inverse the sense of the regex and print the lines not matching the criteria.
+
+Examples:
+
+```javascript
+grep('-v', 'GLOBAL_VARIABLE', '*.js');
+grep('GLOBAL_VARIABLE', '*.js');
+```
+
+Reads input string from given files and returns a string containing all lines of the
+file that match the given `regex_filter`. Wildcard `*` accepted.
+
+
+### 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.
+
+
+### echo(string [,string ...])
+
+Examples:
+
+```javascript
+echo('hello world');
+var str = echo('hello world');
+```
+
+Prints string to stdout, and returns string with additional utility methods
+like `.to()`.
+
+
+### pushd([options,] [dir | '-N' | '+N'])
+
+Available options:
+
++ `-n`: Suppresses the normal change of directory when adding directories to the stack, so that only the stack is manipulated.
+
+Arguments:
+
++ `dir`: Makes the current working directory be the top of the stack, and then executes the equivalent of `cd dir`.
++ `+N`: Brings the Nth directory (counting from the left of the list printed by dirs, starting with zero) to the top of the list by rotating the stack.
++ `-N`: Brings the Nth directory (counting from the right of the list printed by dirs, starting with zero) to the top of the list by rotating the stack.
+
+Examples:
+
+```javascript
+// process.cwd() === '/usr'
+pushd('/etc'); // Returns /etc /usr
+pushd('+1');   // Returns /usr /etc
+```
+
+Save the current directory on the top of the directory stack and then cd to `dir`. With no arguments, pushd exchanges the top two directories. Returns an array of paths in the stack.
+
+### popd([options,] ['-N' | '+N'])
+
+Available options:
+
++ `-n`: Suppresses the normal change of directory when removing directories from the stack, so that only the stack is manipulated.
+
+Arguments:
+
++ `+N`: Removes the Nth directory (counting from the left of the list printed by dirs), starting with zero.
++ `-N`: Removes the Nth directory (counting from the right of the list printed by dirs), starting with zero.
+
+Examples:
+
+```javascript
+echo(process.cwd()); // '/usr'
+pushd('/etc');       // '/etc /usr'
+echo(process.cwd()); // '/etc'
+popd();              // '/usr'
+echo(process.cwd()); // '/usr'
+```
+
+When no arguments are given, popd removes the top directory from the stack and performs a cd to the new top directory. The elements are numbered from 0 starting at the first directory listed with dirs; i.e., popd is equivalent to popd +0. Returns an array of paths in the stack.
+
+### dirs([options | '+N' | '-N'])
+
+Available options:
+
++ `-c`: Clears the directory stack by deleting all of the elements.
+
+Arguments:
+
++ `+N`: Displays the Nth directory (counting from the left of the list printed by dirs when invoked without options), starting with zero.
++ `-N`: Displays the Nth directory (counting from the right of the list printed by dirs when invoked without options), starting with zero.
+
+Display the list of currently remembered directories. Returns an array of paths in the stack, or a single path if +N or -N was specified.
+
+See also: pushd, popd
+
+
+### exit(code)
+Exits the current process with the given exit code.
+
+### env['VAR_NAME']
+Object containing environment variables (both getter and setter). Shortcut to process.env.
+
+### exec(command [, options] [, callback])
+Available options (all `false` by default):
+
++ `async`: Asynchronous execution. Defaults to true if a callback is provided.
++ `silent`: Do not echo program output to console.
+
+Examples:
+
+```javascript
+var version = exec('node --version', {silent:true}).output;
+
+var child = exec('some_long_running_process', {async:true});
+child.stdout.on('data', function(data) {
+  /* ... do something with data ... */
+});
+
+exec('some_long_running_process', function(code, output) {
+  console.log('Exit code:', code);
+  console.log('Program output:', output);
+});
+```
+
+Executes the given `command` _synchronously_, unless otherwise specified.
+When in synchronous mode returns the object `{ code:..., output:... }`, containing the program's
+`output` (stdout + stderr)  and its exit `code`. Otherwise returns the child process object, and
+the `callback` gets the arguments `(code, output)`.
+
+**Note:** For long-lived processes, it's best to run `exec()` asynchronously as
+the current synchronous implementation uses a lot of CPU. This should be getting
+fixed soon.
+
+
+### chmod(octal_mode || octal_string, file)
+### chmod(symbolic_mode, file)
+
+Available options:
+
++ `-v`: output a diagnostic for every file processed
++ `-c`: like verbose but report only when a change is made
++ `-R`: change files and directories recursively
+
+Examples:
+
+```javascript
+chmod(755, '/Users/brandon');
+chmod('755', '/Users/brandon'); // same as above
+chmod('u+x', '/Users/brandon');
+```
+
+Alters the permissions of a file or directory by either specifying the
+absolute permissions in octal form or expressing the changes in symbols.
+This command tries to mimic the POSIX behavior as much as possible.
+Notable exceptions:
+
++ In symbolic modes, 'a-r' and '-r' are identical.  No consideration is
+  given to the umask.
++ There is no "quiet" option since default behavior is to run silent.
+
+
+## Non-Unix commands
+
+
+### 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).
+
+
+### error()
+Tests if error occurred in the last command. Returns `null` if no error occurred,
+otherwise returns string explaining the error
+
+
+## Configuration
+
+
+### config.silent
+Example:
+
+```javascript
+var silentState = config.silent; // save old silent state
+config.silent = true;
+/* ... */
+config.silent = silentState; // restore old silent state
+```
+
+Suppresses all command output if `true`, except for `echo()` calls.
+Default is `false`.
+
+### config.fatal
+Example:
+
+```javascript
+config.fatal = true;
+cp('this_file_does_not_exist', '/dev/null'); // dies here
+/* more commands... */
+```
+
+If `true` the script will die on errors. Default is `false`.

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/e1b4a533/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/bin/shjs
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/bin/shjs b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/bin/shjs
new file mode 100755
index 0000000..d239a7a
--- /dev/null
+++ b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/bin/shjs
@@ -0,0 +1,51 @@
+#!/usr/bin/env node
+require('../global');
+
+if (process.argv.length < 3) {
+  console.log('ShellJS: missing argument (script name)');
+  console.log();
+  process.exit(1);
+}
+
+var args,
+  scriptName = process.argv[2];
+env['NODE_PATH'] = __dirname + '/../..';
+
+if (!scriptName.match(/\.js/) && !scriptName.match(/\.coffee/)) {
+  if (test('-f', scriptName + '.js'))
+    scriptName += '.js';
+  if (test('-f', scriptName + '.coffee'))
+    scriptName += '.coffee';
+}
+
+if (!test('-f', scriptName)) {
+  console.log('ShellJS: script not found ('+scriptName+')');
+  console.log();
+  process.exit(1);
+}
+
+args = process.argv.slice(3);
+
+for (var i = 0, l = args.length; i < l; i++) {
+  if (args[i][0] !== "-"){
+    args[i] = '"' + args[i] + '"'; // fixes arguments with multiple words
+  }
+}
+
+if (scriptName.match(/\.coffee$/)) {
+  //
+  // CoffeeScript
+  //
+  if (which('coffee')) {
+    exec('coffee ' + scriptName + ' ' + args.join(' '), { async: true });
+  } else {
+    console.log('ShellJS: CoffeeScript interpreter not found');
+    console.log();
+    process.exit(1);
+  }
+} else {
+  //
+  // JavaScript
+  //
+  exec('node ' + scriptName + ' ' + args.join(' '), { async: true });
+}

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/e1b4a533/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/global.js
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/global.js b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/global.js
new file mode 100644
index 0000000..97f0033
--- /dev/null
+++ b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/global.js
@@ -0,0 +1,3 @@
+var shell = require('./shell.js');
+for (var cmd in shell)
+  global[cmd] = shell[cmd];

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/e1b4a533/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/make.js
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/make.js b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/make.js
new file mode 100644
index 0000000..53e5e81
--- /dev/null
+++ b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/make.js
@@ -0,0 +1,47 @@
+require('./global');
+
+global.config.fatal = true;
+global.target = {};
+
+// This ensures we only execute the script targets after the entire script has
+// been evaluated
+var args = process.argv.slice(2);
+setTimeout(function() {
+  var t;
+
+  if (args.length === 1 && args[0] === '--help') {
+    console.log('Available targets:');
+    for (t in global.target)
+      console.log('  ' + t);
+    return;
+  }
+
+  // Wrap targets to prevent duplicate execution
+  for (t in global.target) {
+    (function(t, oldTarget){
+
+      // Wrap it
+      global.target[t] = function(force) {
+        if (oldTarget.done && !force)
+          return;
+        oldTarget.done = true;
+        return oldTarget.apply(oldTarget, arguments);
+      };
+
+    })(t, global.target[t]);
+  }
+
+  // Execute desired targets
+  if (args.length > 0) {
+    args.forEach(function(arg) {
+      if (arg in global.target)
+        global.target[arg]();
+      else {
+        console.log('no such target: ' + arg);
+      }
+    });
+  } else if ('all' in global.target) {
+    global.target.all();
+  }
+
+}, 0);

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/e1b4a533/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/package.json
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/package.json b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/package.json
new file mode 100644
index 0000000..ddf3413
--- /dev/null
+++ b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/package.json
@@ -0,0 +1,61 @@
+{
+  "name": "shelljs",
+  "version": "0.2.6",
+  "author": {
+    "name": "Artur Adib",
+    "email": "aadib@mozilla.com"
+  },
+  "description": "Portable Unix shell commands for Node.js",
+  "keywords": [
+    "unix",
+    "shell",
+    "makefile",
+    "make",
+    "jake",
+    "synchronous"
+  ],
+  "repository": {
+    "type": "git",
+    "url": "git://github.com/arturadib/shelljs.git"
+  },
+  "homepage": "http://github.com/arturadib/shelljs",
+  "main": "./shell.js",
+  "scripts": {
+    "test": "node scripts/run-tests"
+  },
+  "bin": {
+    "shjs": "./bin/shjs"
+  },
+  "dependencies": {},
+  "devDependencies": {
+    "jshint": "~2.1.11"
+  },
+  "optionalDependencies": {},
+  "engines": {
+    "node": ">=0.8.0"
+  },
+  "bugs": {
+    "url": "https://github.com/arturadib/shelljs/issues"
+  },
+  "_id": "shelljs@0.2.6",
+  "dist": {
+    "shasum": "90492d72ffcc8159976baba62fb0f6884f0c3378",
+    "tarball": "http://registry.npmjs.org/shelljs/-/shelljs-0.2.6.tgz"
+  },
+  "_from": "shelljs@>=0.2.6 <0.3.0",
+  "_npmVersion": "1.3.8",
+  "_npmUser": {
+    "name": "artur",
+    "email": "arturadib@gmail.com"
+  },
+  "maintainers": [
+    {
+      "name": "artur",
+      "email": "arturadib@gmail.com"
+    }
+  ],
+  "directories": {},
+  "_shasum": "90492d72ffcc8159976baba62fb0f6884f0c3378",
+  "_resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.2.6.tgz",
+  "readme": "ERROR: No README data found!"
+}

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/e1b4a533/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/scripts/generate-docs.js
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/scripts/generate-docs.js b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/scripts/generate-docs.js
new file mode 100755
index 0000000..532fed9
--- /dev/null
+++ b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/scripts/generate-docs.js
@@ -0,0 +1,21 @@
+#!/usr/bin/env node
+require('../global');
+
+echo('Appending docs to README.md');
+
+cd(__dirname + '/..');
+
+// Extract docs from shell.js
+var docs = grep('//@', 'shell.js');
+
+docs = docs.replace(/\/\/\@include (.+)/g, function(match, path) {
+  var file = path.match('.js$') ? path : path+'.js';
+  return grep('//@', file);
+});
+
+// Remove '//@'
+docs = docs.replace(/\/\/\@ ?/g, '');
+// Append docs to README
+sed('-i', /## Command reference(.|\n)*/, '## Command reference\n\n' + docs, 'README.md');
+
+echo('All done.');

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/e1b4a533/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/scripts/run-tests.js
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/scripts/run-tests.js b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/scripts/run-tests.js
new file mode 100755
index 0000000..f9d31e0
--- /dev/null
+++ b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/scripts/run-tests.js
@@ -0,0 +1,50 @@
+#!/usr/bin/env node
+require('../global');
+
+var path = require('path');
+
+var failed = false;
+
+//
+// Lint
+//
+JSHINT_BIN = './node_modules/jshint/bin/jshint';
+cd(__dirname + '/..');
+
+if (!test('-f', JSHINT_BIN)) {
+  echo('JSHint not found. Run `npm install` in the root dir first.');
+  exit(1);
+}
+
+if (exec(JSHINT_BIN + ' *.js test/*.js').code !== 0) {
+  failed = true;
+  echo('*** JSHINT FAILED! (return code != 0)');
+  echo();
+} else {
+  echo('All JSHint tests passed');
+  echo();
+}
+
+//
+// Unit tests
+//
+cd(__dirname + '/../test');
+ls('*.js').forEach(function(file) {
+  echo('Running test:', file);
+  if (exec('node ' + file).code !== 123) { // 123 avoids false positives (e.g. premature exit)
+    failed = true;
+    echo('*** TEST FAILED! (missing exit code "123")');
+    echo();
+  }
+});
+
+if (failed) {
+  echo();
+  echo('*******************************************************');
+  echo('WARNING: Some tests did not pass!');
+  echo('*******************************************************');
+  exit(1);
+} else {
+  echo();
+  echo('All tests passed.');
+}

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/e1b4a533/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/shell.js
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/shell.js b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/shell.js
new file mode 100644
index 0000000..e56c5de
--- /dev/null
+++ b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/shell.js
@@ -0,0 +1,153 @@
+//
+// ShellJS
+// Unix shell commands on top of Node's API
+//
+// Copyright (c) 2012 Artur Adib
+// http://github.com/arturadib/shelljs
+//
+
+var common = require('./src/common');
+
+
+//@
+//@ All commands run synchronously, unless otherwise stated.
+//@
+
+//@include ./src/cd
+var _cd = require('./src/cd');
+exports.cd = common.wrap('cd', _cd);
+
+//@include ./src/pwd
+var _pwd = require('./src/pwd');
+exports.pwd = common.wrap('pwd', _pwd);
+
+//@include ./src/ls
+var _ls = require('./src/ls');
+exports.ls = common.wrap('ls', _ls);
+
+//@include ./src/find
+var _find = require('./src/find');
+exports.find = common.wrap('find', _find);
+
+//@include ./src/cp
+var _cp = require('./src/cp');
+exports.cp = common.wrap('cp', _cp);
+
+//@include ./src/rm
+var _rm = require('./src/rm');
+exports.rm = common.wrap('rm', _rm);
+
+//@include ./src/mv
+var _mv = require('./src/mv');
+exports.mv = common.wrap('mv', _mv);
+
+//@include ./src/mkdir
+var _mkdir = require('./src/mkdir');
+exports.mkdir = common.wrap('mkdir', _mkdir);
+
+//@include ./src/test
+var _test = require('./src/test');
+exports.test = common.wrap('test', _test);
+
+//@include ./src/cat
+var _cat = require('./src/cat');
+exports.cat = common.wrap('cat', _cat);
+
+//@include ./src/to
+var _to = require('./src/to');
+String.prototype.to = common.wrap('to', _to);
+
+//@include ./src/toEnd
+var _toEnd = require('./src/toEnd');
+String.prototype.toEnd = common.wrap('toEnd', _toEnd);
+
+//@include ./src/sed
+var _sed = require('./src/sed');
+exports.sed = common.wrap('sed', _sed);
+
+//@include ./src/grep
+var _grep = require('./src/grep');
+exports.grep = common.wrap('grep', _grep);
+
+//@include ./src/which
+var _which = require('./src/which');
+exports.which = common.wrap('which', _which);
+
+//@include ./src/echo
+var _echo = require('./src/echo');
+exports.echo = _echo; // don't common.wrap() as it could parse '-options'
+
+//@include ./src/dirs
+var _dirs = require('./src/dirs').dirs;
+exports.dirs = common.wrap("dirs", _dirs);
+var _pushd = require('./src/dirs').pushd;
+exports.pushd = common.wrap('pushd', _pushd);
+var _popd = require('./src/dirs').popd;
+exports.popd = common.wrap("popd", _popd);
+
+//@
+//@ ### exit(code)
+//@ Exits the current process with the given exit code.
+exports.exit = process.exit;
+
+//@
+//@ ### env['VAR_NAME']
+//@ Object containing environment variables (both getter and setter). Shortcut to process.env.
+exports.env = process.env;
+
+//@include ./src/exec
+var _exec = require('./src/exec');
+exports.exec = common.wrap('exec', _exec, {notUnix:true});
+
+//@include ./src/chmod
+var _chmod = require('./src/chmod');
+exports.chmod = common.wrap('chmod', _chmod);
+
+
+
+//@
+//@ ## Non-Unix commands
+//@
+
+//@include ./src/tempdir
+var _tempDir = require('./src/tempdir');
+exports.tempdir = common.wrap('tempdir', _tempDir);
+
+
+//@include ./src/error
+var _error = require('./src/error');
+exports.error = _error;
+
+
+
+//@
+//@ ## Configuration
+//@
+
+exports.config = common.config;
+
+//@
+//@ ### config.silent
+//@ Example:
+//@
+//@ ```javascript
+//@ var silentState = config.silent; // save old silent state
+//@ config.silent = true;
+//@ /* ... */
+//@ config.silent = silentState; // restore old silent state
+//@ ```
+//@
+//@ Suppresses all command output if `true`, except for `echo()` calls.
+//@ Default is `false`.
+
+//@
+//@ ### config.fatal
+//@ Example:
+//@
+//@ ```javascript
+//@ config.fatal = true;
+//@ cp('this_file_does_not_exist', '/dev/null'); // dies here
+//@ /* more commands... */
+//@ ```
+//@
+//@ If `true` the script will die on errors. Default is `false`.

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/e1b4a533/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/cat.js
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/cat.js b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/cat.js
new file mode 100644
index 0000000..f6f4d25
--- /dev/null
+++ b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/cat.js
@@ -0,0 +1,43 @@
+var common = require('./common');
+var fs = require('fs');
+
+//@
+//@ ### cat(file [, file ...])
+//@ ### cat(file_array)
+//@
+//@ Examples:
+//@
+//@ ```javascript
+//@ var str = cat('file*.txt');
+//@ var str = cat('file1', 'file2');
+//@ var str = cat(['file1', 'file2']); // same as above
+//@ ```
+//@
+//@ Returns a string containing the given file, or a concatenated string
+//@ containing the files if more than one file is given (a new line character is
+//@ introduced between each file). Wildcard `*` accepted.
+function _cat(options, files) {
+  var cat = '';
+
+  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))
+      common.error('no such file or directory: ' + file);
+
+    cat += fs.readFileSync(file, 'utf8') + '\n';
+  });
+
+  if (cat[cat.length-1] === '\n')
+    cat = cat.substring(0, cat.length-1);
+
+  return common.ShellString(cat);
+}
+module.exports = _cat;

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/e1b4a533/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/cd.js
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/cd.js b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/cd.js
new file mode 100644
index 0000000..230f432
--- /dev/null
+++ b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/cd.js
@@ -0,0 +1,19 @@
+var fs = require('fs');
+var common = require('./common');
+
+//@
+//@ ### cd('dir')
+//@ Changes to directory `dir` for the duration of the script
+function _cd(options, dir) {
+  if (!dir)
+    common.error('directory not specified');
+
+  if (!fs.existsSync(dir))
+    common.error('no such file or directory: ' + dir);
+
+  if (!fs.statSync(dir).isDirectory())
+    common.error('not a directory: ' + dir);
+
+  process.chdir(dir);
+}
+module.exports = _cd;

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/e1b4a533/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/chmod.js
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/chmod.js b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/chmod.js
new file mode 100644
index 0000000..f288893
--- /dev/null
+++ b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/chmod.js
@@ -0,0 +1,208 @@
+var common = require('./common');
+var fs = require('fs');
+var path = require('path');
+
+var PERMS = (function (base) {
+  return {
+    OTHER_EXEC  : base.EXEC,
+    OTHER_WRITE : base.WRITE,
+    OTHER_READ  : base.READ,
+
+    GROUP_EXEC  : base.EXEC  << 3,
+    GROUP_WRITE : base.WRITE << 3,
+    GROUP_READ  : base.READ << 3,
+
+    OWNER_EXEC  : base.EXEC << 6,
+    OWNER_WRITE : base.WRITE << 6,
+    OWNER_READ  : base.READ << 6,
+
+    // Literal octal numbers are apparently not allowed in "strict" javascript.  Using parseInt is
+    // the preferred way, else a jshint warning is thrown.
+    STICKY      : parseInt('01000', 8),
+    SETGID      : parseInt('02000', 8),
+    SETUID      : parseInt('04000', 8),
+
+    TYPE_MASK   : parseInt('0770000', 8)
+  };
+})({
+  EXEC  : 1,
+  WRITE : 2,
+  READ  : 4
+});
+
+//@
+//@ ### chmod(octal_mode || octal_string, file)
+//@ ### chmod(symbolic_mode, file)
+//@
+//@ Available options:
+//@
+//@ + `-v`: output a diagnostic for every file processed//@
+//@ + `-c`: like verbose but report only when a change is made//@
+//@ + `-R`: change files and directories recursively//@
+//@
+//@ Examples:
+//@
+//@ ```javascript
+//@ chmod(755, '/Users/brandon');
+//@ chmod('755', '/Users/brandon'); // same as above
+//@ chmod('u+x', '/Users/brandon');
+//@ ```
+//@
+//@ Alters the permissions of a file or directory by either specifying the
+//@ absolute permissions in octal form or expressing the changes in symbols.
+//@ This command tries to mimic the POSIX behavior as much as possible.
+//@ Notable exceptions:
+//@
+//@ + In symbolic modes, 'a-r' and '-r' are identical.  No consideration is
+//@   given to the umask.
+//@ + There is no "quiet" option since default behavior is to run silent.
+function _chmod(options, mode, filePattern) {
+  if (!filePattern) {
+    if (options.length > 0 && options.charAt(0) === '-') {
+      // Special case where the specified file permissions started with - to subtract perms, which
+      // get picked up by the option parser as command flags.
+      // If we are down by one argument and options starts with -, shift everything over.
+      filePattern = mode;
+      mode = options;
+      options = '';
+    }
+    else {
+      common.error('You must specify a file.');
+    }
+  }
+
+  options = common.parseOptions(options, {
+    'R': 'recursive',
+    'c': 'changes',
+    'v': 'verbose'
+  });
+
+  if (typeof filePattern === 'string') {
+    filePattern = [ filePattern ];
+  }
+
+  var files;
+
+  if (options.recursive) {
+    files = [];
+    common.expand(filePattern).forEach(function addFile(expandedFile) {
+      var stat = fs.lstatSync(expandedFile);
+
+      if (!stat.isSymbolicLink()) {
+        files.push(expandedFile);
+
+        if (stat.isDirectory()) {  // intentionally does not follow symlinks.
+          fs.readdirSync(expandedFile).forEach(function (child) {
+            addFile(expandedFile + '/' + child);
+          });
+        }
+      }
+    });
+  }
+  else {
+    files = common.expand(filePattern);
+  }
+
+  files.forEach(function innerChmod(file) {
+    file = path.resolve(file);
+    if (!fs.existsSync(file)) {
+      common.error('File not found: ' + file);
+    }
+
+    // When recursing, don't follow symlinks.
+    if (options.recursive && fs.lstatSync(file).isSymbolicLink()) {
+      return;
+    }
+
+    var perms = fs.statSync(file).mode;
+    var type = perms & PERMS.TYPE_MASK;
+
+    var newPerms = perms;
+
+    if (isNaN(parseInt(mode, 8))) {
+      // parse options
+      mode.split(',').forEach(function (symbolicMode) {
+        /*jshint regexdash:true */
+        var pattern = /([ugoa]*)([=\+-])([rwxXst]*)/i;
+        var matches = pattern.exec(symbolicMode);
+
+        if (matches) {
+          var applyTo = matches[1];
+          var operator = matches[2];
+          var change = matches[3];
+
+          var changeOwner = applyTo.indexOf('u') != -1 || applyTo === 'a' || applyTo === '';
+          var changeGroup = applyTo.indexOf('g') != -1 || applyTo === 'a' || applyTo === '';
+          var changeOther = applyTo.indexOf('o') != -1 || applyTo === 'a' || applyTo === '';
+
+          var changeRead   = change.indexOf('r') != -1;
+          var changeWrite  = change.indexOf('w') != -1;
+          var changeExec   = change.indexOf('x') != -1;
+          var changeSticky = change.indexOf('t') != -1;
+          var changeSetuid = change.indexOf('s') != -1;
+
+          var mask = 0;
+          if (changeOwner) {
+            mask |= (changeRead ? PERMS.OWNER_READ : 0) + (changeWrite ? PERMS.OWNER_WRITE : 0) + (changeExec ? PERMS.OWNER_EXEC : 0) + (changeSetuid ? PERMS.SETUID : 0);
+          }
+          if (changeGroup) {
+            mask |= (changeRead ? PERMS.GROUP_READ : 0) + (changeWrite ? PERMS.GROUP_WRITE : 0) + (changeExec ? PERMS.GROUP_EXEC : 0) + (changeSetuid ? PERMS.SETGID : 0);
+          }
+          if (changeOther) {
+            mask |= (changeRead ? PERMS.OTHER_READ : 0) + (changeWrite ? PERMS.OTHER_WRITE : 0) + (changeExec ? PERMS.OTHER_EXEC : 0);
+          }
+
+          // Sticky bit is special - it's not tied to user, group or other.
+          if (changeSticky) {
+            mask |= PERMS.STICKY;
+          }
+
+          switch (operator) {
+            case '+':
+              newPerms |= mask;
+              break;
+
+            case '-':
+              newPerms &= ~mask;
+              break;
+
+            case '=':
+              newPerms = type + mask;
+
+              // According to POSIX, when using = to explicitly set the permissions, setuid and setgid can never be cleared.
+              if (fs.statSync(file).isDirectory()) {
+                newPerms |= (PERMS.SETUID + PERMS.SETGID) & perms;
+              }
+              break;
+          }
+
+          if (options.verbose) {
+            log(file + ' -> ' + newPerms.toString(8));
+          }
+
+          if (perms != newPerms) {
+            if (!options.verbose && options.changes) {
+              log(file + ' -> ' + newPerms.toString(8));
+            }
+            fs.chmodSync(file, newPerms);
+          }
+        }
+        else {
+          common.error('Invalid symbolic mode change: ' + symbolicMode);
+        }
+      });
+    }
+    else {
+      // they gave us a full number
+      newPerms = type + parseInt(mode, 8);
+
+      // POSIX rules are that setuid and setgid can only be added using numeric form, but not cleared.
+      if (fs.statSync(file).isDirectory()) {
+        newPerms |= (PERMS.SETUID + PERMS.SETGID) & perms;
+      }
+
+      fs.chmodSync(file, newPerms);
+    }
+  });
+}
+module.exports = _chmod;

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/e1b4a533/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/common.js
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/common.js b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/common.js
new file mode 100644
index 0000000..fe20871
--- /dev/null
+++ b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/common.js
@@ -0,0 +1,189 @@
+var os = require('os');
+var fs = require('fs');
+var _ls = require('./ls');
+
+// Module globals
+var config = {
+  silent: false,
+  fatal: false
+};
+exports.config = config;
+
+var state = {
+  error: null,
+  currentCmd: 'shell.js',
+  tempDir: null
+};
+exports.state = state;
+
+var platform = os.type().match(/^Win/) ? 'win' : 'unix';
+exports.platform = platform;
+
+function log() {
+  if (!config.silent)
+    console.log.apply(this, arguments);
+}
+exports.log = log;
+
+// Shows error message. Throws unless _continue or config.fatal are true
+function error(msg, _continue) {
+  if (state.error === null)
+    state.error = '';
+  state.error += state.currentCmd + ': ' + msg + '\n';
+
+  if (msg.length > 0)
+    log(state.error);
+
+  if (config.fatal)
+    process.exit(1);
+
+  if (!_continue)
+    throw '';
+}
+exports.error = error;
+
+// In the future, when Proxies are default, we can add methods like `.to()` to primitive strings.
+// For now, this is a dummy function to bookmark places we need such strings
+function ShellString(str) {
+  return str;
+}
+exports.ShellString = ShellString;
+
+// Returns {'alice': true, 'bob': false} when passed a dictionary, e.g.:
+//   parseOptions('-a', {'a':'alice', 'b':'bob'});
+function parseOptions(str, map) {
+  if (!map)
+    error('parseOptions() internal error: no map given');
+
+  // All options are false by default
+  var options = {};
+  for (var letter in map)
+    options[map[letter]] = false;
+
+  if (!str)
+    return options; // defaults
+
+  if (typeof str !== 'string')
+    error('parseOptions() internal error: wrong str');
+
+  // e.g. match[1] = 'Rf' for str = '-Rf'
+  var match = str.match(/^\-(.+)/);
+  if (!match)
+    return options;
+
+  // e.g. chars = ['R', 'f']
+  var chars = match[1].split('');
+
+  chars.forEach(function(c) {
+    if (c in map)
+      options[map[c]] = true;
+    else
+      error('option not recognized: '+c);
+  });
+
+  return options;
+}
+exports.parseOptions = parseOptions;
+
+// Expands wildcards with matching (ie. existing) file names.
+// For example:
+//   expand(['file*.js']) = ['file1.js', 'file2.js', ...]
+//   (if the files 'file1.js', 'file2.js', etc, exist in the current dir)
+function expand(list) {
+  var expanded = [];
+  list.forEach(function(listEl) {
+    // Wildcard present?
+    if (listEl.search(/\*/) > -1) {
+      _ls('', listEl).forEach(function(file) {
+        expanded.push(file);
+      });
+    } else {
+      expanded.push(listEl);
+    }
+  });
+  return expanded;
+}
+exports.expand = expand;
+
+// Normalizes _unlinkSync() across platforms to match Unix behavior, i.e.
+// file can be unlinked even if it's read-only, see https://github.com/joyent/node/issues/3006
+function unlinkSync(file) {
+  try {
+    fs.unlinkSync(file);
+  } catch(e) {
+    // Try to override file permission
+    if (e.code === 'EPERM') {
+      fs.chmodSync(file, '0666');
+      fs.unlinkSync(file);
+    } else {
+      throw e;
+    }
+  }
+}
+exports.unlinkSync = unlinkSync;
+
+// e.g. 'shelljs_a5f185d0443ca...'
+function randomFileName() {
+  function randomHash(count) {
+    if (count === 1)
+      return parseInt(16*Math.random(), 10).toString(16);
+    else {
+      var hash = '';
+      for (var i=0; i<count; i++)
+        hash += randomHash(1);
+      return hash;
+    }
+  }
+
+  return 'shelljs_'+randomHash(20);
+}
+exports.randomFileName = randomFileName;
+
+// extend(target_obj, source_obj1 [, source_obj2 ...])
+// Shallow extend, e.g.:
+//    extend({A:1}, {b:2}, {c:3}) returns {A:1, b:2, c:3}
+function extend(target) {
+  var sources = [].slice.call(arguments, 1);
+  sources.forEach(function(source) {
+    for (var key in source)
+      target[key] = source[key];
+  });
+
+  return target;
+}
+exports.extend = extend;
+
+// Common wrapper for all Unix-like commands
+function wrap(cmd, fn, options) {
+  return function() {
+    var retValue = null;
+
+    state.currentCmd = cmd;
+    state.error = null;
+
+    try {
+      var args = [].slice.call(arguments, 0);
+
+      if (options && options.notUnix) {
+        retValue = fn.apply(this, args);
+      } else {
+        if (args.length === 0 || typeof args[0] !== 'string' || args[0][0] !== '-')
+          args.unshift(''); // only add dummy option if '-option' not already present
+        retValue = fn.apply(this, args);
+      }
+    } catch (e) {
+      if (!state.error) {
+        // If state.error hasn't been set it's an error thrown by Node, not us - probably a bug...
+        console.log('shell.js: internal error');
+        console.log(e.stack || e);
+        process.exit(1);
+      }
+      if (config.fatal)
+        throw e;
+    }
+
+    state.currentCmd = 'shell.js';
+    return retValue;
+  };
+} // wrap
+exports.wrap = wrap;

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/e1b4a533/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/cp.js
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/cp.js b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/cp.js
new file mode 100644
index 0000000..a1bc529
--- /dev/null
+++ b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/cp.js
@@ -0,0 +1,200 @@
+var fs = require('fs');
+var path = require('path');
+var common = require('./common');
+
+// Buffered file copy, synchronous
+// (Using readFileSync() + writeFileSync() could easily cause a memory overflow
+//  with large files)
+function copyFileSync(srcFile, destFile) {
+  if (!fs.existsSync(srcFile))
+    common.error('copyFileSync: no such file or directory: ' + srcFile);
+
+  var BUF_LENGTH = 64*1024,
+      buf = new Buffer(BUF_LENGTH),
+      bytesRead = BUF_LENGTH,
+      pos = 0,
+      fdr = null,
+      fdw = null;
+
+  try {
+    fdr = fs.openSync(srcFile, 'r');
+  } catch(e) {
+    common.error('copyFileSync: could not read src file ('+srcFile+')');
+  }
+
+  try {
+    fdw = fs.openSync(destFile, 'w');
+  } catch(e) {
+    common.error('copyFileSync: could not write to dest file (code='+e.code+'):'+destFile);
+  }
+
+  while (bytesRead === BUF_LENGTH) {
+    bytesRead = fs.readSync(fdr, buf, 0, BUF_LENGTH, pos);
+    fs.writeSync(fdw, buf, 0, bytesRead);
+    pos += bytesRead;
+  }
+
+  fs.closeSync(fdr);
+  fs.closeSync(fdw);
+
+  fs.chmodSync(destFile, fs.statSync(srcFile).mode);
+}
+
+// Recursively copies 'sourceDir' into 'destDir'
+// 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 cpdirSyncRecursive(sourceDir, destDir, opts) {
+  if (!opts) opts = {};
+
+  /* Create the directory where all our junk is moving to; read the mode of the source directory and mirror it */
+  var checkDir = fs.statSync(sourceDir);
+  try {
+    fs.mkdirSync(destDir, checkDir.mode);
+  } catch (e) {
+    //if the directory already exists, that's okay
+    if (e.code !== 'EEXIST') throw e;
+  }
+
+  var files = fs.readdirSync(sourceDir);
+
+  for (var i = 0; i < files.length; i++) {
+    var srcFile = sourceDir + "/" + files[i];
+    var destFile = destDir + "/" + files[i];
+    var srcFileStat = fs.lstatSync(srcFile);
+
+    if (srcFileStat.isDirectory()) {
+      /* recursion this thing right on back. */
+      cpdirSyncRecursive(srcFile, destFile, opts);
+    } else if (srcFileStat.isSymbolicLink()) {
+      var symlinkFull = fs.readlinkSync(srcFile);
+      fs.symlinkSync(symlinkFull, destFile);
+    } else {
+      /* At this point, we've hit a file actually worth copying... so copy it on over. */
+      if (fs.existsSync(destFile) && !opts.force) {
+        common.log('skipping existing file: ' + files[i]);
+      } else {
+        copyFileSync(srcFile, destFile);
+      }
+    }
+
+  } // for files
+} // cpdirSyncRecursive
+
+
+//@
+//@ ### cp([options ,] source [,source ...], dest)
+//@ ### cp([options ,] source_array, dest)
+//@ Available options:
+//@
+//@ + `-f`: force
+//@ + `-r, -R`: recursive
+//@
+//@ Examples:
+//@
+//@ ```javascript
+//@ cp('file1', 'dir1');
+//@ cp('-Rf', '/tmp/*', '/usr/local/*', '/home/tmp');
+//@ cp('-Rf', ['/tmp/*', '/usr/local/*'], '/home/tmp'); // same as above
+//@ ```
+//@
+//@ Copies files. The wildcard `*` is accepted.
+function _cp(options, sources, dest) {
+  options = common.parseOptions(options, {
+    'f': 'force',
+    'R': 'recursive',
+    'r': 'recursive'
+  });
+
+  // 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');
+  }
+
+  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);
+
+  if (options.recursive) {
+    // Recursive allows the shortcut syntax "sourcedir/" for "sourcedir/*"
+    // (see Github issue #15)
+    sources.forEach(function(src, i) {
+      if (src[src.length - 1] === '/')
+        sources[i] += '*';
+    });
+
+    // Create dest
+    try {
+      fs.mkdirSync(dest, parseInt('0777', 8));
+    } catch (e) {
+      // like Unix's cp, keep going even if we can't create dest dir
+    }
+  }
+
+  sources = common.expand(sources);
+
+  sources.forEach(function(src) {
+    if (!fs.existsSync(src)) {
+      common.error('no such file or directory: '+src, true);
+      return; // skip file
+    }
+
+    // If here, src exists
+    if (fs.statSync(src).isDirectory()) {
+      if (!options.recursive) {
+        // Non-Recursive
+        common.log(src + ' is a directory (not copied)');
+      } else {
+        // Recursive
+        // 'cp /a/source dest' should create 'source' in 'dest'
+        var newDest = path.join(dest, path.basename(src)),
+            checkDir = fs.statSync(src);
+        try {
+          fs.mkdirSync(newDest, checkDir.mode);
+        } catch (e) {
+          //if the directory already exists, that's okay
+          if (e.code !== 'EEXIST') throw e;
+        }
+
+        cpdirSyncRecursive(src, newDest, {force: options.force});
+      }
+      return; // done with dir
+    }
+
+    // If here, src is a file
+
+    // 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
+    }
+
+    copyFileSync(src, thisDest);
+  }); // forEach(src)
+}
+module.exports = _cp;

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/e1b4a533/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/dirs.js
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/dirs.js b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/dirs.js
new file mode 100644
index 0000000..58fae8b
--- /dev/null
+++ b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/dirs.js
@@ -0,0 +1,191 @@
+var common = require('./common');
+var _cd = require('./cd');
+var path = require('path');
+
+// Pushd/popd/dirs internals
+var _dirStack = [];
+
+function _isStackIndex(index) {
+  return (/^[\-+]\d+$/).test(index);
+}
+
+function _parseStackIndex(index) {
+  if (_isStackIndex(index)) {
+    if (Math.abs(index) < _dirStack.length + 1) { // +1 for pwd
+      return (/^-/).test(index) ? Number(index) - 1 : Number(index);
+    } else {
+      common.error(index + ': directory stack index out of range');
+    }
+  } else {
+    common.error(index + ': invalid number');
+  }
+}
+
+function _actualDirStack() {
+  return [process.cwd()].concat(_dirStack);
+}
+
+//@
+//@ ### pushd([options,] [dir | '-N' | '+N'])
+//@
+//@ Available options:
+//@
+//@ + `-n`: Suppresses the normal change of directory when adding directories to the stack, so that only the stack is manipulated.
+//@
+//@ Arguments:
+//@
+//@ + `dir`: Makes the current working directory be the top of the stack, and then executes the equivalent of `cd dir`.
+//@ + `+N`: Brings the Nth directory (counting from the left of the list printed by dirs, starting with zero) to the top of the list by rotating the stack.
+//@ + `-N`: Brings the Nth directory (counting from the right of the list printed by dirs, starting with zero) to the top of the list by rotating the stack.
+//@
+//@ Examples:
+//@
+//@ ```javascript
+//@ // process.cwd() === '/usr'
+//@ pushd('/etc'); // Returns /etc /usr
+//@ pushd('+1');   // Returns /usr /etc
+//@ ```
+//@
+//@ Save the current directory on the top of the directory stack and then cd to `dir`. With no arguments, pushd exchanges the top two directories. Returns an array of paths in the stack.
+function _pushd(options, dir) {
+  if (_isStackIndex(options)) {
+    dir = options;
+    options = '';
+  }
+
+  options = common.parseOptions(options, {
+    'n' : 'no-cd'
+  });
+
+  var dirs = _actualDirStack();
+
+  if (dir === '+0') {
+    return dirs; // +0 is a noop
+  } else if (!dir) {
+    if (dirs.length > 1) {
+      dirs = dirs.splice(1, 1).concat(dirs);
+    } else {
+      return common.error('no other directory');
+    }
+  } else if (_isStackIndex(dir)) {
+    var n = _parseStackIndex(dir);
+    dirs = dirs.slice(n).concat(dirs.slice(0, n));
+  } else {
+    if (options['no-cd']) {
+      dirs.splice(1, 0, dir);
+    } else {
+      dirs.unshift(dir);
+    }
+  }
+
+  if (options['no-cd']) {
+    dirs = dirs.slice(1);
+  } else {
+    dir = path.resolve(dirs.shift());
+    _cd('', dir);
+  }
+
+  _dirStack = dirs;
+  return _dirs('');
+}
+exports.pushd = _pushd;
+
+//@
+//@ ### popd([options,] ['-N' | '+N'])
+//@
+//@ Available options:
+//@
+//@ + `-n`: Suppresses the normal change of directory when removing directories from the stack, so that only the stack is manipulated.
+//@
+//@ Arguments:
+//@
+//@ + `+N`: Removes the Nth directory (counting from the left of the list printed by dirs), starting with zero.
+//@ + `-N`: Removes the Nth directory (counting from the right of the list printed by dirs), starting with zero.
+//@
+//@ Examples:
+//@
+//@ ```javascript
+//@ echo(process.cwd()); // '/usr'
+//@ pushd('/etc');       // '/etc /usr'
+//@ echo(process.cwd()); // '/etc'
+//@ popd();              // '/usr'
+//@ echo(process.cwd()); // '/usr'
+//@ ```
+//@
+//@ When no arguments are given, popd removes the top directory from the stack and performs a cd to the new top directory. The elements are numbered from 0 starting at the first directory listed with dirs; i.e., popd is equivalent to popd +0. Returns an array of paths in the stack.
+function _popd(options, index) {
+  if (_isStackIndex(options)) {
+    index = options;
+    options = '';
+  }
+
+  options = common.parseOptions(options, {
+    'n' : 'no-cd'
+  });
+
+  if (!_dirStack.length) {
+    return common.error('directory stack empty');
+  }
+
+  index = _parseStackIndex(index || '+0');
+
+  if (options['no-cd'] || index > 0 || _dirStack.length + index === 0) {
+    index = index > 0 ? index - 1 : index;
+    _dirStack.splice(index, 1);
+  } else {
+    var dir = path.resolve(_dirStack.shift());
+    _cd('', dir);
+  }
+
+  return _dirs('');
+}
+exports.popd = _popd;
+
+//@
+//@ ### dirs([options | '+N' | '-N'])
+//@
+//@ Available options:
+//@
+//@ + `-c`: Clears the directory stack by deleting all of the elements.
+//@
+//@ Arguments:
+//@
+//@ + `+N`: Displays the Nth directory (counting from the left of the list printed by dirs when invoked without options), starting with zero.
+//@ + `-N`: Displays the Nth directory (counting from the right of the list printed by dirs when invoked without options), starting with zero.
+//@
+//@ Display the list of currently remembered directories. Returns an array of paths in the stack, or a single path if +N or -N was specified.
+//@
+//@ See also: pushd, popd
+function _dirs(options, index) {
+  if (_isStackIndex(options)) {
+    index = options;
+    options = '';
+  }
+
+  options = common.parseOptions(options, {
+    'c' : 'clear'
+  });
+
+  if (options['clear']) {
+    _dirStack = [];
+    return _dirStack;
+  }
+
+  var stack = _actualDirStack();
+
+  if (index) {
+    index = _parseStackIndex(index);
+
+    if (index < 0) {
+      index = stack.length + index;
+    }
+
+    common.log(stack[index]);
+    return stack[index];
+  }
+
+  common.log(stack.join(' '));
+
+  return stack;
+}
+exports.dirs = _dirs;

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/e1b4a533/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/echo.js
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/echo.js b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/echo.js
new file mode 100644
index 0000000..760ea84
--- /dev/null
+++ b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/echo.js
@@ -0,0 +1,20 @@
+var common = require('./common');
+
+//@
+//@ ### echo(string [,string ...])
+//@
+//@ Examples:
+//@
+//@ ```javascript
+//@ echo('hello world');
+//@ var str = echo('hello world');
+//@ ```
+//@
+//@ Prints string to stdout, and returns string with additional utility methods
+//@ like `.to()`.
+function _echo() {
+  var messages = [].slice.call(arguments, 0);
+  console.log.apply(this, messages);
+  return common.ShellString(messages.join(' '));
+}
+module.exports = _echo;

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/e1b4a533/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/error.js
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/error.js b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/error.js
new file mode 100644
index 0000000..cca3efb
--- /dev/null
+++ b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/error.js
@@ -0,0 +1,10 @@
+var common = require('./common');
+
+//@
+//@ ### error()
+//@ Tests if error occurred in the last command. Returns `null` if no error occurred,
+//@ otherwise returns string explaining the error
+function error() {
+  return common.state.error;
+};
+module.exports = error;

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/e1b4a533/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/exec.js
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/exec.js b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/exec.js
new file mode 100644
index 0000000..7ccdbc0
--- /dev/null
+++ b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/exec.js
@@ -0,0 +1,181 @@
+var common = require('./common');
+var _tempDir = require('./tempdir');
+var _pwd = require('./pwd');
+var path = require('path');
+var fs = require('fs');
+var child = require('child_process');
+
+// Hack to run child_process.exec() synchronously (sync avoids callback hell)
+// Uses a custom wait loop that checks for a flag file, created when the child process is done.
+// (Can't do a wait loop that checks for internal Node variables/messages as
+// Node is single-threaded; callbacks and other internal state changes are done in the
+// event loop).
+function execSync(cmd, opts) {
+  var tempDir = _tempDir();
+  var stdoutFile = path.resolve(tempDir+'/'+common.randomFileName()),
+      codeFile = path.resolve(tempDir+'/'+common.randomFileName()),
+      scriptFile = path.resolve(tempDir+'/'+common.randomFileName()),
+      sleepFile = path.resolve(tempDir+'/'+common.randomFileName());
+
+  var options = common.extend({
+    silent: common.config.silent
+  }, opts);
+
+  var previousStdoutContent = '';
+  // Echoes stdout changes from running process, if not silent
+  function updateStdout() {
+    if (options.silent || !fs.existsSync(stdoutFile))
+      return;
+
+    var stdoutContent = fs.readFileSync(stdoutFile, 'utf8');
+    // No changes since last time?
+    if (stdoutContent.length <= previousStdoutContent.length)
+      return;
+
+    process.stdout.write(stdoutContent.substr(previousStdoutContent.length));
+    previousStdoutContent = stdoutContent;
+  }
+
+  function escape(str) {
+    return (str+'').replace(/([\\"'])/g, "\\$1").replace(/\0/g, "\\0");
+  }
+
+  cmd += ' > '+stdoutFile+' 2>&1'; // works on both win/unix
+
+  var script =
+   "var child = require('child_process')," +
+   "     fs = require('fs');" +
+   "child.exec('"+escape(cmd)+"', {env: process.env, maxBuffer: 20*1024*1024}, function(err) {" +
+   "  fs.writeFileSync('"+escape(codeFile)+"', err ? err.code.toString() : '0');" +
+   "});";
+
+  if (fs.existsSync(scriptFile)) common.unlinkSync(scriptFile);
+  if (fs.existsSync(stdoutFile)) common.unlinkSync(stdoutFile);
+  if (fs.existsSync(codeFile)) common.unlinkSync(codeFile);
+
+  fs.writeFileSync(scriptFile, script);
+  child.exec('"'+process.execPath+'" '+scriptFile, {
+    env: process.env,
+    cwd: _pwd(),
+    maxBuffer: 20*1024*1024
+  });
+
+  // The wait loop
+  // sleepFile is used as a dummy I/O op to mitigate unnecessary CPU usage
+  // (tried many I/O sync ops, writeFileSync() seems to be only one that is effective in reducing
+  // CPU usage, though apparently not so much on Windows)
+  while (!fs.existsSync(codeFile)) { updateStdout(); fs.writeFileSync(sleepFile, 'a'); }
+  while (!fs.existsSync(stdoutFile)) { updateStdout(); fs.writeFileSync(sleepFile, 'a'); }
+
+  // At this point codeFile exists, but it's not necessarily flushed yet.
+  // Keep reading it until it is.
+  var code = parseInt('', 10);
+  while (isNaN(code)) {
+    code = parseInt(fs.readFileSync(codeFile, 'utf8'), 10);
+  }
+
+  var stdout = fs.readFileSync(stdoutFile, 'utf8');
+
+  // No biggie if we can't erase the files now -- they're in a temp dir anyway
+  try { common.unlinkSync(scriptFile); } catch(e) {}
+  try { common.unlinkSync(stdoutFile); } catch(e) {}
+  try { common.unlinkSync(codeFile); } catch(e) {}
+  try { common.unlinkSync(sleepFile); } catch(e) {}
+
+  // some shell return codes are defined as errors, per http://tldp.org/LDP/abs/html/exitcodes.html
+  if (code === 1 || code === 2 || code >= 126)  {
+      common.error('', true); // unix/shell doesn't really give an error message after non-zero exit codes
+  }
+  // True if successful, false if not
+  var obj = {
+    code: code,
+    output: stdout
+  };
+  return obj;
+} // execSync()
+
+// Wrapper around exec() to enable echoing output to console in real time
+function execAsync(cmd, opts, callback) {
+  var output = '';
+
+  var options = common.extend({
+    silent: common.config.silent
+  }, opts);
+
+  var c = child.exec(cmd, {env: process.env, maxBuffer: 20*1024*1024}, function(err) {
+    if (callback)
+      callback(err ? err.code : 0, output);
+  });
+
+  c.stdout.on('data', function(data) {
+    output += data;
+    if (!options.silent)
+      process.stdout.write(data);
+  });
+
+  c.stderr.on('data', function(data) {
+    output += data;
+    if (!options.silent)
+      process.stdout.write(data);
+  });
+
+  return c;
+}
+
+//@
+//@ ### exec(command [, options] [, callback])
+//@ Available options (all `false` by default):
+//@
+//@ + `async`: Asynchronous execution. Defaults to true if a callback is provided.
+//@ + `silent`: Do not echo program output to console.
+//@
+//@ Examples:
+//@
+//@ ```javascript
+//@ var version = exec('node --version', {silent:true}).output;
+//@
+//@ var child = exec('some_long_running_process', {async:true});
+//@ child.stdout.on('data', function(data) {
+//@   /* ... do something with data ... */
+//@ });
+//@
+//@ exec('some_long_running_process', function(code, output) {
+//@   console.log('Exit code:', code);
+//@   console.log('Program output:', output);
+//@ });
+//@ ```
+//@
+//@ Executes the given `command` _synchronously_, unless otherwise specified.
+//@ When in synchronous mode returns the object `{ code:..., output:... }`, containing the program's
+//@ `output` (stdout + stderr)  and its exit `code`. Otherwise returns the child process object, and
+//@ the `callback` gets the arguments `(code, output)`.
+//@
+//@ **Note:** For long-lived processes, it's best to run `exec()` asynchronously as
+//@ the current synchronous implementation uses a lot of CPU. This should be getting
+//@ fixed soon.
+function _exec(command, options, callback) {
+  if (!command)
+    common.error('must specify command');
+
+  // Callback is defined instead of options.
+  if (typeof options === 'function') {
+    callback = options;
+    options = { async: true };
+  }
+
+  // Callback is defined with options.
+  if (typeof options === 'object' && typeof callback === 'function') {
+    options.async = true;
+  }
+
+  options = common.extend({
+    silent: common.config.silent,
+    async: false
+  }, options);
+
+  if (options.async)
+    return execAsync(command, options, callback);
+  else
+    return execSync(command, options);
+}
+module.exports = _exec;

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/e1b4a533/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/find.js
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/find.js b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/find.js
new file mode 100644
index 0000000..d9eeec2
--- /dev/null
+++ b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/find.js
@@ -0,0 +1,51 @@
+var fs = require('fs');
+var common = require('./common');
+var _ls = require('./ls');
+
+//@
+//@ ### find(path [,path ...])
+//@ ### find(path_array)
+//@ Examples:
+//@
+//@ ```javascript
+//@ find('src', 'lib');
+//@ find(['src', 'lib']); // same as above
+//@ find('.').filter(function(file) { return file.match(/\.js$/); });
+//@ ```
+//@
+//@ Returns array of all files (however deep) in the given paths.
+//@
+//@ The main difference from `ls('-R', path)` is that the resulting file names
+//@ include the base directories, e.g. `lib/resources/file1` instead of just `file1`.
+function _find(options, paths) {
+  if (!paths)
+    common.error('no path specified');
+  else if (typeof paths === 'object')
+    paths = paths; // assume array
+  else if (typeof paths === 'string')
+    paths = [].slice.call(arguments, 1);
+
+  var list = [];
+
+  function pushFile(file) {
+    if (common.platform === 'win')
+      file = file.replace(/\\/g, '/');
+    list.push(file);
+  }
+
+  // why not simply do ls('-R', paths)? because the output wouldn't give the base dirs
+  // to get the base dir in the output, we need instead ls('-R', 'dir/*') for every directory
+
+  paths.forEach(function(file) {
+    pushFile(file);
+
+    if (fs.statSync(file).isDirectory()) {
+      _ls('-RA', file+'/*').forEach(function(subfile) {
+        pushFile(subfile);
+      });
+    }
+  });
+
+  return list;
+}
+module.exports = _find;

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/e1b4a533/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/grep.js
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/grep.js b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/grep.js
new file mode 100644
index 0000000..00c7d6a
--- /dev/null
+++ b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/grep.js
@@ -0,0 +1,52 @@
+var common = require('./common');
+var fs = require('fs');
+
+//@
+//@ ### grep([options ,] regex_filter, file [, file ...])
+//@ ### grep([options ,] regex_filter, file_array)
+//@ Available options:
+//@
+//@ + `-v`: Inverse the sense of the regex and print the lines not matching the criteria.
+//@
+//@ Examples:
+//@
+//@ ```javascript
+//@ grep('-v', 'GLOBAL_VARIABLE', '*.js');
+//@ grep('GLOBAL_VARIABLE', '*.js');
+//@ ```
+//@
+//@ Reads input string from given files and returns a string containing all lines of the
+//@ file that match the given `regex_filter`. Wildcard `*` accepted.
+function _grep(options, regex, files) {
+  options = common.parseOptions(options, {
+    'v': 'inverse'
+  });
+
+  if (!files)
+    common.error('no paths given');
+
+  if (typeof files === 'string')
+    files = [].slice.call(arguments, 2);
+  // if it's array leave it as it is
+
+  files = common.expand(files);
+
+  var grep = '';
+  files.forEach(function(file) {
+    if (!fs.existsSync(file)) {
+      common.error('no such file or directory: ' + file, true);
+      return;
+    }
+
+    var contents = fs.readFileSync(file, 'utf8'),
+        lines = contents.split(/\r*\n/);
+    lines.forEach(function(line) {
+      var matched = line.match(regex);
+      if ((options.inverse && !matched) || (!options.inverse && matched))
+        grep += line + '\n';
+    });
+  });
+
+  return common.ShellString(grep);
+}
+module.exports = _grep;

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/e1b4a533/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/ls.js
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/ls.js b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/ls.js
new file mode 100644
index 0000000..3345db4
--- /dev/null
+++ b/bin/node_modules/ios-sim/node_modules/simctl/node_modules/shelljs/src/ls.js
@@ -0,0 +1,126 @@
+var path = require('path');
+var fs = require('fs');
+var common = require('./common');
+var _cd = require('./cd');
+var _pwd = require('./pwd');
+
+//@
+//@ ### ls([options ,] path [,path ...])
+//@ ### ls([options ,] path_array)
+//@ Available options:
+//@
+//@ + `-R`: recursive
+//@ + `-A`: all files (include files beginning with `.`, except for `.` and `..`)
+//@
+//@ Examples:
+//@
+//@ ```javascript
+//@ ls('projs/*.js');
+//@ ls('-R', '/users/me', '/tmp');
+//@ ls('-R', ['/users/me', '/tmp']); // same as above
+//@ ```
+//@
+//@ Returns array of files in the given path, or in current directory if no path provided.
+function _ls(options, paths) {
+  options = common.parseOptions(options, {
+    'R': 'recursive',
+    'A': 'all',
+    'a': 'all_deprecated'
+  });
+
+  if (options.all_deprecated) {
+    // We won't support the -a option as it's hard to image why it's useful
+    // (it includes '.' and '..' in addition to '.*' files)
+    // For backwards compatibility we'll dump a deprecated message and proceed as before
+    common.log('ls: Option -a is deprecated. Use -A instead');
+    options.all = true;
+  }
+
+  if (!paths)
+    paths = ['.'];
+  else if (typeof paths === 'object')
+    paths = paths; // assume array
+  else if (typeof paths === 'string')
+    paths = [].slice.call(arguments, 1);
+
+  var list = [];
+
+  // Conditionally pushes file to list - returns true if pushed, false otherwise
+  // (e.g. prevents hidden files to be included unless explicitly told so)
+  function pushFile(file, query) {
+    // hidden file?
+    if (path.basename(file)[0] === '.') {
+      // not explicitly asking for hidden files?
+      if (!options.all && !(path.basename(query)[0] === '.' && path.basename(query).length > 1))
+        return false;
+    }
+
+    if (common.platform === 'win')
+      file = file.replace(/\\/g, '/');
+
+    list.push(file);
+    return true;
+  }
+
+  paths.forEach(function(p) {
+    if (fs.existsSync(p)) {
+      var stats = fs.statSync(p);
+      // Simple file?
+      if (stats.isFile()) {
+        pushFile(p, p);
+        return; // continue
+      }
+
+      // Simple dir?
+      if (stats.isDirectory()) {
+        // Iterate over p contents
+        fs.readdirSync(p).forEach(function(file) {
+          if (!pushFile(file, p))
+            return;
+
+          // Recursive?
+          if (options.recursive) {
+            var oldDir = _pwd();
+            _cd('', p);
+            if (fs.statSync(file).isDirectory())
+              list = list.concat(_ls('-R'+(options.all?'A':''), file+'/*'));
+            _cd('', oldDir);
+          }
+        });
+        return; // continue
+      }
+    }
+
+    // p does not exist - possible wildcard present
+
+    var basename = path.basename(p);
+    var dirname = path.dirname(p);
+    // Wildcard present on an existing dir? (e.g. '/tmp/*.js')
+    if (basename.search(/\*/) > -1 && fs.existsSync(dirname) && fs.statSync(dirname).isDirectory) {
+      // Escape special regular expression chars
+      var regexp = basename.replace(/(\^|\$|\(|\)|<|>|\[|\]|\{|\}|\.|\+|\?)/g, '\\$1');
+      // Translates wildcard into regex
+      regexp = '^' + regexp.replace(/\*/g, '.*') + '$';
+      // Iterate over directory contents
+      fs.readdirSync(dirname).forEach(function(file) {
+        if (file.match(new RegExp(regexp))) {
+          if (!pushFile(path.normalize(dirname+'/'+file), basename))
+            return;
+
+          // Recursive?
+          if (options.recursive) {
+            var pp = dirname + '/' + file;
+            if (fs.lstatSync(pp).isDirectory())
+              list = list.concat(_ls('-R'+(options.all?'A':''), pp+'/*'));
+          } // recursive
+        } // if file matches
+      }); // forEach
+      return;
+    }
+
+    common.error('no such file or directory: ' + p, true);
+  });
+
+  return list;
+}
+module.exports = _ls;


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


[3/3] ios commit: CB-9328 Use ios-sim as a node module, not a CLI utility

Posted by ma...@apache.org.
CB-9328 Use ios-sim as a node module, not a CLI utility


Project: http://git-wip-us.apache.org/repos/asf/cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-ios/commit/e1b4a533
Tree: http://git-wip-us.apache.org/repos/asf/cordova-ios/tree/e1b4a533
Diff: http://git-wip-us.apache.org/repos/asf/cordova-ios/diff/e1b4a533

Branch: refs/heads/CB-9328
Commit: e1b4a533a3a234e0df22a139353905fd21ac020b
Parents: 47154c3
Author: Simon MacDonald <si...@gmail.com>
Authored: Wed Sep 9 00:00:09 2015 -0400
Committer: Simon MacDonald <si...@gmail.com>
Committed: Mon Sep 14 13:18:16 2015 -0400

----------------------------------------------------------------------
 bin/node_modules/.bin/ios-sim                   |   1 +
 bin/node_modules/ios-sim/.npmignore             |   7 +
 bin/node_modules/ios-sim/CONTRIBUTING.md        |  29 +
 bin/node_modules/ios-sim/LICENSE                |  21 +
 bin/node_modules/ios-sim/README.md              |  97 ++++
 bin/node_modules/ios-sim/bin/ios-sim            |  42 ++
 bin/node_modules/ios-sim/bin/ios-sim.cmd        |   1 +
 bin/node_modules/ios-sim/doc/help.txt           |  33 ++
 bin/node_modules/ios-sim/ios-sim.js             |   4 +
 bin/node_modules/ios-sim/node_modules/.bin/nopt |   1 +
 .../node_modules/bplist-parser/.npmignore       |   8 +
 .../node_modules/bplist-parser/README.md        |  47 ++
 .../node_modules/bplist-parser/bplistParser.js  | 332 +++++++++++
 .../node_modules/bplist-parser/package.json     |  52 ++
 .../bplist-parser/test/airplay.bplist           | Bin 0 -> 341 bytes
 .../bplist-parser/test/iTunes-small.bplist      | Bin 0 -> 24433 bytes
 .../bplist-parser/test/parseTest.js             | 120 ++++
 .../bplist-parser/test/sample1.bplist           | Bin 0 -> 605 bytes
 .../bplist-parser/test/sample2.bplist           | Bin 0 -> 384 bytes
 .../node_modules/bplist-parser/test/uid.bplist  | Bin 0 -> 365 bytes
 .../bplist-parser/test/utf16.bplist             | Bin 0 -> 1273 bytes
 .../ios-sim/node_modules/nopt/.npmignore        |   0
 .../ios-sim/node_modules/nopt/LICENSE           |  23 +
 .../ios-sim/node_modules/nopt/README.md         | 206 +++++++
 .../ios-sim/node_modules/nopt/bin/nopt.js       |  44 ++
 .../node_modules/nopt/examples/my-program.js    |  30 +
 .../ios-sim/node_modules/nopt/lib/nopt.js       | 530 ++++++++++++++++++
 .../nopt/node_modules/abbrev/.npmignore         |   4 +
 .../nopt/node_modules/abbrev/.travis.yml        |   5 +
 .../nopt/node_modules/abbrev/CONTRIBUTING.md    |   3 +
 .../nopt/node_modules/abbrev/LICENSE            |  15 +
 .../nopt/node_modules/abbrev/README.md          |  23 +
 .../nopt/node_modules/abbrev/abbrev.js          |  62 +++
 .../nopt/node_modules/abbrev/package.json       |  48 ++
 .../nopt/node_modules/abbrev/test.js            |  47 ++
 .../ios-sim/node_modules/nopt/package.json      |  60 ++
 .../ios-sim/node_modules/simctl/.npmignore      |   1 +
 .../ios-sim/node_modules/simctl/LICENSE         |  22 +
 .../ios-sim/node_modules/simctl/README.md       |   3 +
 .../simctl/lib/simctl-extensions.js             |  69 +++
 .../simctl/lib/simctl-list-parser.js            | 198 +++++++
 .../node_modules/simctl/node_modules/.bin/shjs  |   1 +
 .../node_modules/shelljs/.documentup.json       |   6 +
 .../simctl/node_modules/shelljs/.jshintrc       |   7 +
 .../simctl/node_modules/shelljs/.npmignore      |   2 +
 .../simctl/node_modules/shelljs/.travis.yml     |   5 +
 .../simctl/node_modules/shelljs/LICENSE         |  26 +
 .../simctl/node_modules/shelljs/README.md       | 552 +++++++++++++++++++
 .../simctl/node_modules/shelljs/bin/shjs        |  51 ++
 .../simctl/node_modules/shelljs/global.js       |   3 +
 .../simctl/node_modules/shelljs/make.js         |  47 ++
 .../simctl/node_modules/shelljs/package.json    |  61 ++
 .../shelljs/scripts/generate-docs.js            |  21 +
 .../node_modules/shelljs/scripts/run-tests.js   |  50 ++
 .../simctl/node_modules/shelljs/shell.js        | 153 +++++
 .../simctl/node_modules/shelljs/src/cat.js      |  43 ++
 .../simctl/node_modules/shelljs/src/cd.js       |  19 +
 .../simctl/node_modules/shelljs/src/chmod.js    | 208 +++++++
 .../simctl/node_modules/shelljs/src/common.js   | 189 +++++++
 .../simctl/node_modules/shelljs/src/cp.js       | 200 +++++++
 .../simctl/node_modules/shelljs/src/dirs.js     | 191 +++++++
 .../simctl/node_modules/shelljs/src/echo.js     |  20 +
 .../simctl/node_modules/shelljs/src/error.js    |  10 +
 .../simctl/node_modules/shelljs/src/exec.js     | 181 ++++++
 .../simctl/node_modules/shelljs/src/find.js     |  51 ++
 .../simctl/node_modules/shelljs/src/grep.js     |  52 ++
 .../simctl/node_modules/shelljs/src/ls.js       | 126 +++++
 .../simctl/node_modules/shelljs/src/mkdir.js    |  68 +++
 .../simctl/node_modules/shelljs/src/mv.js       |  80 +++
 .../simctl/node_modules/shelljs/src/popd.js     |   1 +
 .../simctl/node_modules/shelljs/src/pushd.js    |   1 +
 .../simctl/node_modules/shelljs/src/pwd.js      |  11 +
 .../simctl/node_modules/shelljs/src/rm.js       | 145 +++++
 .../simctl/node_modules/shelljs/src/sed.js      |  43 ++
 .../simctl/node_modules/shelljs/src/tempdir.js  |  56 ++
 .../simctl/node_modules/shelljs/src/test.js     |  85 +++
 .../simctl/node_modules/shelljs/src/to.js       |  29 +
 .../simctl/node_modules/shelljs/src/toEnd.js    |  29 +
 .../simctl/node_modules/shelljs/src/which.js    |  79 +++
 .../simctl/node_modules/tail/README.md          |  72 +++
 .../simctl/node_modules/tail/package.json       |  57 ++
 .../simctl/node_modules/tail/tail.js            | 147 +++++
 .../ios-sim/node_modules/simctl/package.json    |  49 ++
 .../ios-sim/node_modules/simctl/simctl.js       | 195 +++++++
 bin/node_modules/ios-sim/package.json           |  45 ++
 .../ios-sim/resources/buildbox/build.sh         |   3 +
 bin/node_modules/ios-sim/src/cli.js             | 102 ++++
 bin/node_modules/ios-sim/src/commands.js        |  81 +++
 bin/node_modules/ios-sim/src/help.js            |  41 ++
 bin/node_modules/ios-sim/src/lib.js             | 382 +++++++++++++
 .../scripts/cordova/lib/list-emulator-images    |  10 +-
 bin/templates/scripts/cordova/lib/run.js        |  22 +-
 92 files changed, 6275 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/e1b4a533/bin/node_modules/.bin/ios-sim
----------------------------------------------------------------------
diff --git a/bin/node_modules/.bin/ios-sim b/bin/node_modules/.bin/ios-sim
new file mode 120000
index 0000000..c435a8c
--- /dev/null
+++ b/bin/node_modules/.bin/ios-sim
@@ -0,0 +1 @@
+../ios-sim/bin/ios-sim
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/e1b4a533/bin/node_modules/ios-sim/.npmignore
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/.npmignore b/bin/node_modules/ios-sim/.npmignore
new file mode 100644
index 0000000..71ffef6
--- /dev/null
+++ b/bin/node_modules/ios-sim/.npmignore
@@ -0,0 +1,7 @@
+node_modules
+build
+*.swp
+.DS_Store
+*.xcworkspace
+xcuserdata
+node_modules

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/e1b4a533/bin/node_modules/ios-sim/CONTRIBUTING.md
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/CONTRIBUTING.md b/bin/node_modules/ios-sim/CONTRIBUTING.md
new file mode 100644
index 0000000..b132d71
--- /dev/null
+++ b/bin/node_modules/ios-sim/CONTRIBUTING.md
@@ -0,0 +1,29 @@
+## Contributing to ios-sim
+
+Github url: 
+
+        https://github.com/phonegap/ios-sim
+
+Git clone url: 
+
+        https://github.com/phonegap/ios-sim.git
+
+## Filing an issue
+
+Please run the commands below in your Terminal.app and include it in the issue:
+
+```
+1. sw_vers -productVersion
+2. ios-sim --version
+3. xcodebuild -version
+4. xcode-select --print-path
+5. gcc --version
+```
+Also include **command line arguments** you used for ios-sim.
+
+
+## Sending a Pull Request
+
+Please **create a topic branch** for your issue before submitting your pull request. You will be asked to re-submit if your pull request contains unrelated commits.
+
+Please elaborate regarding the problem the pull request is supposed to solve, and perhaps also link to any relevant issues the pull request is trying to fix.
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/e1b4a533/bin/node_modules/ios-sim/LICENSE
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/LICENSE b/bin/node_modules/ios-sim/LICENSE
new file mode 100644
index 0000000..f5768b4
--- /dev/null
+++ b/bin/node_modules/ios-sim/LICENSE
@@ -0,0 +1,21 @@
+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.
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/e1b4a533/bin/node_modules/ios-sim/README.md
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/README.md b/bin/node_modules/ios-sim/README.md
new file mode 100644
index 0000000..addf3c8
--- /dev/null
+++ b/bin/node_modules/ios-sim/README.md
@@ -0,0 +1,97 @@
+ios-sim
+=======
+
+Supports Xcode 6 only since version 3.x.
+
+The 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.
+
+Features
+--------
+
+* 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.
+
+See the `--help` option for more info.
+
+The unimplemented options below are in the [backlog](https://github.com/phonegap/ios-sim/milestones/ios-sim%204.2.0)
+
+Usage
+-----
+
+```
+
+    Usage: ios-sim <command> <options> [--args ...]
+        
+    Commands:
+      showsdks                        List the available iOS SDK versions
+      showdevicetypes                 List the available device types
+      launch <application path>       Launch the application at the specified path on the iOS Simulator
+      start                           Launch iOS Simulator without an app
+      install <application path>      Install the application at the specified path on the iOS Simulator without launching the app
+
+    Options:
+      --version                       Print the version of ios-sim
+      --help                          Show this help text
+      --exit                          Exit after startup
+      --log <log file path>           The path where log of the app running in the Simulator will be redirected to
+      --devicetypeid <device type>    The id of the device type that should be simulated (Xcode6+). Use 'showdevicetypes' to list devices.
+                                      e.g "com.apple.CoreSimulator.SimDeviceType.Resizable-iPhone6, 8.0"
+                                  
+    Removed in version 4.x:
+      --stdout <stdout file path>     The path where stdout of the simulator will be redirected to (defaults to stdout of ios-sim)
+      --stderr <stderr file path>     The path where stderr of the simulator will be redirected to (defaults to stderr of ios-sim)
+      --sdk <sdkversion>              The iOS SDK version to run the application on (defaults to the latest)
+      --family <device family>        The device type that should be simulated (defaults to `iphone')
+      --retina                        Start a retina device
+      --tall                          In combination with --retina flag, start the tall version of the retina device (e.g. iPhone 5 (4-inch))
+      --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))
+                                    
+    Unimplemented in this version:
+      --verbose                       Set the output level to verbose
+      --timeout <seconds>             The timeout time to wait for a response from the Simulator. Default value: 30 seconds
+      --args <...>                    All following arguments will be passed on to the application
+      --env <environment file path>   A plist file containing environment key-value pairs that should be set
+      --setenv NAME=VALUE             Set an environment variable
+                                  
+```
+
+Installation
+------------
+
+Choose one of the following installation methods.
+
+### Node JS
+
+Install using node.js (at least 0.10.20):
+
+    $ npm install ios-sim -g
+
+### Zip
+
+Download a zip file:
+
+    $ curl -L https://github.com/phonegap/ios-sim/archive/master.zip -o ios-sim.zip
+    $ unzip ios-sim.zip
+
+### Git
+
+Download using git clone:
+
+    $ git clone git://github.com/phonegap/ios-sim.git
+
+Troubleshooting
+---------------
+
+Make sure you enable Developer Mode on your machine:
+
+    $ DevToolsSecurity -enable
+
+Make sure multiple instances of launchd_sim are not running:
+
+    $ killall launchd_sim
+
+License
+-------
+
+This project is available under the MIT license. See [LICENSE][license].
+
+[license]: https://github.com/phonegap/ios-sim/blob/master/LICENSE

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/e1b4a533/bin/node_modules/ios-sim/bin/ios-sim
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/bin/ios-sim b/bin/node_modules/ios-sim/bin/ios-sim
new file mode 100755
index 0000000..bab9b88
--- /dev/null
+++ b/bin/node_modules/ios-sim/bin/ios-sim
@@ -0,0 +1,42 @@
+#!/usr/bin/env node
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+//  KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+// Set this to 1 to enable timestamp collection via addTs().
+if (0) {
+    var ts = [];
+    addTs = function(name) {
+        ts.push([name, new Date]);
+    }
+    process.on('exit', function() {
+        for (var i = 0; i < ts.length - 1; ++i) {
+          var e1 = ts[i];
+          var e2 = ts[i+1];
+          console.log(e1[0] + ' -> ' + e2[0] + ' = ' + (e2[1] - e1[1]));
+        }
+        console.log('total: ' + (ts[ts.length-1][1] - ts[0][1]));
+    });
+} else {
+    addTs = function() {};
+}
+
+addTs('start');
+var cli = require('../src/cli');
+cli(process.argv);
+addTs('end');

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/e1b4a533/bin/node_modules/ios-sim/bin/ios-sim.cmd
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/bin/ios-sim.cmd b/bin/node_modules/ios-sim/bin/ios-sim.cmd
new file mode 100755
index 0000000..18927ed
--- /dev/null
+++ b/bin/node_modules/ios-sim/bin/ios-sim.cmd
@@ -0,0 +1 @@
+@node "%~dpn0" %*

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/e1b4a533/bin/node_modules/ios-sim/doc/help.txt
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/doc/help.txt b/bin/node_modules/ios-sim/doc/help.txt
new file mode 100644
index 0000000..925a0f8
--- /dev/null
+++ b/bin/node_modules/ios-sim/doc/help.txt
@@ -0,0 +1,33 @@
+Usage: ios-sim <command> <options> [--args ...]
+
+Commands:
+  showsdks                        List the available iOS SDK versions
+  showdevicetypes                 List the available device types
+  launch <application path>       Launch the application at the specified path on the iOS Simulator
+  start                           Launch iOS Simulator without an app
+  install <application path>      Install the application at the specified path on the iOS Simulator without launching the app
+
+Options:
+  --version                       Print the version of ios-sim
+  --help                          Show this help text
+  --exit                          Exit after startup
+  --log <log file path>           The path where log of the app running in the Simulator will be redirected to
+  --devicetypeid <device type>    The id of the device type that should be simulated (Xcode6+). Use 'showdevicetypes' to list devices.
+                                  e.g "com.apple.CoreSimulator.SimDeviceType.Resizable-iPhone6, 8.0"
+                                  
+Removed in version 4.x:
+  --stdout <stdout file path>     The path where stdout of the simulator will be redirected to (defaults to stdout of ios-sim)
+  --stderr <stderr file path>     The path where stderr of the simulator will be redirected to (defaults to stderr of ios-sim)
+  --sdk <sdkversion>              The iOS SDK version to run the application on (defaults to the latest)
+  --family <device family>        The device type that should be simulated (defaults to `iphone')
+  --retina                        Start a retina device
+  --tall                          In combination with --retina flag, start the tall version of the retina device (e.g. iPhone 5 (4-inch))
+  --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))
+                                    
+Unimplemented in version 4.x:
+  --verbose                       Set the output level to verbose
+  --timeout <seconds>             The timeout time to wait for a response from the Simulator. Default value: 30 seconds
+  --args <...>                    All following arguments will be passed on to the application
+  --env <environment file path>   A plist file containing environment key-value pairs that should be set
+  --setenv NAME=VALUE             Set an environment variable
+                                  
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/e1b4a533/bin/node_modules/ios-sim/ios-sim.js
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/ios-sim.js b/bin/node_modules/ios-sim/ios-sim.js
new file mode 100644
index 0000000..4547126
--- /dev/null
+++ b/bin/node_modules/ios-sim/ios-sim.js
@@ -0,0 +1,4 @@
+var iossim = require('./src/lib.js');
+iossim.init();
+
+exports = module.exports = iossim;

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/e1b4a533/bin/node_modules/ios-sim/node_modules/.bin/nopt
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/node_modules/.bin/nopt b/bin/node_modules/ios-sim/node_modules/.bin/nopt
new file mode 120000
index 0000000..6b6566e
--- /dev/null
+++ b/bin/node_modules/ios-sim/node_modules/.bin/nopt
@@ -0,0 +1 @@
+../nopt/bin/nopt.js
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/e1b4a533/bin/node_modules/ios-sim/node_modules/bplist-parser/.npmignore
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/node_modules/bplist-parser/.npmignore b/bin/node_modules/ios-sim/node_modules/bplist-parser/.npmignore
new file mode 100644
index 0000000..a9b46ea
--- /dev/null
+++ b/bin/node_modules/ios-sim/node_modules/bplist-parser/.npmignore
@@ -0,0 +1,8 @@
+/build/*
+node_modules
+*.node
+*.sh
+*.swp
+.lock*
+npm-debug.log
+.idea

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/e1b4a533/bin/node_modules/ios-sim/node_modules/bplist-parser/README.md
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/node_modules/bplist-parser/README.md b/bin/node_modules/ios-sim/node_modules/bplist-parser/README.md
new file mode 100644
index 0000000..37e5e1c
--- /dev/null
+++ b/bin/node_modules/ios-sim/node_modules/bplist-parser/README.md
@@ -0,0 +1,47 @@
+bplist-parser
+=============
+
+Binary Mac OS X Plist (property list) parser.
+
+## Installation
+
+```bash
+$ npm install bplist-parser
+```
+
+## Quick Examples
+
+```javascript
+var bplist = require('bplist-parser');
+
+bplist.parseFile('myPlist.bplist', function(err, obj) {
+  if (err) throw err;
+
+  console.log(JSON.stringify(obj));
+});
+```
+
+## License
+
+(The MIT License)
+
+Copyright (c) 2012 Near Infinity Corporation
+
+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.

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/e1b4a533/bin/node_modules/ios-sim/node_modules/bplist-parser/bplistParser.js
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/node_modules/bplist-parser/bplistParser.js b/bin/node_modules/ios-sim/node_modules/bplist-parser/bplistParser.js
new file mode 100644
index 0000000..e818454
--- /dev/null
+++ b/bin/node_modules/ios-sim/node_modules/bplist-parser/bplistParser.js
@@ -0,0 +1,332 @@
+'use strict';
+
+// adapted from http://code.google.com/p/plist/source/browse/trunk/src/com/dd/plist/BinaryPropertyListParser.java
+
+var fs = require('fs');
+var debug = false;
+
+exports.maxObjectSize = 100 * 1000 * 1000; // 100Meg
+exports.maxObjectCount = 32768;
+
+// EPOCH = new SimpleDateFormat("yyyy MM dd zzz").parse("2001 01 01 GMT").getTime();
+// ...but that's annoying in a static initializer because it can throw exceptions, ick.
+// So we just hardcode the correct value.
+var EPOCH = 978307200000;
+
+var parseFile = exports.parseFile = function (fileNameOrBuffer, callback) {
+  function tryParseBuffer(buffer) {
+    var err = null;
+    var result;
+    try {
+      result = parseBuffer(buffer);
+    } catch (ex) {
+      err = ex;
+    }
+    callback(err, result);
+  }
+
+  if (Buffer.isBuffer(fileNameOrBuffer)) {
+    return tryParseBuffer(fileNameOrBuffer);
+  } else {
+    fs.readFile(fileNameOrBuffer, function (err, data) {
+      if (err) { return callback(err); }
+      tryParseBuffer(data);
+    });
+  }
+};
+
+var parseBuffer = exports.parseBuffer = function (buffer) {
+  var result = {};
+
+  // check header
+  var header = buffer.slice(0, 'bplist'.length).toString('utf8');
+  if (header !== 'bplist') {
+    throw new Error("Invalid binary plist. Expected 'bplist' at offset 0.");
+  }
+
+  // Handle trailer, last 32 bytes of the file
+  var trailer = buffer.slice(buffer.length - 32, buffer.length);
+  // 6 null bytes (index 0 to 5)
+  var offsetSize = trailer.readUInt8(6);
+  if (debug) {
+    console.log("offsetSize: " + offsetSize);
+  }
+  var objectRefSize = trailer.readUInt8(7);
+  if (debug) {
+    console.log("objectRefSize: " + objectRefSize);
+  }
+  var numObjects = readUInt64BE(trailer, 8);
+  if (debug) {
+    console.log("numObjects: " + numObjects);
+  }
+  var topObject = readUInt64BE(trailer, 16);
+  if (debug) {
+    console.log("topObject: " + topObject);
+  }
+  var offsetTableOffset = readUInt64BE(trailer, 24);
+  if (debug) {
+    console.log("offsetTableOffset: " + offsetTableOffset);
+  }
+
+  if (numObjects > exports.maxObjectCount) {
+    throw new Error("maxObjectCount exceeded");
+  }
+
+  // Handle offset table
+  var offsetTable = [];
+
+  for (var i = 0; i < numObjects; i++) {
+    var offsetBytes = buffer.slice(offsetTableOffset + i * offsetSize, offsetTableOffset + (i + 1) * offsetSize);
+    offsetTable[i] = readUInt(offsetBytes, 0);
+    if (debug) {
+      console.log("Offset for Object #" + i + " is " + offsetTable[i] + " [" + offsetTable[i].toString(16) + "]");
+    }
+  }
+
+  // Parses an object inside the currently parsed binary property list.
+  // For the format specification check
+  // <a href="http://www.opensource.apple.com/source/CF/CF-635/CFBinaryPList.c">
+  // Apple's binary property list parser implementation</a>.
+  function parseObject(tableOffset) {
+    var offset = offsetTable[tableOffset];
+    var type = buffer[offset];
+    var objType = (type & 0xF0) >> 4; //First  4 bits
+    var objInfo = (type & 0x0F);      //Second 4 bits
+    switch (objType) {
+    case 0x0:
+      return parseSimple();
+    case 0x1:
+      return parseInteger();
+    case 0x8:
+      return parseUID();
+    case 0x2:
+      return parseReal();
+    case 0x3:
+      return parseDate();
+    case 0x4:
+      return parseData();
+    case 0x5: // ASCII
+      return parsePlistString();
+    case 0x6: // UTF-16
+      return parsePlistString(true);
+    case 0xA:
+      return parseArray();
+    case 0xD:
+      return parseDictionary();
+    default:
+      throw new Error("Unhandled type 0x" + objType.toString(16));
+    }
+
+    function parseSimple() {
+      //Simple
+      switch (objInfo) {
+      case 0x0: // null
+        return null;
+      case 0x8: // false
+        return false;
+      case 0x9: // true
+        return true;
+      case 0xF: // filler byte
+        return null;
+      default:
+        throw new Error("Unhandled simple type 0x" + objType.toString(16));
+      }
+    }
+
+    function parseInteger() {
+      var length = Math.pow(2, objInfo);
+      if (length < exports.maxObjectSize) {
+        return readUInt(buffer.slice(offset + 1, offset + 1 + length));
+      } else {
+        throw new Error("To little heap space available! Wanted to read " + length + " bytes, but only " + exports.maxObjectSize + " are available.");
+      }
+    }
+
+    function parseUID() {
+      var length = objInfo + 1;
+      if (length < exports.maxObjectSize) {
+        return readUInt(buffer.slice(offset + 1, offset + 1 + length));
+      } else {
+        throw new Error("To little heap space available! Wanted to read " + length + " bytes, but only " + exports.maxObjectSize + " are available.");
+      }
+    }
+
+    function parseReal() {
+      var length = Math.pow(2, objInfo);
+      if (length < exports.maxObjectSize) {
+        var realBuffer = buffer.slice(offset + 1, offset + 1 + length);
+        if (length === 4) {
+          return realBuffer.readFloatBE(0);
+        }
+        else if (length === 8) {
+          return realBuffer.readDoubleBE(0);
+        }
+      } else {
+        throw new Error("To little heap space available! Wanted to read " + length + " bytes, but only " + exports.maxObjectSize + " are available.");
+      }
+    }
+
+    function parseDate() {
+      if (objInfo != 0x3) {
+        console.error("Unknown date type :" + objInfo + ". Parsing anyway...");
+      }
+      var dateBuffer = buffer.slice(offset + 1, offset + 9);
+      return new Date(EPOCH + (1000 * dateBuffer.readDoubleBE(0)));
+    }
+
+    function parseData() {
+      var dataoffset = 1;
+      var length = objInfo;
+      if (objInfo == 0xF) {
+        var int_type = buffer[offset + 1];
+        var intType = (int_type & 0xF0) / 0x10;
+        if (intType != 0x1) {
+          console.error("0x4: UNEXPECTED LENGTH-INT TYPE! " + intType);
+        }
+        var intInfo = int_type & 0x0F;
+        var intLength = Math.pow(2, intInfo);
+        dataoffset = 2 + intLength;
+        if (intLength < 3) {
+          length = readUInt(buffer.slice(offset + 2, offset + 2 + intLength));
+        } else {
+          length = readUInt(buffer.slice(offset + 2, offset + 2 + intLength));
+        }
+      }
+      if (length < exports.maxObjectSize) {
+        return buffer.slice(offset + dataoffset, offset + dataoffset + length);
+      } else {
+        throw new Error("To little heap space available! Wanted to read " + length + " bytes, but only " + exports.maxObjectSize + " are available.");
+      }
+    }
+
+    function parsePlistString (isUtf16) {
+      isUtf16 = isUtf16 || 0;
+      var enc = "utf8";
+      var length = objInfo;
+      var stroffset = 1;
+      if (objInfo == 0xF) {
+        var int_type = buffer[offset + 1];
+        var intType = (int_type & 0xF0) / 0x10;
+        if (intType != 0x1) {
+          console.err("UNEXPECTED LENGTH-INT TYPE! " + intType);
+        }
+        var intInfo = int_type & 0x0F;
+        var intLength = Math.pow(2, intInfo);
+        var stroffset = 2 + intLength;
+        if (intLength < 3) {
+          length = readUInt(buffer.slice(offset + 2, offset + 2 + intLength));
+        } else {
+          length = readUInt(buffer.slice(offset + 2, offset + 2 + intLength));
+        }
+      }
+      // length is String length -> to get byte length multiply by 2, as 1 character takes 2 bytes in UTF-16
+      length *= (isUtf16 + 1);
+      if (length < exports.maxObjectSize) {
+        var plistString = buffer.slice(offset + stroffset, offset + stroffset + length);
+        if (isUtf16) {
+          plistString = swapBytes(plistString);
+          enc = "ucs2";
+        }
+        return plistString.toString(enc);
+      } else {
+        throw new Error("To little heap space available! Wanted to read " + length + " bytes, but only " + exports.maxObjectSize + " are available.");
+      }
+    }
+
+    function parseArray() {
+      var length = objInfo;
+      var arrayoffset = 1;
+      if (objInfo == 0xF) {
+        var int_type = buffer[offset + 1];
+        var intType = (int_type & 0xF0) / 0x10;
+        if (intType != 0x1) {
+          console.error("0xa: UNEXPECTED LENGTH-INT TYPE! " + intType);
+        }
+        var intInfo = int_type & 0x0F;
+        var intLength = Math.pow(2, intInfo);
+        arrayoffset = 2 + intLength;
+        if (intLength < 3) {
+          length = readUInt(buffer.slice(offset + 2, offset + 2 + intLength));
+        } else {
+          length = readUInt(buffer.slice(offset + 2, offset + 2 + intLength));
+        }
+      }
+      if (length * objectRefSize > exports.maxObjectSize) {
+        throw new Error("To little heap space available!");
+      }
+      var array = [];
+      for (var i = 0; i < length; i++) {
+        var objRef = readUInt(buffer.slice(offset + arrayoffset + i * objectRefSize, offset + arrayoffset + (i + 1) * objectRefSize));
+        array[i] = parseObject(objRef);
+      }
+      return array;
+    }
+
+    function parseDictionary() {
+      var length = objInfo;
+      var dictoffset = 1;
+      if (objInfo == 0xF) {
+        var int_type = buffer[offset + 1];
+        var intType = (int_type & 0xF0) / 0x10;
+        if (intType != 0x1) {
+          console.error("0xD: UNEXPECTED LENGTH-INT TYPE! " + intType);
+        }
+        var intInfo = int_type & 0x0F;
+        var intLength = Math.pow(2, intInfo);
+        dictoffset = 2 + intLength;
+        if (intLength < 3) {
+          length = readUInt(buffer.slice(offset + 2, offset + 2 + intLength));
+        } else {
+          length = readUInt(buffer.slice(offset + 2, offset + 2 + intLength));
+        }
+      }
+      if (length * 2 * objectRefSize > exports.maxObjectSize) {
+        throw new Error("To little heap space available!");
+      }
+      if (debug) {
+        console.log("Parsing dictionary #" + tableOffset);
+      }
+      var dict = {};
+      for (var i = 0; i < length; i++) {
+        var keyRef = readUInt(buffer.slice(offset + dictoffset + i * objectRefSize, offset + dictoffset + (i + 1) * objectRefSize));
+        var valRef = readUInt(buffer.slice(offset + dictoffset + (length * objectRefSize) + i * objectRefSize, offset + dictoffset + (length * objectRefSize) + (i + 1) * objectRefSize));
+        var key = parseObject(keyRef);
+        var val = parseObject(valRef);
+        if (debug) {
+          console.log("  DICT #" + tableOffset + ": Mapped " + key + " to " + val);
+        }
+        dict[key] = val;
+      }
+      return dict;
+    }
+  }
+
+  return [ parseObject(topObject) ];
+};
+
+function readUInt(buffer, start) {
+  start = start || 0;
+
+  var l = 0;
+  for (var i = start; i < buffer.length; i++) {
+    l <<= 8;
+    l |= buffer[i] & 0xFF;
+  }
+  return l;
+}
+
+// we're just going to toss the high order bits because javascript doesn't have 64-bit ints
+function readUInt64BE(buffer, start) {
+  var data = buffer.slice(start, start + 8);
+  return data.readUInt32BE(4, 8);
+}
+
+function swapBytes(buffer) {
+  var len = buffer.length;
+  for (var i = 0; i < len; i += 2) {
+    var a = buffer[i];
+    buffer[i] = buffer[i+1];
+    buffer[i+1] = a;
+  }
+  return buffer;
+}

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/e1b4a533/bin/node_modules/ios-sim/node_modules/bplist-parser/package.json
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/node_modules/bplist-parser/package.json b/bin/node_modules/ios-sim/node_modules/bplist-parser/package.json
new file mode 100644
index 0000000..f6987ae
--- /dev/null
+++ b/bin/node_modules/ios-sim/node_modules/bplist-parser/package.json
@@ -0,0 +1,52 @@
+{
+  "name": "bplist-parser",
+  "version": "0.0.6",
+  "description": "Binary plist parser.",
+  "main": "bplistParser.js",
+  "scripts": {
+    "test": "./node_modules/nodeunit/bin/nodeunit test"
+  },
+  "keywords": [
+    "bplist",
+    "plist",
+    "parser"
+  ],
+  "author": {
+    "name": "Joe Ferner",
+    "email": "joe.ferner@nearinfinity.com"
+  },
+  "license": "MIT",
+  "devDependencies": {
+    "nodeunit": "~0.7.4"
+  },
+  "repository": {
+    "type": "git",
+    "url": "git+https://github.com/nearinfinity/node-bplist-parser.git"
+  },
+  "gitHead": "a2230a5df3c7014ffbe5761bcb091ea2d061b47b",
+  "bugs": {
+    "url": "https://github.com/nearinfinity/node-bplist-parser/issues"
+  },
+  "homepage": "https://github.com/nearinfinity/node-bplist-parser",
+  "_id": "bplist-parser@0.0.6",
+  "_shasum": "38da3471817df9d44ab3892e27707bbbd75a11b9",
+  "_from": "bplist-parser@>=0.0.6 <0.0.7",
+  "_npmVersion": "1.4.14",
+  "_npmUser": {
+    "name": "joeferner",
+    "email": "joe@fernsroth.com"
+  },
+  "maintainers": [
+    {
+      "name": "joeferner",
+      "email": "joe@fernsroth.com"
+    }
+  ],
+  "dist": {
+    "shasum": "38da3471817df9d44ab3892e27707bbbd75a11b9",
+    "tarball": "http://registry.npmjs.org/bplist-parser/-/bplist-parser-0.0.6.tgz"
+  },
+  "directories": {},
+  "_resolved": "https://registry.npmjs.org/bplist-parser/-/bplist-parser-0.0.6.tgz",
+  "readme": "ERROR: No README data found!"
+}

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/e1b4a533/bin/node_modules/ios-sim/node_modules/bplist-parser/test/airplay.bplist
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/node_modules/bplist-parser/test/airplay.bplist b/bin/node_modules/ios-sim/node_modules/bplist-parser/test/airplay.bplist
new file mode 100644
index 0000000..931adea
Binary files /dev/null and b/bin/node_modules/ios-sim/node_modules/bplist-parser/test/airplay.bplist differ

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/e1b4a533/bin/node_modules/ios-sim/node_modules/bplist-parser/test/iTunes-small.bplist
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/node_modules/bplist-parser/test/iTunes-small.bplist b/bin/node_modules/ios-sim/node_modules/bplist-parser/test/iTunes-small.bplist
new file mode 100644
index 0000000..b7edb14
Binary files /dev/null and b/bin/node_modules/ios-sim/node_modules/bplist-parser/test/iTunes-small.bplist differ

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/e1b4a533/bin/node_modules/ios-sim/node_modules/bplist-parser/test/parseTest.js
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/node_modules/bplist-parser/test/parseTest.js b/bin/node_modules/ios-sim/node_modules/bplist-parser/test/parseTest.js
new file mode 100644
index 0000000..dcb6dd0
--- /dev/null
+++ b/bin/node_modules/ios-sim/node_modules/bplist-parser/test/parseTest.js
@@ -0,0 +1,120 @@
+'use strict';
+
+// tests are adapted from https://github.com/TooTallNate/node-plist
+
+var path = require('path');
+var nodeunit = require('nodeunit');
+var bplist = require('../');
+
+module.exports = {
+  'iTunes Small': function (test) {
+    var file = path.join(__dirname, "iTunes-small.bplist");
+    var startTime1 = new Date();
+
+    bplist.parseFile(file, function (err, dicts) {
+      if (err) {
+        throw err;
+      }
+
+      var endTime = new Date();
+      console.log('Parsed "' + file + '" in ' + (endTime - startTime1) + 'ms');
+      var dict = dicts[0];
+      test.equal(dict['Application Version'], "9.0.3");
+      test.equal(dict['Library Persistent ID'], "6F81D37F95101437");
+      test.done();
+    });
+  },
+
+  'sample1': function (test) {
+    var file = path.join(__dirname, "sample1.bplist");
+    var startTime = new Date();
+
+    bplist.parseFile(file, function (err, dicts) {
+      if (err) {
+        throw err;
+      }
+
+      var endTime = new Date();
+      console.log('Parsed "' + file + '" in ' + (endTime - startTime) + 'ms');
+      var dict = dicts[0];
+      test.equal(dict['CFBundleIdentifier'], 'com.apple.dictionary.MySample');
+      test.done();
+    });
+  },
+
+  'sample2': function (test) {
+    var file = path.join(__dirname, "sample2.bplist");
+    var startTime = new Date();
+
+    bplist.parseFile(file, function (err, dicts) {
+      if (err) {
+        throw err;
+      }
+
+      var endTime = new Date();
+      console.log('Parsed "' + file + '" in ' + (endTime - startTime) + 'ms');
+      var dict = dicts[0];
+      test.equal(dict['PopupMenu'][2]['Key'], "\n        #import <Cocoa/Cocoa.h>\n\n#import <MacRuby/MacRuby.h>\n\nint main(int argc, char *argv[])\n{\n  return macruby_main(\"rb_main.rb\", argc, argv);\n}\n");
+      test.done();
+    });
+  },
+
+  'airplay': function (test) {
+    var file = path.join(__dirname, "airplay.bplist");
+    var startTime = new Date();
+
+    bplist.parseFile(file, function (err, dicts) {
+      if (err) {
+        throw err;
+      }
+
+      var endTime = new Date();
+      console.log('Parsed "' + file + '" in ' + (endTime - startTime) + 'ms');
+
+      var dict = dicts[0];
+      test.equal(dict['duration'], 5555.0495000000001);
+      test.equal(dict['position'], 4.6269989039999997);
+      test.done();
+    });
+  },
+
+  'utf16': function (test) {
+    var file = path.join(__dirname, "utf16.bplist");
+    var startTime = new Date();
+
+    bplist.parseFile(file, function (err, dicts) {
+      if (err) {
+        throw err;
+      }
+
+      var endTime = new Date();
+      console.log('Parsed "' + file + '" in ' + (endTime - startTime) + 'ms');
+
+      var dict = dicts[0];
+      test.equal(dict['CFBundleName'], 'sellStuff');
+      test.equal(dict['CFBundleShortVersionString'], '2.6.1');
+      test.equal(dict['NSHumanReadableCopyright'], '©2008-2012, sellStuff, Inc.');
+      test.done();
+    });
+  },
+
+  'uid': function (test) {
+    var file = path.join(__dirname, "uid.bplist");
+    var startTime = new Date();
+
+    bplist.parseFile(file, function (err, dicts) {
+      if (err) {
+        throw err;
+      }
+
+      var endTime = new Date();
+      console.log('Parsed "' + file + '" in ' + (endTime - startTime) + 'ms');
+
+      var dict = dicts[0]; 
+      test.deepEqual(dict['$objects'][1]['NS.keys'], [2, 3, 4]);
+      test.deepEqual(dict['$objects'][1]['NS.objects'], [5, 6, 7]);
+      test.equal(dict['$top']['root'], 1);      
+      test.done();
+    });
+  }
+};

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/e1b4a533/bin/node_modules/ios-sim/node_modules/bplist-parser/test/sample1.bplist
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/node_modules/bplist-parser/test/sample1.bplist b/bin/node_modules/ios-sim/node_modules/bplist-parser/test/sample1.bplist
new file mode 100644
index 0000000..5b808ff
Binary files /dev/null and b/bin/node_modules/ios-sim/node_modules/bplist-parser/test/sample1.bplist differ

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/e1b4a533/bin/node_modules/ios-sim/node_modules/bplist-parser/test/sample2.bplist
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/node_modules/bplist-parser/test/sample2.bplist b/bin/node_modules/ios-sim/node_modules/bplist-parser/test/sample2.bplist
new file mode 100644
index 0000000..fc42979
Binary files /dev/null and b/bin/node_modules/ios-sim/node_modules/bplist-parser/test/sample2.bplist differ

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/e1b4a533/bin/node_modules/ios-sim/node_modules/bplist-parser/test/uid.bplist
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/node_modules/bplist-parser/test/uid.bplist b/bin/node_modules/ios-sim/node_modules/bplist-parser/test/uid.bplist
new file mode 100644
index 0000000..59f341e
Binary files /dev/null and b/bin/node_modules/ios-sim/node_modules/bplist-parser/test/uid.bplist differ

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/e1b4a533/bin/node_modules/ios-sim/node_modules/bplist-parser/test/utf16.bplist
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/node_modules/bplist-parser/test/utf16.bplist b/bin/node_modules/ios-sim/node_modules/bplist-parser/test/utf16.bplist
new file mode 100644
index 0000000..ba4bcfa
Binary files /dev/null and b/bin/node_modules/ios-sim/node_modules/bplist-parser/test/utf16.bplist differ

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/e1b4a533/bin/node_modules/ios-sim/node_modules/nopt/.npmignore
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/node_modules/nopt/.npmignore b/bin/node_modules/ios-sim/node_modules/nopt/.npmignore
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/e1b4a533/bin/node_modules/ios-sim/node_modules/nopt/LICENSE
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/node_modules/nopt/LICENSE b/bin/node_modules/ios-sim/node_modules/nopt/LICENSE
new file mode 100644
index 0000000..05a4010
--- /dev/null
+++ b/bin/node_modules/ios-sim/node_modules/nopt/LICENSE
@@ -0,0 +1,23 @@
+Copyright 2009, 2010, 2011 Isaac Z. Schlueter.
+All rights reserved.
+
+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.

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/e1b4a533/bin/node_modules/ios-sim/node_modules/nopt/README.md
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/node_modules/nopt/README.md b/bin/node_modules/ios-sim/node_modules/nopt/README.md
new file mode 100644
index 0000000..e364799
--- /dev/null
+++ b/bin/node_modules/ios-sim/node_modules/nopt/README.md
@@ -0,0 +1,206 @@
+If you want to write an option parser, and have it be good, there are
+two ways to do it.  The Right Way, and the Wrong Way.
+
+The Wrong Way is to sit down and write an option parser.  We've all done
+that.
+
+The Right Way is to write some complex configurable program with so many
+options that you go half-insane just trying to manage them all, and put
+it off with duct-tape solutions until you see exactly to the core of the
+problem, and finally snap and write an awesome option parser.
+
+If you want to write an option parser, don't write an option parser.
+Write a package manager, or a source control system, or a service
+restarter, or an operating system.  You probably won't end up with a
+good one of those, but if you don't give up, and you are relentless and
+diligent enough in your procrastination, you may just end up with a very
+nice option parser.
+
+## USAGE
+
+    // my-program.js
+    var nopt = require("nopt")
+      , Stream = require("stream").Stream
+      , path = require("path")
+      , knownOpts = { "foo" : [String, null]
+                    , "bar" : [Stream, Number]
+                    , "baz" : path
+                    , "bloo" : [ "big", "medium", "small" ]
+                    , "flag" : Boolean
+                    , "pick" : Boolean
+                    , "many" : [String, Array]
+                    }
+      , shortHands = { "foofoo" : ["--foo", "Mr. Foo"]
+                     , "b7" : ["--bar", "7"]
+                     , "m" : ["--bloo", "medium"]
+                     , "p" : ["--pick"]
+                     , "f" : ["--flag"]
+                     }
+                 // everything is optional.
+                 // knownOpts and shorthands default to {}
+                 // arg list defaults to process.argv
+                 // slice defaults to 2
+      , parsed = nopt(knownOpts, shortHands, process.argv, 2)
+    console.log(parsed)
+
+This would give you support for any of the following:
+
+```bash
+$ node my-program.js --foo "blerp" --no-flag
+{ "foo" : "blerp", "flag" : false }
+
+$ node my-program.js ---bar 7 --foo "Mr. Hand" --flag
+{ bar: 7, foo: "Mr. Hand", flag: true }
+
+$ node my-program.js --foo "blerp" -f -----p
+{ foo: "blerp", flag: true, pick: true }
+
+$ node my-program.js -fp --foofoo
+{ foo: "Mr. Foo", flag: true, pick: true }
+
+$ node my-program.js --foofoo -- -fp  # -- stops the flag parsing.
+{ foo: "Mr. Foo", argv: { remain: ["-fp"] } }
+
+$ node my-program.js --blatzk 1000 -fp # unknown opts are ok.
+{ blatzk: 1000, flag: true, pick: true }
+
+$ node my-program.js --blatzk true -fp # but they need a value
+{ blatzk: true, flag: true, pick: true }
+
+$ node my-program.js --no-blatzk -fp # unless they start with "no-"
+{ blatzk: false, flag: true, pick: true }
+
+$ node my-program.js --baz b/a/z # known paths are resolved.
+{ baz: "/Users/isaacs/b/a/z" }
+
+# if Array is one of the types, then it can take many
+# values, and will always be an array.  The other types provided
+# specify what types are allowed in the list.
+
+$ node my-program.js --many 1 --many null --many foo
+{ many: ["1", "null", "foo"] }
+
+$ node my-program.js --many foo
+{ many: ["foo"] }
+```
+
+Read the tests at the bottom of `lib/nopt.js` for more examples of
+what this puppy can do.
+
+## Types
+
+The following types are supported, and defined on `nopt.typeDefs`
+
+* String: A normal string.  No parsing is done.
+* path: A file system path.  Gets resolved against cwd if not absolute.
+* Number: Must be numeric.
+* url: A url.  If it doesn't parse, it isn't accepted.
+* Boolean: Must be either `true` or `false`.  If an option is a boolean,
+  then it does not need a value, and its presence will imply `true` as
+  the value.  To negate boolean flags, do `--no-whatever` or `--whatever
+  false`
+* NaN: Means that the option is strictly not allowed.  Any value will
+  fail.
+* Stream: An object matching the "Stream" class in node.  Valuable
+  for use when validating programmatically.  (npm uses this to let you
+  supply any WriteStream on the `outfd` and `logfd` config options.)
+* Array: If `Array` is specified as one of the types, then the value
+  will be parsed as a list of options.  This means that multiple values
+  can be specified, and that the value will always be an array.
+
+If a type is an array of values not on this list, then those are
+considered valid values.  For instance, in the example above, the
+`--bloo` option can only be one of `"big"`, `"medium"`, or `"small"`,
+and any other value will be rejected.
+
+When parsing unknown fields, `"true"`, `"false"`, and `"null"` will be
+interpreted as their JavaScript equivalents, and numeric values will be
+interpreted as a number.
+
+You can also mix types and values, or multiple types, in a list.  For
+instance `{ blah: [Number, null] }` would allow a value to be set to
+either a Number or null.
+
+To define a new type, add it to `nopt.typeDefs`.  Each item in that
+hash is an object with a `type` member and a `validate` method.  The
+`type` member is an object that matches what goes in the type list.  The
+`validate` method is a function that gets called with `validate(data,
+key, val)`.  Validate methods should assign `data[key]` to the valid
+value of `val` if it can be handled properly, or return boolean
+`false` if it cannot.
+
+You can also call `nopt.clean(data, types, typeDefs)` to clean up a
+config object and remove its invalid properties.
+
+## Error Handling
+
+By default, nopt outputs a warning to standard error when invalid
+options are found.  You can change this behavior by assigning a method
+to `nopt.invalidHandler`.  This method will be called with
+the offending `nopt.invalidHandler(key, val, types)`.
+
+If no `nopt.invalidHandler` is assigned, then it will console.error
+its whining.  If it is assigned to boolean `false` then the warning is
+suppressed.
+
+## Abbreviations
+
+Yes, they are supported.  If you define options like this:
+
+```javascript
+{ "foolhardyelephants" : Boolean
+, "pileofmonkeys" : Boolean }
+```
+
+Then this will work:
+
+```bash
+node program.js --foolhar --pil
+node program.js --no-f --pileofmon
+# etc.
+```
+
+## Shorthands
+
+Shorthands are a hash of shorter option names to a snippet of args that
+they expand to.
+
+If multiple one-character shorthands are all combined, and the
+combination does not unambiguously match any other option or shorthand,
+then they will be broken up into their constituent parts.  For example:
+
+```json
+{ "s" : ["--loglevel", "silent"]
+, "g" : "--global"
+, "f" : "--force"
+, "p" : "--parseable"
+, "l" : "--long"
+}
+```
+
+```bash
+npm ls -sgflp
+# just like doing this:
+npm ls --loglevel silent --global --force --long --parseable
+```
+
+## The Rest of the args
+
+The config object returned by nopt is given a special member called
+`argv`, which is an object with the following fields:
+
+* `remain`: The remaining args after all the parsing has occurred.
+* `original`: The args as they originally appeared.
+* `cooked`: The args after flags and shorthands are expanded.
+
+## Slicing
+
+Node programs are called with more or less the exact argv as it appears
+in C land, after the v8 and node-specific options have been plucked off.
+As such, `argv[0]` is always `node` and `argv[1]` is always the
+JavaScript program being run.
+
+That's usually not very useful to you.  So they're sliced off by
+default.  If you want them, then you can pass in `0` as the last
+argument, or any other number that you'd like to slice off the start of
+the list.

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/e1b4a533/bin/node_modules/ios-sim/node_modules/nopt/bin/nopt.js
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/node_modules/nopt/bin/nopt.js b/bin/node_modules/ios-sim/node_modules/nopt/bin/nopt.js
new file mode 100755
index 0000000..df90c72
--- /dev/null
+++ b/bin/node_modules/ios-sim/node_modules/nopt/bin/nopt.js
@@ -0,0 +1,44 @@
+#!/usr/bin/env node
+var nopt = require("../lib/nopt")
+  , types = { num: Number
+            , bool: Boolean
+            , help: Boolean
+            , list: Array
+            , "num-list": [Number, Array]
+            , "str-list": [String, Array]
+            , "bool-list": [Boolean, Array]
+            , str: String }
+  , shorthands = { s: [ "--str", "astring" ]
+                 , b: [ "--bool" ]
+                 , nb: [ "--no-bool" ]
+                 , tft: [ "--bool-list", "--no-bool-list", "--bool-list", "true" ]
+                 , "?": ["--help"]
+                 , h: ["--help"]
+                 , H: ["--help"]
+                 , n: [ "--num", "125" ] }
+  , parsed = nopt( types
+                 , shorthands
+                 , process.argv
+                 , 2 )
+
+console.log("parsed", parsed)
+
+if (parsed.help) {
+  console.log("")
+  console.log("nopt cli tester")
+  console.log("")
+  console.log("types")
+  console.log(Object.keys(types).map(function M (t) {
+    var type = types[t]
+    if (Array.isArray(type)) {
+      return [t, type.map(function (type) { return type.name })]
+    }
+    return [t, type && type.name]
+  }).reduce(function (s, i) {
+    s[i[0]] = i[1]
+    return s
+  }, {}))
+  console.log("")
+  console.log("shorthands")
+  console.log(shorthands)
+}

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/e1b4a533/bin/node_modules/ios-sim/node_modules/nopt/examples/my-program.js
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/node_modules/nopt/examples/my-program.js b/bin/node_modules/ios-sim/node_modules/nopt/examples/my-program.js
new file mode 100755
index 0000000..142447e
--- /dev/null
+++ b/bin/node_modules/ios-sim/node_modules/nopt/examples/my-program.js
@@ -0,0 +1,30 @@
+#!/usr/bin/env node
+
+//process.env.DEBUG_NOPT = 1
+
+// my-program.js
+var nopt = require("../lib/nopt")
+  , Stream = require("stream").Stream
+  , path = require("path")
+  , knownOpts = { "foo" : [String, null]
+                , "bar" : [Stream, Number]
+                , "baz" : path
+                , "bloo" : [ "big", "medium", "small" ]
+                , "flag" : Boolean
+                , "pick" : Boolean
+                }
+  , shortHands = { "foofoo" : ["--foo", "Mr. Foo"]
+                 , "b7" : ["--bar", "7"]
+                 , "m" : ["--bloo", "medium"]
+                 , "p" : ["--pick"]
+                 , "f" : ["--flag", "true"]
+                 , "g" : ["--flag"]
+                 , "s" : "--flag"
+                 }
+             // everything is optional.
+             // knownOpts and shorthands default to {}
+             // arg list defaults to process.argv
+             // slice defaults to 2
+  , parsed = nopt(knownOpts, shortHands, process.argv, 2)
+
+console.log("parsed =\n"+ require("util").inspect(parsed))

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/e1b4a533/bin/node_modules/ios-sim/node_modules/nopt/lib/nopt.js
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/node_modules/nopt/lib/nopt.js b/bin/node_modules/ios-sim/node_modules/nopt/lib/nopt.js
new file mode 100644
index 0000000..ff41bbc
--- /dev/null
+++ b/bin/node_modules/ios-sim/node_modules/nopt/lib/nopt.js
@@ -0,0 +1,530 @@
+// info about each config option.
+
+var debug = process.env.DEBUG_NOPT || process.env.NOPT_DEBUG
+  ? function () { console.error.apply(console, arguments) }
+  : function () {}
+
+var url = require("url")
+  , path = require("path")
+  , Stream = require("stream").Stream
+  , abbrev = require("abbrev")
+
+module.exports = exports = nopt
+exports.clean = clean
+
+exports.typeDefs =
+  { String  : { type: String,  validate: validateString  }
+  , Boolean : { type: Boolean, validate: validateBoolean }
+  , url     : { type: url,     validate: validateUrl     }
+  , Number  : { type: Number,  validate: validateNumber  }
+  , path    : { type: path,    validate: validatePath    }
+  , Stream  : { type: Stream,  validate: validateStream  }
+  }
+
+function nopt (types, shorthands, args, slice) {
+  args = args || process.argv
+  types = types || {}
+  shorthands = shorthands || {}
+  if (typeof slice !== "number") slice = 2
+
+  debug(types, shorthands, args, slice)
+
+  args = args.slice(slice)
+  var data = {}
+    , key
+    , remain = []
+    , cooked = args
+    , original = args.slice(0)
+
+  parse(args, data, remain, types, shorthands)
+  // now data is full
+  clean(data, types, exports.typeDefs)
+  data.argv = {remain:remain,cooked:cooked,original:original}
+  data.argv.toString = function () {
+    return this.original.map(JSON.stringify).join(" ")
+  }
+  return data
+}
+
+function clean (data, types, typeDefs) {
+  typeDefs = typeDefs || exports.typeDefs
+  var remove = {}
+    , typeDefault = [false, true, null, String, Number]
+
+  Object.keys(data).forEach(function (k) {
+    if (k === "argv") return
+    var val = data[k]
+      , isArray = Array.isArray(val)
+      , type = types[k]
+    if (!isArray) val = [val]
+    if (!type) type = typeDefault
+    if (type === Array) type = typeDefault.concat(Array)
+    if (!Array.isArray(type)) type = [type]
+
+    debug("val=%j", val)
+    debug("types=", type)
+    val = val.map(function (val) {
+      // if it's an unknown value, then parse false/true/null/numbers
+      if (typeof val === "string") {
+        debug("string %j", val)
+        val = val.trim()
+        if ((val === "null" && ~type.indexOf(null))
+            || (val === "true" &&
+               (~type.indexOf(true) || ~type.indexOf(Boolean)))
+            || (val === "false" &&
+               (~type.indexOf(false) || ~type.indexOf(Boolean)))) {
+          val = JSON.parse(val)
+          debug("jsonable %j", val)
+        } else if (~type.indexOf(Number) && !isNaN(val)) {
+          debug("convert to number", val)
+          val = +val
+        }
+      }
+
+      if (!types.hasOwnProperty(k)) {
+        return val
+      }
+
+      // allow `--no-blah` to set 'blah' to null if null is allowed
+      if (val === false && ~type.indexOf(null) &&
+          !(~type.indexOf(false) || ~type.indexOf(Boolean))) {
+        val = null
+      }
+
+      var d = {}
+      d[k] = val
+      debug("prevalidated val", d, val, types[k])
+      if (!validate(d, k, val, types[k], typeDefs)) {
+        if (exports.invalidHandler) {
+          exports.invalidHandler(k, val, types[k], data)
+        } else if (exports.invalidHandler !== false) {
+          debug("invalid: "+k+"="+val, types[k])
+        }
+        return remove
+      }
+      debug("validated val", d, val, types[k])
+      return d[k]
+    }).filter(function (val) { return val !== remove })
+
+    if (!val.length) delete data[k]
+    else if (isArray) {
+      debug(isArray, data[k], val)
+      data[k] = val
+    } else data[k] = val[0]
+
+    debug("k=%s val=%j", k, val, data[k])
+  })
+}
+
+function validateString (data, k, val) {
+  data[k] = String(val)
+}
+
+function validatePath (data, k, val) {
+  data[k] = path.resolve(String(val))
+  return true
+}
+
+function validateNumber (data, k, val) {
+  debug("validate Number %j %j %j", k, val, isNaN(val))
+  if (isNaN(val)) return false
+  data[k] = +val
+}
+
+function validateBoolean (data, k, val) {
+  if (val instanceof Boolean) val = val.valueOf()
+  else if (typeof val === "string") {
+    if (!isNaN(val)) val = !!(+val)
+    else if (val === "null" || val === "false") val = false
+    else val = true
+  } else val = !!val
+  data[k] = val
+}
+
+function validateUrl (data, k, val) {
+  val = url.parse(String(val))
+  if (!val.host) return false
+  data[k] = val.href
+}
+
+function validateStream (data, k, val) {
+  if (!(val instanceof Stream)) return false
+  data[k] = val
+}
+
+function validate (data, k, val, type, typeDefs) {
+  // arrays are lists of types.
+  if (Array.isArray(type)) {
+    for (var i = 0, l = type.length; i < l; i ++) {
+      if (type[i] === Array) continue
+      if (validate(data, k, val, type[i], typeDefs)) return true
+    }
+    delete data[k]
+    return false
+  }
+
+  // an array of anything?
+  if (type === Array) return true
+
+  // NaN is poisonous.  Means that something is not allowed.
+  if (type !== type) {
+    debug("Poison NaN", k, val, type)
+    delete data[k]
+    return false
+  }
+
+  // explicit list of values
+  if (val === type) {
+    debug("Explicitly allowed %j", val)
+    // if (isArray) (data[k] = data[k] || []).push(val)
+    // else data[k] = val
+    data[k] = val
+    return true
+  }
+
+  // now go through the list of typeDefs, validate against each one.
+  var ok = false
+    , types = Object.keys(typeDefs)
+  for (var i = 0, l = types.length; i < l; i ++) {
+    debug("test type %j %j %j", k, val, types[i])
+    var t = typeDefs[types[i]]
+    if (t && type === t.type) {
+      var d = {}
+      ok = false !== t.validate(d, k, val)
+      val = d[k]
+      if (ok) {
+        // if (isArray) (data[k] = data[k] || []).push(val)
+        // else data[k] = val
+        data[k] = val
+        break
+      }
+    }
+  }
+  debug("OK? %j (%j %j %j)", ok, k, val, types[i])
+
+  if (!ok) delete data[k]
+  return ok
+}
+
+function parse (args, data, remain, types, shorthands) {
+  debug("parse", args, data, remain)
+
+  var key = null
+    , abbrevs = abbrev(Object.keys(types))
+    , shortAbbr = abbrev(Object.keys(shorthands))
+
+  for (var i = 0; i < args.length; i ++) {
+    var arg = args[i]
+    debug("arg", arg)
+
+    if (arg.match(/^-{2,}$/)) {
+      // done with keys.
+      // the rest are args.
+      remain.push.apply(remain, args.slice(i + 1))
+      args[i] = "--"
+      break
+    }
+    if (arg.charAt(0) === "-") {
+      if (arg.indexOf("=") !== -1) {
+        var v = arg.split("=")
+        arg = v.shift()
+        v = v.join("=")
+        args.splice.apply(args, [i, 1].concat([arg, v]))
+      }
+      // see if it's a shorthand
+      // if so, splice and back up to re-parse it.
+      var shRes = resolveShort(arg, shorthands, shortAbbr, abbrevs)
+      debug("arg=%j shRes=%j", arg, shRes)
+      if (shRes) {
+        debug(arg, shRes)
+        args.splice.apply(args, [i, 1].concat(shRes))
+        if (arg !== shRes[0]) {
+          i --
+          continue
+        }
+      }
+      arg = arg.replace(/^-+/, "")
+      var no = false
+      while (arg.toLowerCase().indexOf("no-") === 0) {
+        no = !no
+        arg = arg.substr(3)
+      }
+
+      if (abbrevs[arg]) arg = abbrevs[arg]
+
+      var isArray = types[arg] === Array ||
+        Array.isArray(types[arg]) && types[arg].indexOf(Array) !== -1
+
+      var val
+        , la = args[i + 1]
+
+      var isBool = no ||
+        types[arg] === Boolean ||
+        Array.isArray(types[arg]) && types[arg].indexOf(Boolean) !== -1 ||
+        (la === "false" &&
+         (types[arg] === null ||
+          Array.isArray(types[arg]) && ~types[arg].indexOf(null)))
+
+      if (isBool) {
+        // just set and move along
+        val = !no
+        // however, also support --bool true or --bool false
+        if (la === "true" || la === "false") {
+          val = JSON.parse(la)
+          la = null
+          if (no) val = !val
+          i ++
+        }
+
+        // also support "foo":[Boolean, "bar"] and "--foo bar"
+        if (Array.isArray(types[arg]) && la) {
+          if (~types[arg].indexOf(la)) {
+            // an explicit type
+            val = la
+            i ++
+          } else if ( la === "null" && ~types[arg].indexOf(null) ) {
+            // null allowed
+            val = null
+            i ++
+          } else if ( !la.match(/^-{2,}[^-]/) &&
+                      !isNaN(la) &&
+                      ~types[arg].indexOf(Number) ) {
+            // number
+            val = +la
+            i ++
+          } else if ( !la.match(/^-[^-]/) && ~types[arg].indexOf(String) ) {
+            // string
+            val = la
+            i ++
+          }
+        }
+
+        if (isArray) (data[arg] = data[arg] || []).push(val)
+        else data[arg] = val
+
+        continue
+      }
+
+      if (la && la.match(/^-{2,}$/)) {
+        la = undefined
+        i --
+      }
+
+      val = la === undefined ? true : la
+      if (isArray) (data[arg] = data[arg] || []).push(val)
+      else data[arg] = val
+
+      i ++
+      continue
+    }
+    remain.push(arg)
+  }
+}
+
+function resolveShort (arg, shorthands, shortAbbr, abbrevs) {
+  // handle single-char shorthands glommed together, like
+  // npm ls -glp, but only if there is one dash, and only if
+  // all of the chars are single-char shorthands, and it's
+  // not a match to some other abbrev.
+  arg = arg.replace(/^-+/, '')
+  if (abbrevs[arg] && !shorthands[arg]) {
+    return null
+  }
+  if (shortAbbr[arg]) {
+    arg = shortAbbr[arg]
+  } else {
+    var singles = shorthands.___singles
+    if (!singles) {
+      singles = Object.keys(shorthands).filter(function (s) {
+        return s.length === 1
+      }).reduce(function (l,r) { l[r] = true ; return l }, {})
+      shorthands.___singles = singles
+    }
+    var chrs = arg.split("").filter(function (c) {
+      return singles[c]
+    })
+    if (chrs.join("") === arg) return chrs.map(function (c) {
+      return shorthands[c]
+    }).reduce(function (l, r) {
+      return l.concat(r)
+    }, [])
+  }
+
+  if (shorthands[arg] && !Array.isArray(shorthands[arg])) {
+    shorthands[arg] = shorthands[arg].split(/\s+/)
+  }
+  return shorthands[arg]
+}
+
+if (module === require.main) {
+var assert = require("assert")
+  , util = require("util")
+
+  , shorthands =
+    { s : ["--loglevel", "silent"]
+    , d : ["--loglevel", "info"]
+    , dd : ["--loglevel", "verbose"]
+    , ddd : ["--loglevel", "silly"]
+    , noreg : ["--no-registry"]
+    , reg : ["--registry"]
+    , "no-reg" : ["--no-registry"]
+    , silent : ["--loglevel", "silent"]
+    , verbose : ["--loglevel", "verbose"]
+    , h : ["--usage"]
+    , H : ["--usage"]
+    , "?" : ["--usage"]
+    , help : ["--usage"]
+    , v : ["--version"]
+    , f : ["--force"]
+    , desc : ["--description"]
+    , "no-desc" : ["--no-description"]
+    , "local" : ["--no-global"]
+    , l : ["--long"]
+    , p : ["--parseable"]
+    , porcelain : ["--parseable"]
+    , g : ["--global"]
+    }
+
+  , types =
+    { aoa: Array
+    , nullstream: [null, Stream]
+    , str: String
+    , browser : String
+    , cache : path
+    , color : ["always", Boolean]
+    , depth : Number
+    , description : Boolean
+    , dev : Boolean
+    , editor : path
+    , force : Boolean
+    , global : Boolean
+    , globalconfig : path
+    , group : [String, Number]
+    , gzipbin : String
+    , logfd : [Number, Stream]
+    , loglevel : ["silent","win","error","warn","info","verbose","silly"]
+    , long : Boolean
+    , "node-version" : [false, String]
+    , npaturl : url
+    , npat : Boolean
+    , "onload-script" : [false, String]
+    , outfd : [Number, Stream]
+    , parseable : Boolean
+    , pre: Boolean
+    , prefix: path
+    , proxy : url
+    , "rebuild-bundle" : Boolean
+    , registry : url
+    , searchopts : String
+    , searchexclude: [null, String]
+    , shell : path
+    , t: [Array, String]
+    , tag : String
+    , tar : String
+    , tmp : path
+    , "unsafe-perm" : Boolean
+    , usage : Boolean
+    , user : String
+    , username : String
+    , userconfig : path
+    , version : Boolean
+    , viewer: path
+    , _exit : Boolean
+    }
+
+; [["-v", {version:true}, []]
+  ,["---v", {version:true}, []]
+  ,["ls -s --no-reg connect -d",
+    {loglevel:"info",registry:null},["ls","connect"]]
+  ,["ls ---s foo",{loglevel:"silent"},["ls","foo"]]
+  ,["ls --registry blargle", {}, ["ls"]]
+  ,["--no-registry", {registry:null}, []]
+  ,["--no-color true", {color:false}, []]
+  ,["--no-color false", {color:true}, []]
+  ,["--no-color", {color:false}, []]
+  ,["--color false", {color:false}, []]
+  ,["--color --logfd 7", {logfd:7,color:true}, []]
+  ,["--color=true", {color:true}, []]
+  ,["--logfd=10", {logfd:10}, []]
+  ,["--tmp=/tmp -tar=gtar",{tmp:"/tmp",tar:"gtar"},[]]
+  ,["--tmp=tmp -tar=gtar",
+    {tmp:path.resolve(process.cwd(), "tmp"),tar:"gtar"},[]]
+  ,["--logfd x", {}, []]
+  ,["a -true -- -no-false", {true:true},["a","-no-false"]]
+  ,["a -no-false", {false:false},["a"]]
+  ,["a -no-no-true", {true:true}, ["a"]]
+  ,["a -no-no-no-false", {false:false}, ["a"]]
+  ,["---NO-no-No-no-no-no-nO-no-no"+
+    "-No-no-no-no-no-no-no-no-no"+
+    "-no-no-no-no-NO-NO-no-no-no-no-no-no"+
+    "-no-body-can-do-the-boogaloo-like-I-do"
+   ,{"body-can-do-the-boogaloo-like-I-do":false}, []]
+  ,["we are -no-strangers-to-love "+
+    "--you-know the-rules --and so-do-i "+
+    "---im-thinking-of=a-full-commitment "+
+    "--no-you-would-get-this-from-any-other-guy "+
+    "--no-gonna-give-you-up "+
+    "-no-gonna-let-you-down=true "+
+    "--no-no-gonna-run-around false "+
+    "--desert-you=false "+
+    "--make-you-cry false "+
+    "--no-tell-a-lie "+
+    "--no-no-and-hurt-you false"
+   ,{"strangers-to-love":false
+    ,"you-know":"the-rules"
+    ,"and":"so-do-i"
+    ,"you-would-get-this-from-any-other-guy":false
+    ,"gonna-give-you-up":false
+    ,"gonna-let-you-down":false
+    ,"gonna-run-around":false
+    ,"desert-you":false
+    ,"make-you-cry":false
+    ,"tell-a-lie":false
+    ,"and-hurt-you":false
+    },["we", "are"]]
+  ,["-t one -t two -t three"
+   ,{t: ["one", "two", "three"]}
+   ,[]]
+  ,["-t one -t null -t three four five null"
+   ,{t: ["one", "null", "three"]}
+   ,["four", "five", "null"]]
+  ,["-t foo"
+   ,{t:["foo"]}
+   ,[]]
+  ,["--no-t"
+   ,{t:["false"]}
+   ,[]]
+  ,["-no-no-t"
+   ,{t:["true"]}
+   ,[]]
+  ,["-aoa one -aoa null -aoa 100"
+   ,{aoa:["one", null, 100]}
+   ,[]]
+  ,["-str 100"
+   ,{str:"100"}
+   ,[]]
+  ,["--color always"
+   ,{color:"always"}
+   ,[]]
+  ,["--no-nullstream"
+   ,{nullstream:null}
+   ,[]]
+  ,["--nullstream false"
+   ,{nullstream:null}
+   ,[]]
+  ].forEach(function (test) {
+    var argv = test[0].split(/\s+/)
+      , opts = test[1]
+      , rem = test[2]
+      , actual = nopt(types, shorthands, argv, 0)
+      , parsed = actual.argv
+    delete actual.argv
+    console.log(util.inspect(actual, false, 2, true), parsed.remain)
+    for (var i in opts) {
+      var e = JSON.stringify(opts[i])
+        , a = JSON.stringify(actual[i] === undefined ? null : actual[i])
+      assert.equal(e, a)
+    }
+    assert.deepEqual(rem, parsed.remain)
+  })
+}

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/e1b4a533/bin/node_modules/ios-sim/node_modules/nopt/node_modules/abbrev/.npmignore
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/node_modules/nopt/node_modules/abbrev/.npmignore b/bin/node_modules/ios-sim/node_modules/nopt/node_modules/abbrev/.npmignore
new file mode 100644
index 0000000..9d6cd2f
--- /dev/null
+++ b/bin/node_modules/ios-sim/node_modules/nopt/node_modules/abbrev/.npmignore
@@ -0,0 +1,4 @@
+.nyc_output
+nyc_output
+node_modules
+coverage

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/e1b4a533/bin/node_modules/ios-sim/node_modules/nopt/node_modules/abbrev/.travis.yml
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/node_modules/nopt/node_modules/abbrev/.travis.yml b/bin/node_modules/ios-sim/node_modules/nopt/node_modules/abbrev/.travis.yml
new file mode 100644
index 0000000..991d04b
--- /dev/null
+++ b/bin/node_modules/ios-sim/node_modules/nopt/node_modules/abbrev/.travis.yml
@@ -0,0 +1,5 @@
+language: node_js
+node_js:
+  - '0.10'
+  - '0.12'
+  - 'iojs'

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/e1b4a533/bin/node_modules/ios-sim/node_modules/nopt/node_modules/abbrev/CONTRIBUTING.md
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/node_modules/nopt/node_modules/abbrev/CONTRIBUTING.md b/bin/node_modules/ios-sim/node_modules/nopt/node_modules/abbrev/CONTRIBUTING.md
new file mode 100644
index 0000000..2f30261
--- /dev/null
+++ b/bin/node_modules/ios-sim/node_modules/nopt/node_modules/abbrev/CONTRIBUTING.md
@@ -0,0 +1,3 @@
+ To get started, <a
+ href="http://www.clahub.com/agreements/isaacs/abbrev-js">sign the
+ Contributor License Agreement</a>.

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/e1b4a533/bin/node_modules/ios-sim/node_modules/nopt/node_modules/abbrev/LICENSE
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/node_modules/nopt/node_modules/abbrev/LICENSE b/bin/node_modules/ios-sim/node_modules/nopt/node_modules/abbrev/LICENSE
new file mode 100644
index 0000000..19129e3
--- /dev/null
+++ b/bin/node_modules/ios-sim/node_modules/nopt/node_modules/abbrev/LICENSE
@@ -0,0 +1,15 @@
+The ISC License
+
+Copyright (c) Isaac Z. Schlueter and Contributors
+
+Permission to use, copy, modify, and/or distribute this software for any
+purpose with or without fee is hereby granted, provided that the above
+copyright notice and this permission notice appear in all copies.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
+IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/e1b4a533/bin/node_modules/ios-sim/node_modules/nopt/node_modules/abbrev/README.md
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/node_modules/nopt/node_modules/abbrev/README.md b/bin/node_modules/ios-sim/node_modules/nopt/node_modules/abbrev/README.md
new file mode 100644
index 0000000..99746fe
--- /dev/null
+++ b/bin/node_modules/ios-sim/node_modules/nopt/node_modules/abbrev/README.md
@@ -0,0 +1,23 @@
+# abbrev-js
+
+Just like [ruby's Abbrev](http://apidock.com/ruby/Abbrev).
+
+Usage:
+
+    var abbrev = require("abbrev");
+    abbrev("foo", "fool", "folding", "flop");
+    
+    // returns:
+    { fl: 'flop'
+    , flo: 'flop'
+    , flop: 'flop'
+    , fol: 'folding'
+    , fold: 'folding'
+    , foldi: 'folding'
+    , foldin: 'folding'
+    , folding: 'folding'
+    , foo: 'foo'
+    , fool: 'fool'
+    }
+
+This is handy for command-line scripts, or other cases where you want to be able to accept shorthands.

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/e1b4a533/bin/node_modules/ios-sim/node_modules/nopt/node_modules/abbrev/abbrev.js
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/node_modules/nopt/node_modules/abbrev/abbrev.js b/bin/node_modules/ios-sim/node_modules/nopt/node_modules/abbrev/abbrev.js
new file mode 100644
index 0000000..69cfeac
--- /dev/null
+++ b/bin/node_modules/ios-sim/node_modules/nopt/node_modules/abbrev/abbrev.js
@@ -0,0 +1,62 @@
+
+module.exports = exports = abbrev.abbrev = abbrev
+
+abbrev.monkeyPatch = monkeyPatch
+
+function monkeyPatch () {
+  Object.defineProperty(Array.prototype, 'abbrev', {
+    value: function () { return abbrev(this) },
+    enumerable: false, configurable: true, writable: true
+  })
+
+  Object.defineProperty(Object.prototype, 'abbrev', {
+    value: function () { return abbrev(Object.keys(this)) },
+    enumerable: false, configurable: true, writable: true
+  })
+}
+
+function abbrev (list) {
+  if (arguments.length !== 1 || !Array.isArray(list)) {
+    list = Array.prototype.slice.call(arguments, 0)
+  }
+  for (var i = 0, l = list.length, args = [] ; i < l ; i ++) {
+    args[i] = typeof list[i] === "string" ? list[i] : String(list[i])
+  }
+
+  // sort them lexicographically, so that they're next to their nearest kin
+  args = args.sort(lexSort)
+
+  // walk through each, seeing how much it has in common with the next and previous
+  var abbrevs = {}
+    , prev = ""
+  for (var i = 0, l = args.length ; i < l ; i ++) {
+    var current = args[i]
+      , next = args[i + 1] || ""
+      , nextMatches = true
+      , prevMatches = true
+    if (current === next) continue
+    for (var j = 0, cl = current.length ; j < cl ; j ++) {
+      var curChar = current.charAt(j)
+      nextMatches = nextMatches && curChar === next.charAt(j)
+      prevMatches = prevMatches && curChar === prev.charAt(j)
+      if (!nextMatches && !prevMatches) {
+        j ++
+        break
+      }
+    }
+    prev = current
+    if (j === cl) {
+      abbrevs[current] = current
+      continue
+    }
+    for (var a = current.substr(0, j) ; j <= cl ; j ++) {
+      abbrevs[a] = current
+      a += current.charAt(j)
+    }
+  }
+  return abbrevs
+}
+
+function lexSort (a, b) {
+  return a === b ? 0 : a > b ? 1 : -1
+}

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/e1b4a533/bin/node_modules/ios-sim/node_modules/nopt/node_modules/abbrev/package.json
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/node_modules/nopt/node_modules/abbrev/package.json b/bin/node_modules/ios-sim/node_modules/nopt/node_modules/abbrev/package.json
new file mode 100644
index 0000000..c13eef4
--- /dev/null
+++ b/bin/node_modules/ios-sim/node_modules/nopt/node_modules/abbrev/package.json
@@ -0,0 +1,48 @@
+{
+  "name": "abbrev",
+  "version": "1.0.7",
+  "description": "Like ruby's abbrev module, but in js",
+  "author": {
+    "name": "Isaac Z. Schlueter",
+    "email": "i@izs.me"
+  },
+  "main": "abbrev.js",
+  "scripts": {
+    "test": "tap test.js --cov"
+  },
+  "repository": {
+    "type": "git",
+    "url": "git+ssh://git@github.com/isaacs/abbrev-js.git"
+  },
+  "license": "ISC",
+  "devDependencies": {
+    "tap": "^1.2.0"
+  },
+  "gitHead": "821d09ce7da33627f91bbd8ed631497ed6f760c2",
+  "bugs": {
+    "url": "https://github.com/isaacs/abbrev-js/issues"
+  },
+  "homepage": "https://github.com/isaacs/abbrev-js#readme",
+  "_id": "abbrev@1.0.7",
+  "_shasum": "5b6035b2ee9d4fb5cf859f08a9be81b208491843",
+  "_from": "abbrev@>=1.0.0 <2.0.0",
+  "_npmVersion": "2.10.1",
+  "_nodeVersion": "2.0.1",
+  "_npmUser": {
+    "name": "isaacs",
+    "email": "isaacs@npmjs.com"
+  },
+  "dist": {
+    "shasum": "5b6035b2ee9d4fb5cf859f08a9be81b208491843",
+    "tarball": "http://registry.npmjs.org/abbrev/-/abbrev-1.0.7.tgz"
+  },
+  "maintainers": [
+    {
+      "name": "isaacs",
+      "email": "i@izs.me"
+    }
+  ],
+  "directories": {},
+  "_resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.0.7.tgz",
+  "readme": "ERROR: No README data found!"
+}

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/e1b4a533/bin/node_modules/ios-sim/node_modules/nopt/node_modules/abbrev/test.js
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/node_modules/nopt/node_modules/abbrev/test.js b/bin/node_modules/ios-sim/node_modules/nopt/node_modules/abbrev/test.js
new file mode 100644
index 0000000..eb30e42
--- /dev/null
+++ b/bin/node_modules/ios-sim/node_modules/nopt/node_modules/abbrev/test.js
@@ -0,0 +1,47 @@
+var abbrev = require('./abbrev.js')
+var assert = require("assert")
+var util = require("util")
+
+console.log("TAP version 13")
+var count = 0
+
+function test (list, expect) {
+  count++
+  var actual = abbrev(list)
+  assert.deepEqual(actual, expect,
+    "abbrev("+util.inspect(list)+") === " + util.inspect(expect) + "\n"+
+    "actual: "+util.inspect(actual))
+  actual = abbrev.apply(exports, list)
+  assert.deepEqual(abbrev.apply(exports, list), expect,
+    "abbrev("+list.map(JSON.stringify).join(",")+") === " + util.inspect(expect) + "\n"+
+    "actual: "+util.inspect(actual))
+  console.log('ok - ' + list.join(' '))
+}
+
+test([ "ruby", "ruby", "rules", "rules", "rules" ],
+{ rub: 'ruby'
+, ruby: 'ruby'
+, rul: 'rules'
+, rule: 'rules'
+, rules: 'rules'
+})
+test(["fool", "foom", "pool", "pope"],
+{ fool: 'fool'
+, foom: 'foom'
+, poo: 'pool'
+, pool: 'pool'
+, pop: 'pope'
+, pope: 'pope'
+})
+test(["a", "ab", "abc", "abcd", "abcde", "acde"],
+{ a: 'a'
+, ab: 'ab'
+, abc: 'abc'
+, abcd: 'abcd'
+, abcde: 'abcde'
+, ac: 'acde'
+, acd: 'acde'
+, acde: 'acde'
+})
+
+console.log("1..%d", count)

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/e1b4a533/bin/node_modules/ios-sim/node_modules/nopt/package.json
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/node_modules/nopt/package.json b/bin/node_modules/ios-sim/node_modules/nopt/package.json
new file mode 100644
index 0000000..27c972c
--- /dev/null
+++ b/bin/node_modules/ios-sim/node_modules/nopt/package.json
@@ -0,0 +1,60 @@
+{
+  "name": "nopt",
+  "version": "1.0.9",
+  "description": "Option parsing for Node, supporting types, shorthands, etc. Used by npm.",
+  "author": {
+    "name": "Isaac Z. Schlueter",
+    "email": "i@izs.me",
+    "url": "http://blog.izs.me/"
+  },
+  "main": "lib/nopt.js",
+  "scripts": {
+    "test": "node lib/nopt.js"
+  },
+  "repository": {
+    "type": "git",
+    "url": "git://github.com/isaacs/nopt.git"
+  },
+  "bin": {
+    "nopt": "./bin/nopt.js"
+  },
+  "license": {
+    "type": "MIT",
+    "url": "https://github.com/isaacs/nopt/raw/master/LICENSE"
+  },
+  "dependencies": {
+    "abbrev": "1"
+  },
+  "_npmUser": {
+    "name": "isaacs",
+    "email": "i@izs.me"
+  },
+  "_id": "nopt@1.0.9",
+  "devDependencies": {},
+  "engines": {
+    "node": "*"
+  },
+  "_engineSupported": true,
+  "_npmVersion": "1.0.30",
+  "_nodeVersion": "v0.5.8-pre",
+  "_defaultsLoaded": true,
+  "dist": {
+    "shasum": "3bc0d7cba7bfb0d5a676dbed7c0ebe48a4fd454e",
+    "tarball": "http://registry.npmjs.org/nopt/-/nopt-1.0.9.tgz"
+  },
+  "maintainers": [
+    {
+      "name": "isaacs",
+      "email": "i@izs.me"
+    }
+  ],
+  "directories": {},
+  "_shasum": "3bc0d7cba7bfb0d5a676dbed7c0ebe48a4fd454e",
+  "_resolved": "https://registry.npmjs.org/nopt/-/nopt-1.0.9.tgz",
+  "_from": "nopt@1.0.9",
+  "bugs": {
+    "url": "https://github.com/isaacs/nopt/issues"
+  },
+  "readme": "ERROR: No README data found!",
+  "homepage": "https://github.com/isaacs/nopt#readme"
+}

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/e1b4a533/bin/node_modules/ios-sim/node_modules/simctl/.npmignore
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/node_modules/simctl/.npmignore b/bin/node_modules/ios-sim/node_modules/simctl/.npmignore
new file mode 100644
index 0000000..b512c09
--- /dev/null
+++ b/bin/node_modules/ios-sim/node_modules/simctl/.npmignore
@@ -0,0 +1 @@
+node_modules
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/e1b4a533/bin/node_modules/ios-sim/node_modules/simctl/LICENSE
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/node_modules/simctl/LICENSE b/bin/node_modules/ios-sim/node_modules/simctl/LICENSE
new file mode 100644
index 0000000..3fdbf44
--- /dev/null
+++ b/bin/node_modules/ios-sim/node_modules/simctl/LICENSE
@@ -0,0 +1,22 @@
+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.
+

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/e1b4a533/bin/node_modules/ios-sim/node_modules/simctl/README.md
----------------------------------------------------------------------
diff --git a/bin/node_modules/ios-sim/node_modules/simctl/README.md b/bin/node_modules/ios-sim/node_modules/simctl/README.md
new file mode 100644
index 0000000..ded769b
--- /dev/null
+++ b/bin/node_modules/ios-sim/node_modules/simctl/README.md
@@ -0,0 +1,3 @@
+library for Xcode simctl utility on OS X
+
+in experimental stage at the moment.
\ 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