You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by an...@apache.org on 2016/03/04 13:32:06 UTC
[02/14] cordova-browser git commit: CB-10755 Updated checked in
node_modules
http://git-wip-us.apache.org/repos/asf/cordova-browser/blob/012b9d3b/node_modules/shelljs/src/exec.js
----------------------------------------------------------------------
diff --git a/node_modules/shelljs/src/exec.js b/node_modules/shelljs/src/exec.js
new file mode 100644
index 0000000..4174adb
--- /dev/null
+++ b/node_modules/shelljs/src/exec.js
@@ -0,0 +1,249 @@
+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');
+
+var DEFAULT_MAXBUFFER_SIZE = 20*1024*1024;
+
+// 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()),
+ stderrFile = path.resolve(tempDir+'/'+common.randomFileName()),
+ codeFile = path.resolve(tempDir+'/'+common.randomFileName()),
+ scriptFile = path.resolve(tempDir+'/'+common.randomFileName()),
+ sleepFile = path.resolve(tempDir+'/'+common.randomFileName());
+
+ opts = common.extend({
+ silent: common.config.silent,
+ cwd: _pwd(),
+ env: process.env,
+ maxBuffer: DEFAULT_MAXBUFFER_SIZE
+ }, opts);
+
+ var previousStdoutContent = '',
+ previousStderrContent = '';
+ // Echoes stdout and stderr changes from running process, if not silent
+ function updateStream(streamFile) {
+ if (opts.silent || !fs.existsSync(streamFile))
+ return;
+
+ var previousStreamContent,
+ proc_stream;
+ if (streamFile === stdoutFile) {
+ previousStreamContent = previousStdoutContent;
+ proc_stream = process.stdout;
+ } else { // assume stderr
+ previousStreamContent = previousStderrContent;
+ proc_stream = process.stderr;
+ }
+
+ var streamContent = fs.readFileSync(streamFile, 'utf8');
+ // No changes since last time?
+ if (streamContent.length <= previousStreamContent.length)
+ return;
+
+ proc_stream.write(streamContent.substr(previousStreamContent.length));
+ previousStreamContent = streamContent;
+ }
+
+ function escape(str) {
+ return (str+'').replace(/([\\"'])/g, "\\$1").replace(/\0/g, "\\0");
+ }
+
+ if (fs.existsSync(scriptFile)) common.unlinkSync(scriptFile);
+ if (fs.existsSync(stdoutFile)) common.unlinkSync(stdoutFile);
+ if (fs.existsSync(stderrFile)) common.unlinkSync(stderrFile);
+ if (fs.existsSync(codeFile)) common.unlinkSync(codeFile);
+
+ var execCommand = '"'+process.execPath+'" '+scriptFile;
+ var script;
+
+ if (typeof child.execSync === 'function') {
+ script = [
+ "var child = require('child_process')",
+ " , fs = require('fs');",
+ "var childProcess = child.exec('"+escape(cmd)+"', {env: process.env, maxBuffer: "+opts.maxBuffer+"}, function(err) {",
+ " fs.writeFileSync('"+escape(codeFile)+"', err ? err.code.toString() : '0');",
+ "});",
+ "var stdoutStream = fs.createWriteStream('"+escape(stdoutFile)+"');",
+ "var stderrStream = fs.createWriteStream('"+escape(stderrFile)+"');",
+ "childProcess.stdout.pipe(stdoutStream, {end: false});",
+ "childProcess.stderr.pipe(stderrStream, {end: false});",
+ "childProcess.stdout.pipe(process.stdout);",
+ "childProcess.stderr.pipe(process.stderr);",
+ "var stdoutEnded = false, stderrEnded = false;",
+ "function tryClosingStdout(){ if(stdoutEnded){ stdoutStream.end(); } }",
+ "function tryClosingStderr(){ if(stderrEnded){ stderrStream.end(); } }",
+ "childProcess.stdout.on('end', function(){ stdoutEnded = true; tryClosingStdout(); });",
+ "childProcess.stderr.on('end', function(){ stderrEnded = true; tryClosingStderr(); });"
+ ].join('\n');
+
+ fs.writeFileSync(scriptFile, script);
+
+ if (opts.silent) {
+ opts.stdio = 'ignore';
+ } else {
+ opts.stdio = [0, 1, 2];
+ }
+
+ // Welcome to the future
+ child.execSync(execCommand, opts);
+ } else {
+ cmd += ' > '+stdoutFile+' 2> '+stderrFile; // works on both win/unix
+
+ script = [
+ "var child = require('child_process')",
+ " , fs = require('fs');",
+ "var childProcess = child.exec('"+escape(cmd)+"', {env: process.env, maxBuffer: "+opts.maxBuffer+"}, function(err) {",
+ " fs.writeFileSync('"+escape(codeFile)+"', err ? err.code.toString() : '0');",
+ "});"
+ ].join('\n');
+
+ fs.writeFileSync(scriptFile, script);
+
+ child.exec(execCommand, opts);
+
+ // 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)) { updateStream(stdoutFile); fs.writeFileSync(sleepFile, 'a'); }
+ while (!fs.existsSync(stdoutFile)) { updateStream(stdoutFile); fs.writeFileSync(sleepFile, 'a'); }
+ while (!fs.existsSync(stderrFile)) { updateStream(stderrFile); 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');
+ var stderr = fs.readFileSync(stderrFile, '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(stderrFile); } 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, // deprecated
+ stdout: stdout,
+ stderr: stderr
+ };
+ return obj;
+} // execSync()
+
+// Wrapper around exec() to enable echoing output to console in real time
+function execAsync(cmd, opts, callback) {
+ var stdout = '';
+ var stderr = '';
+
+ opts = common.extend({
+ silent: common.config.silent,
+ cwd: _pwd(),
+ env: process.env,
+ maxBuffer: DEFAULT_MAXBUFFER_SIZE
+ }, opts);
+
+ var c = child.exec(cmd, opts, function(err) {
+ if (callback)
+ callback(err ? err.code : 0, stdout, stderr);
+ });
+
+ c.stdout.on('data', function(data) {
+ stdout += data;
+ if (!opts.silent)
+ process.stdout.write(data);
+ });
+
+ c.stderr.on('data', function(data) {
+ stderr += data;
+ if (!opts.silent)
+ process.stderr.write(data);
+ });
+
+ return c;
+}
+
+//@
+//@ ### exec(command [, options] [, callback])
+//@ Available options (all `false` by default):
+//@
+//@ + `async`: Asynchronous execution. If a callback is provided, it will be set to
+//@ `true`, regardless of the passed value.
+//@ + `silent`: Do not echo program output to console.
+//@ + and any option available to NodeJS's
+//@ [child_process.exec()](https://nodejs.org/api/child_process.html#child_process_child_process_exec_command_options_callback)
+//@
+//@ Examples:
+//@
+//@ ```javascript
+//@ var version = exec('node --version', {silent:true}).stdout;
+//@
+//@ 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, stdout, stderr) {
+//@ console.log('Exit code:', code);
+//@ console.log('Program output:', stdout);
+//@ console.log('Program stderr:', stderr);
+//@ });
+//@ ```
+//@
+//@ Executes the given `command` _synchronously_, unless otherwise specified. When in synchronous
+//@ mode returns the object `{ code:..., stdout:... , stderr:... }`, containing the program's
+//@ `stdout`, `stderr`, and its exit `code`. Otherwise returns the child process object,
+//@ and the `callback` gets the arguments `(code, stdout, stderr)`.
+//@
+//@ **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);
+
+ try {
+ if (options.async)
+ return execAsync(command, options, callback);
+ else
+ return execSync(command, options);
+ } catch (e) {
+ common.error('internal error');
+ }
+}
+module.exports = _exec;
http://git-wip-us.apache.org/repos/asf/cordova-browser/blob/012b9d3b/node_modules/shelljs/src/find.js
----------------------------------------------------------------------
diff --git a/node_modules/shelljs/src/find.js b/node_modules/shelljs/src/find.js
new file mode 100644
index 0000000..c96fb2f
--- /dev/null
+++ b/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-browser/blob/012b9d3b/node_modules/shelljs/src/grep.js
----------------------------------------------------------------------
diff --git a/node_modules/shelljs/src/grep.js b/node_modules/shelljs/src/grep.js
new file mode 100644
index 0000000..78008ce
--- /dev/null
+++ b/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-browser/blob/012b9d3b/node_modules/shelljs/src/ln.js
----------------------------------------------------------------------
diff --git a/node_modules/shelljs/src/ln.js b/node_modules/shelljs/src/ln.js
new file mode 100644
index 0000000..878fda1
--- /dev/null
+++ b/node_modules/shelljs/src/ln.js
@@ -0,0 +1,69 @@
+var fs = require('fs');
+var path = require('path');
+var common = require('./common');
+
+//@
+//@ ### ln([options,] source, dest)
+//@ Available options:
+//@
+//@ + `-s`: symlink
+//@ + `-f`: force
+//@
+//@ Examples:
+//@
+//@ ```javascript
+//@ ln('file', 'newlink');
+//@ ln('-sf', 'file', 'existing');
+//@ ```
+//@
+//@ Links source to dest. Use -f to force the link, should dest already exist.
+function _ln(options, source, dest) {
+ options = common.parseOptions(options, {
+ 's': 'symlink',
+ 'f': 'force'
+ });
+
+ if (!source || !dest) {
+ common.error('Missing <source> and/or <dest>');
+ }
+
+ source = String(source);
+ var sourcePath = path.normalize(source).replace(RegExp(path.sep + '$'), '');
+ var isAbsolute = (path.resolve(source) === sourcePath);
+ dest = path.resolve(process.cwd(), String(dest));
+
+ if (fs.existsSync(dest)) {
+ if (!options.force) {
+ common.error('Destination file exists', true);
+ }
+
+ fs.unlinkSync(dest);
+ }
+
+ if (options.symlink) {
+ var isWindows = common.platform === 'win';
+ var linkType = isWindows ? 'file' : null;
+ var resolvedSourcePath = isAbsolute ? sourcePath : path.resolve(process.cwd(), path.dirname(dest), source);
+ if (!fs.existsSync(resolvedSourcePath)) {
+ common.error('Source file does not exist', true);
+ } else if (isWindows && fs.statSync(resolvedSourcePath).isDirectory()) {
+ linkType = 'junction';
+ }
+
+ try {
+ fs.symlinkSync(linkType === 'junction' ? resolvedSourcePath: source, dest, linkType);
+ } catch (err) {
+ common.error(err.message);
+ }
+ } else {
+ if (!fs.existsSync(source)) {
+ common.error('Source file does not exist', true);
+ }
+ try {
+ fs.linkSync(source, dest);
+ } catch (err) {
+ common.error(err.message);
+ }
+ }
+}
+module.exports = _ln;
http://git-wip-us.apache.org/repos/asf/cordova-browser/blob/012b9d3b/node_modules/shelljs/src/ls.js
----------------------------------------------------------------------
diff --git a/node_modules/shelljs/src/ls.js b/node_modules/shelljs/src/ls.js
new file mode 100644
index 0000000..6a54b3a
--- /dev/null
+++ b/node_modules/shelljs/src/ls.js
@@ -0,0 +1,168 @@
+var path = require('path');
+var fs = require('fs');
+var common = require('./common');
+var _cd = require('./cd');
+var _pwd = require('./pwd');
+
+//@
+//@ ### ls([options,] [path, ...])
+//@ ### ls([options,] path_array)
+//@ Available options:
+//@
+//@ + `-R`: recursive
+//@ + `-A`: all files (include files beginning with `.`, except for `.` and `..`)
+//@ + `-d`: list directories themselves, not their contents
+//@ + `-l`: list objects representing each file, each with fields containing `ls
+//@ -l` output fields. See
+//@ [fs.Stats](https://nodejs.org/api/fs.html#fs_class_fs_stats)
+//@ for more info
+//@
+//@ Examples:
+//@
+//@ ```javascript
+//@ ls('projs/*.js');
+//@ ls('-R', '/users/me', '/tmp');
+//@ ls('-R', ['/users/me', '/tmp']); // same as above
+//@ ls('-l', 'file.txt'); // { name: 'file.txt', mode: 33188, nlink: 1, ...}
+//@ ```
+//@
+//@ 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',
+ 'd': 'directory',
+ 'l': 'long'
+ });
+
+ 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) {
+ var name = file.name || file;
+ // hidden file?
+ if (path.basename(name)[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')
+ name = name.replace(/\\/g, '/');
+
+ if (file.name) {
+ file.name = name;
+ } else {
+ file = name;
+ }
+ list.push(file);
+ return true;
+ }
+
+ paths.forEach(function(p) {
+ if (fs.existsSync(p)) {
+ var stats = ls_stat(p);
+ // Simple file?
+ if (stats.isFile()) {
+ if (options.long) {
+ pushFile(stats, p);
+ } else {
+ pushFile(p, p);
+ }
+ return; // continue
+ }
+
+ // Simple dir?
+ if (options.directory) {
+ pushFile(p, p);
+ return;
+ } else if (stats.isDirectory()) {
+ // Iterate over p contents
+ fs.readdirSync(p).forEach(function(file) {
+ var orig_file = file;
+ if (options.long)
+ file = ls_stat(path.join(p, file));
+ if (!pushFile(file, p))
+ return;
+
+ // Recursive?
+ if (options.recursive) {
+ var oldDir = _pwd();
+ _cd('', p);
+ if (fs.statSync(orig_file).isDirectory())
+ list = list.concat(_ls('-R'+(options.all?'A':''), orig_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))) {
+ var file_path = path.join(dirname, file);
+ file_path = options.long ? ls_stat(file_path) : file_path;
+ if (file_path.name)
+ file_path.name = path.normalize(file_path.name);
+ else
+ file_path = path.normalize(file_path);
+ if (!pushFile(file_path, 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;
+
+
+function ls_stat(path) {
+ var stats = fs.statSync(path);
+ // Note: this object will contain more information than .toString() returns
+ stats.name = path;
+ stats.toString = function() {
+ // Return a string resembling unix's `ls -l` format
+ return [this.mode, this.nlink, this.uid, this.gid, this.size, this.mtime, this.name].join(' ');
+ };
+ return stats;
+}
http://git-wip-us.apache.org/repos/asf/cordova-browser/blob/012b9d3b/node_modules/shelljs/src/mkdir.js
----------------------------------------------------------------------
diff --git a/node_modules/shelljs/src/mkdir.js b/node_modules/shelljs/src/mkdir.js
new file mode 100644
index 0000000..8b4fd99
--- /dev/null
+++ b/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-browser/blob/012b9d3b/node_modules/shelljs/src/mv.js
----------------------------------------------------------------------
diff --git a/node_modules/shelljs/src/mv.js b/node_modules/shelljs/src/mv.js
new file mode 100644
index 0000000..69cc03f
--- /dev/null
+++ b/node_modules/shelljs/src/mv.js
@@ -0,0 +1,82 @@
+var fs = require('fs');
+var path = require('path');
+var common = require('./common');
+
+//@
+//@ ### mv([options ,] source [, source ...], dest')
+//@ ### mv([options ,] source_array, dest')
+//@ Available options:
+//@
+//@ + `-f`: force (default behavior)
+//@ + `-n`: no-clobber
+//@
+//@ Examples:
+//@
+//@ ```javascript
+//@ mv('-n', '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': '!no_force',
+ 'n': 'no_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.no_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.no_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-browser/blob/012b9d3b/node_modules/shelljs/src/popd.js
----------------------------------------------------------------------
diff --git a/node_modules/shelljs/src/popd.js b/node_modules/shelljs/src/popd.js
new file mode 100644
index 0000000..11ea24f
--- /dev/null
+++ b/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-browser/blob/012b9d3b/node_modules/shelljs/src/pushd.js
----------------------------------------------------------------------
diff --git a/node_modules/shelljs/src/pushd.js b/node_modules/shelljs/src/pushd.js
new file mode 100644
index 0000000..11ea24f
--- /dev/null
+++ b/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-browser/blob/012b9d3b/node_modules/shelljs/src/pwd.js
----------------------------------------------------------------------
diff --git a/node_modules/shelljs/src/pwd.js b/node_modules/shelljs/src/pwd.js
new file mode 100644
index 0000000..26cefe0
--- /dev/null
+++ b/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() {
+ var pwd = path.resolve(process.cwd());
+ return common.ShellString(pwd);
+}
+module.exports = _pwd;
http://git-wip-us.apache.org/repos/asf/cordova-browser/blob/012b9d3b/node_modules/shelljs/src/rm.js
----------------------------------------------------------------------
diff --git a/node_modules/shelljs/src/rm.js b/node_modules/shelljs/src/rm.js
new file mode 100644
index 0000000..cf2e95b
--- /dev/null
+++ b/node_modules/shelljs/src/rm.js
@@ -0,0 +1,163 @@
+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 {
+ // Retry on windows, sometimes it takes a little time before all the files in the directory are gone
+ var start = Date.now();
+ while (true) {
+ try {
+ result = fs.rmdirSync(dir);
+ if (fs.existsSync(dir)) throw { code: "EAGAIN" };
+ break;
+ } catch(er) {
+ // In addition to error codes, also check if the directory still exists and loop again if true
+ if (process.platform === "win32" && (er.code === "ENOTEMPTY" || er.code === "EBUSY" || er.code === "EPERM" || er.code === "EAGAIN")) {
+ if (Date.now() - start > 1000) throw er;
+ } else if (er.code === "ENOENT") {
+ // Directory did not exist, deletion was successful
+ break;
+ } else {
+ throw er;
+ }
+ }
+ }
+ } 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-browser/blob/012b9d3b/node_modules/shelljs/src/sed.js
----------------------------------------------------------------------
diff --git a/node_modules/shelljs/src/sed.js b/node_modules/shelljs/src/sed.js
new file mode 100644
index 0000000..baa385b
--- /dev/null
+++ b/node_modules/shelljs/src/sed.js
@@ -0,0 +1,64 @@
+var common = require('./common');
+var fs = require('fs');
+
+//@
+//@ ### sed([options,] search_regex, replacement, file [, file ...])
+//@ ### sed([options,] search_regex, replacement, file_array)
+//@ 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 `files` and performs a JavaScript `replace()` on the input
+//@ using the given search regex and replacement string or function. Returns the new string after replacement.
+function _sed(options, regex, replacement, files) {
+ options = common.parseOptions(options, {
+ 'i': 'inplace'
+ });
+
+ if (typeof replacement === 'string' || typeof replacement === 'function')
+ replacement = replacement; // no-op
+ else if (typeof replacement === 'number')
+ replacement = replacement.toString(); // fallback
+ else
+ common.error('invalid replacement string');
+
+ // Convert all search strings to RegExp
+ if (typeof regex === 'string')
+ regex = RegExp(regex);
+
+ if (!files)
+ common.error('no files given');
+
+ if (typeof files === 'string')
+ files = [].slice.call(arguments, 3);
+ // if it's array leave it as it is
+
+ files = common.expand(files);
+
+ var sed = [];
+ files.forEach(function(file) {
+ if (!fs.existsSync(file)) {
+ common.error('no such file or directory: ' + file, true);
+ return;
+ }
+
+ var result = fs.readFileSync(file, 'utf8').split('\n').map(function (line) {
+ return line.replace(regex, replacement);
+ }).join('\n');
+
+ sed.push(result);
+
+ if (options.inplace)
+ fs.writeFileSync(file, result, 'utf8');
+ });
+
+ return common.ShellString(sed.join('\n'));
+}
+module.exports = _sed;
http://git-wip-us.apache.org/repos/asf/cordova-browser/blob/012b9d3b/node_modules/shelljs/src/set.js
----------------------------------------------------------------------
diff --git a/node_modules/shelljs/src/set.js b/node_modules/shelljs/src/set.js
new file mode 100644
index 0000000..19e26d9
--- /dev/null
+++ b/node_modules/shelljs/src/set.js
@@ -0,0 +1,49 @@
+var common = require('./common');
+
+//@
+//@ ### set(options)
+//@ Available options:
+//@
+//@ + `+/-e`: exit upon error (`config.fatal`)
+//@ + `+/-v`: verbose: show all commands (`config.verbose`)
+//@
+//@ Examples:
+//@
+//@ ```javascript
+//@ set('-e'); // exit upon first error
+//@ set('+e'); // this undoes a "set('-e')"
+//@ ```
+//@
+//@ Sets global configuration variables
+function _set(options) {
+ if (!options) {
+ var args = [].slice.call(arguments, 0);
+ if (args.length < 2)
+ common.error('must provide an argument');
+ options = args[1];
+ }
+ var negate = (options[0] === '+');
+ if (negate) {
+ options = '-' + options.slice(1); // parseOptions needs a '-' prefix
+ }
+ options = common.parseOptions(options, {
+ 'e': 'fatal',
+ 'v': 'verbose'
+ });
+
+ var key;
+ if (negate) {
+ for (key in options)
+ options[key] = !options[key];
+ }
+
+ for (key in options) {
+ // Only change the global config if `negate` is false and the option is true
+ // or if `negate` is true and the option is false (aka negate !== option)
+ if (negate !== options[key]) {
+ common.config[key] = options[key];
+ }
+ }
+ return;
+}
+module.exports = _set;
http://git-wip-us.apache.org/repos/asf/cordova-browser/blob/012b9d3b/node_modules/shelljs/src/tempdir.js
----------------------------------------------------------------------
diff --git a/node_modules/shelljs/src/tempdir.js b/node_modules/shelljs/src/tempdir.js
new file mode 100644
index 0000000..79b949f
--- /dev/null
+++ b/node_modules/shelljs/src/tempdir.js
@@ -0,0 +1,57 @@
+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.tmpdir && os.tmpdir()) || // node 0.10+
+ writeableDir(os.tmpDir && os.tmpDir()) || // 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-browser/blob/012b9d3b/node_modules/shelljs/src/test.js
----------------------------------------------------------------------
diff --git a/node_modules/shelljs/src/test.js b/node_modules/shelljs/src/test.js
new file mode 100644
index 0000000..068a1ce
--- /dev/null
+++ b/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 symbolic 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-browser/blob/012b9d3b/node_modules/shelljs/src/to.js
----------------------------------------------------------------------
diff --git a/node_modules/shelljs/src/to.js b/node_modules/shelljs/src/to.js
new file mode 100644
index 0000000..65d6d54
--- /dev/null
+++ b/node_modules/shelljs/src/to.js
@@ -0,0 +1,30 @@
+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');
+ return this;
+ } 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-browser/blob/012b9d3b/node_modules/shelljs/src/toEnd.js
----------------------------------------------------------------------
diff --git a/node_modules/shelljs/src/toEnd.js b/node_modules/shelljs/src/toEnd.js
new file mode 100644
index 0000000..bf29a65
--- /dev/null
+++ b/node_modules/shelljs/src/toEnd.js
@@ -0,0 +1,30 @@
+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');
+ return this;
+ } 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-browser/blob/012b9d3b/node_modules/shelljs/src/touch.js
----------------------------------------------------------------------
diff --git a/node_modules/shelljs/src/touch.js b/node_modules/shelljs/src/touch.js
new file mode 100644
index 0000000..bbc2c19
--- /dev/null
+++ b/node_modules/shelljs/src/touch.js
@@ -0,0 +1,109 @@
+var common = require('./common');
+var fs = require('fs');
+
+//@
+//@ ### touch([options,] file)
+//@ Available options:
+//@
+//@ + `-a`: Change only the access time
+//@ + `-c`: Do not create any files
+//@ + `-m`: Change only the modification time
+//@ + `-d DATE`: Parse DATE and use it instead of current time
+//@ + `-r FILE`: Use FILE's times instead of current time
+//@
+//@ Examples:
+//@
+//@ ```javascript
+//@ touch('source.js');
+//@ touch('-c', '/path/to/some/dir/source.js');
+//@ touch({ '-r': FILE }, '/path/to/some/dir/source.js');
+//@ ```
+//@
+//@ Update the access and modification times of each FILE to the current time.
+//@ A FILE argument that does not exist is created empty, unless -c is supplied.
+//@ This is a partial implementation of *[touch(1)](http://linux.die.net/man/1/touch)*.
+function _touch(opts, files) {
+ opts = common.parseOptions(opts, {
+ 'a': 'atime_only',
+ 'c': 'no_create',
+ 'd': 'date',
+ 'm': 'mtime_only',
+ 'r': 'reference',
+ });
+
+ if (!files) {
+ common.error('no paths given');
+ }
+
+ if (Array.isArray(files)) {
+ files.forEach(function(f) {
+ touchFile(opts, f);
+ });
+ } else if (typeof files === 'string') {
+ touchFile(opts, files);
+ } else {
+ common.error('file arg should be a string file path or an Array of string file paths');
+ }
+
+}
+
+function touchFile(opts, file) {
+ var stat = tryStatFile(file);
+
+ if (stat && stat.isDirectory()) {
+ // don't error just exit
+ return;
+ }
+
+ // if the file doesn't already exist and the user has specified --no-create then
+ // this script is finished
+ if (!stat && opts.no_create) {
+ return;
+ }
+
+ // open the file and then close it. this will create it if it doesn't exist but will
+ // not truncate the file
+ fs.closeSync(fs.openSync(file, 'a'));
+
+ //
+ // Set timestamps
+ //
+
+ // setup some defaults
+ var now = new Date();
+ var mtime = opts.date || now;
+ var atime = opts.date || now;
+
+ // use reference file
+ if (opts.reference) {
+ var refStat = tryStatFile(opts.reference);
+ if (!refStat) {
+ common.error('failed to get attributess of ' + opts.reference);
+ }
+ mtime = refStat.mtime;
+ atime = refStat.atime;
+ } else if (opts.date) {
+ mtime = opts.date;
+ atime = opts.date;
+ }
+
+ if (opts.atime_only && opts.mtime_only) {
+ // keep the new values of mtime and atime like GNU
+ } else if (opts.atime_only) {
+ mtime = stat.mtime;
+ } else if (opts.mtime_only) {
+ atime = stat.atime;
+ }
+
+ fs.utimesSync(file, atime, mtime);
+}
+
+module.exports = _touch;
+
+function tryStatFile(filePath) {
+ try {
+ return fs.statSync(filePath);
+ } catch (e) {
+ return null;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cordova-browser/blob/012b9d3b/node_modules/shelljs/src/which.js
----------------------------------------------------------------------
diff --git a/node_modules/shelljs/src/which.js b/node_modules/shelljs/src/which.js
new file mode 100644
index 0000000..d17634e
--- /dev/null
+++ b/node_modules/shelljs/src/which.js
@@ -0,0 +1,98 @@
+var common = require('./common');
+var fs = require('fs');
+var path = require('path');
+
+// XP's system default value for PATHEXT system variable, just in case it's not
+// set on Windows.
+var XP_DEFAULT_PATHEXT = '.com;.exe;.bat;.cmd;.vbs;.vbe;.js;.jse;.wsf;.wsh';
+
+// Cross-platform method for splitting environment PATH variables
+function splitPath(p) {
+ if (!p)
+ return [];
+
+ if (common.platform === 'win')
+ return p.split(';');
+ else
+ return p.split(':');
+}
+
+function checkPath(path) {
+ return fs.existsSync(path) && !fs.statSync(path).isDirectory();
+}
+
+//@
+//@ ### which(command)
+//@
+//@ Examples:
+//@
+//@ ```javascript
+//@ var nodeExec = which('node');
+//@ ```
+//@
+//@ Searches for `command` in the system's PATH. On Windows, this uses the
+//@ `PATHEXT` variable to append the extension if it's not already executable.
+//@ 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 (common.platform === 'win') {
+ attempt = attempt.toUpperCase();
+
+ // In case the PATHEXT variable is somehow not set (e.g.
+ // child_process.spawn with an empty environment), use the XP default.
+ var pathExtEnv = process.env.PATHEXT || XP_DEFAULT_PATHEXT;
+ var pathExtArray = splitPath(pathExtEnv.toUpperCase());
+ var i;
+
+ // If the extension is already in PATHEXT, just return that.
+ for (i = 0; i < pathExtArray.length; i++) {
+ var ext = pathExtArray[i];
+ if (attempt.slice(-ext.length) === ext && checkPath(attempt)) {
+ where = attempt;
+ return;
+ }
+ }
+
+ // Cycle through the PATHEXT variable
+ var baseAttempt = attempt;
+ for (i = 0; i < pathExtArray.length; i++) {
+ attempt = baseAttempt + pathExtArray[i];
+ if (checkPath(attempt)) {
+ where = attempt;
+ return;
+ }
+ }
+ } else {
+ // Assume it's Unix-like
+ if (checkPath(attempt)) {
+ where = attempt;
+ return;
+ }
+ }
+ });
+ }
+
+ // Command not found anywhere?
+ if (!checkPath(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-browser/blob/012b9d3b/node_modules/shelljs/test/.npmignore
----------------------------------------------------------------------
diff --git a/node_modules/shelljs/test/.npmignore b/node_modules/shelljs/test/.npmignore
deleted file mode 100644
index a1632ab..0000000
--- a/node_modules/shelljs/test/.npmignore
+++ /dev/null
@@ -1,2 +0,0 @@
-tmp/
-
http://git-wip-us.apache.org/repos/asf/cordova-browser/blob/012b9d3b/node_modules/shelljs/test/cat.js
----------------------------------------------------------------------
diff --git a/node_modules/shelljs/test/cat.js b/node_modules/shelljs/test/cat.js
deleted file mode 100644
index d0d9ddb..0000000
--- a/node_modules/shelljs/test/cat.js
+++ /dev/null
@@ -1,57 +0,0 @@
-var shell = require('..');
-
-var assert = require('assert'),
- path = require('path'),
- fs = require('fs');
-
-// Node shims for < v0.7
-fs.existsSync = fs.existsSync || path.existsSync;
-
-shell.config.silent = true;
-
-function numLines(str) {
- return typeof str === 'string' ? str.match(/\n/g).length : 0;
-}
-
-// save current dir
-var cur = shell.pwd();
-
-shell.rm('-rf', 'tmp');
-shell.mkdir('tmp');
-
-//
-// Invalids
-//
-
-shell.cat();
-assert.ok(shell.error());
-
-assert.equal(fs.existsSync('/asdfasdf'), false); // sanity check
-shell.cat('/adsfasdf'); // file does not exist
-assert.ok(shell.error());
-
-//
-// Valids
-//
-
-// simple
-var result = shell.cat('resources/file1');
-assert.equal(shell.error(), null);
-assert.equal(result, 'test1');
-
-// multiple files
-var result = shell.cat('resources/file2', 'resources/file1');
-assert.equal(shell.error(), null);
-assert.equal(result, 'test2\ntest1');
-
-// multiple files, array syntax
-var result = shell.cat(['resources/file2', 'resources/file1']);
-assert.equal(shell.error(), null);
-assert.equal(result, 'test2\ntest1');
-
-var result = shell.cat('resources/file*.txt');
-assert.equal(shell.error(), null);
-assert.ok(result.search('test1') > -1); // file order might be random
-assert.ok(result.search('test2') > -1);
-
-shell.exit(123);
http://git-wip-us.apache.org/repos/asf/cordova-browser/blob/012b9d3b/node_modules/shelljs/test/cd.js
----------------------------------------------------------------------
diff --git a/node_modules/shelljs/test/cd.js b/node_modules/shelljs/test/cd.js
deleted file mode 100644
index e6f6c38..0000000
--- a/node_modules/shelljs/test/cd.js
+++ /dev/null
@@ -1,64 +0,0 @@
-var shell = require('..');
-
-var assert = require('assert'),
- path = require('path'),
- fs = require('fs');
-
-// Node shims for < v0.7
-fs.existsSync = fs.existsSync || path.existsSync;
-
-shell.config.silent = true;
-
-function numLines(str) {
- return typeof str === 'string' ? str.match(/\n/g).length : 0;
-}
-
-// save current dir
-var cur = shell.pwd();
-
-shell.rm('-rf', 'tmp');
-shell.mkdir('tmp');
-
-//
-// Invalids
-//
-
-shell.cd();
-assert.ok(shell.error());
-
-assert.equal(fs.existsSync('/asdfasdf'), false); // sanity check
-shell.cd('/adsfasdf'); // dir does not exist
-assert.ok(shell.error());
-
-assert.equal(fs.existsSync('resources/file1'), true); // sanity check
-shell.cd('resources/file1'); // file, not dir
-assert.ok(shell.error());
-
-//
-// Valids
-//
-
-shell.cd(cur);
-shell.cd('tmp');
-assert.equal(shell.error(), null);
-assert.equal(path.basename(process.cwd()), 'tmp');
-
-shell.cd(cur);
-shell.cd('/');
-assert.equal(shell.error(), null);
-assert.equal(process.cwd(), path.resolve('/'));
-
-// cd + other commands
-
-shell.cd(cur);
-shell.rm('-f', 'tmp/*');
-assert.equal(fs.existsSync('tmp/file1'), false);
-shell.cd('resources');
-assert.equal(shell.error(), null);
-shell.cp('file1', '../tmp');
-assert.equal(shell.error(), null);
-shell.cd('../tmp');
-assert.equal(shell.error(), null);
-assert.equal(fs.existsSync('file1'), true);
-
-shell.exit(123);
http://git-wip-us.apache.org/repos/asf/cordova-browser/blob/012b9d3b/node_modules/shelljs/test/chmod.js
----------------------------------------------------------------------
diff --git a/node_modules/shelljs/test/chmod.js b/node_modules/shelljs/test/chmod.js
deleted file mode 100644
index b31e25e..0000000
--- a/node_modules/shelljs/test/chmod.js
+++ /dev/null
@@ -1,81 +0,0 @@
-var shell = require('..');
-
-var assert = require('assert'),
- path = require('path'),
- fs = require('fs');
-
-shell.config.silent = true;
-
-//
-// Invalids
-//
-
-shell.chmod('blah'); // missing args
-assert.ok(shell.error());
-shell.chmod('893', 'resources/chmod'); // invalid permissions - mode must be in octal
-assert.ok(shell.error());
-
-//
-// Valids
-//
-
-// Test files - the bitmasking is to ignore the upper bits.
-shell.chmod('755', 'resources/chmod/file1');
-assert.equal(fs.statSync('resources/chmod/file1').mode & parseInt('777', 8), parseInt('755', 8));
-shell.chmod('644', 'resources/chmod/file1');
-assert.equal(fs.statSync('resources/chmod/file1').mode & parseInt('777', 8), parseInt('644', 8));
-
-shell.chmod('o+x', 'resources/chmod/file1');
-assert.equal(fs.statSync('resources/chmod/file1').mode & parseInt('007', 8), parseInt('005', 8));
-shell.chmod('644', 'resources/chmod/file1');
-
-shell.chmod('+x', 'resources/chmod/file1');
-assert.equal(fs.statSync('resources/chmod/file1').mode & parseInt('777', 8), parseInt('755', 8));
-shell.chmod('644', 'resources/chmod/file1');
-
-// Test setuid
-shell.chmod('u+s', 'resources/chmod/file1');
-assert.equal(fs.statSync('resources/chmod/file1').mode & parseInt('4000', 8), parseInt('4000', 8));
-shell.chmod('u-s', 'resources/chmod/file1');
-assert.equal(fs.statSync('resources/chmod/file1').mode & parseInt('777', 8), parseInt('644', 8));
-
-// according to POSIX standards at http://linux.die.net/man/1/chmod,
-// setuid is never cleared from a directory unless explicitly asked for.
-shell.chmod('u+s', 'resources/chmod/c');
-shell.chmod('755', 'resources/chmod/c');
-assert.equal(fs.statSync('resources/chmod/c').mode & parseInt('4000', 8), parseInt('4000', 8));
-shell.chmod('u-s', 'resources/chmod/c');
-
-// Test setgid
-shell.chmod('g+s', 'resources/chmod/file1');
-assert.equal(fs.statSync('resources/chmod/file1').mode & parseInt('2000', 8), parseInt('2000', 8));
-shell.chmod('g-s', 'resources/chmod/file1');
-assert.equal(fs.statSync('resources/chmod/file1').mode & parseInt('777', 8), parseInt('644', 8));
-
-// Test sticky bit
-shell.chmod('+t', 'resources/chmod/file1');
-assert.equal(fs.statSync('resources/chmod/file1').mode & parseInt('1000', 8), parseInt('1000', 8));
-shell.chmod('-t', 'resources/chmod/file1');
-assert.equal(fs.statSync('resources/chmod/file1').mode & parseInt('777', 8), parseInt('644', 8));
-assert.equal(fs.statSync('resources/chmod/file1').mode & parseInt('1000', 8), 0);
-
-// Test directories
-shell.chmod('a-w', 'resources/chmod/b/a/b');
-assert.equal(fs.statSync('resources/chmod/b/a/b').mode & parseInt('777', 8), parseInt('555', 8));
-shell.chmod('755', 'resources/chmod/b/a/b');
-
-// Test recursion
-shell.chmod('-R', 'a+w', 'resources/chmod/b');
-assert.equal(fs.statSync('resources/chmod/b/a/b').mode & parseInt('777', 8), parseInt('777', 8));
-shell.chmod('-R', '755', 'resources/chmod/b');
-assert.equal(fs.statSync('resources/chmod/b/a/b').mode & parseInt('777', 8), parseInt('755', 8));
-
-// Test symbolic links w/ recursion - WARNING: *nix only
-fs.symlinkSync('resources/chmod/b/a', 'resources/chmod/a/b/c/link', 'dir');
-shell.chmod('-R', 'u-w', 'resources/chmod/a/b');
-assert.equal(fs.statSync('resources/chmod/a/b/c').mode & parseInt('700', 8), parseInt('500', 8));
-assert.equal(fs.statSync('resources/chmod/b/a').mode & parseInt('700', 8), parseInt('700', 8));
-shell.chmod('-R', 'u+w', 'resources/chmod/a/b');
-fs.unlinkSync('resources/chmod/a/b/c/link');
-
-shell.exit(123);
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-browser/blob/012b9d3b/node_modules/shelljs/test/config.js
----------------------------------------------------------------------
diff --git a/node_modules/shelljs/test/config.js b/node_modules/shelljs/test/config.js
deleted file mode 100644
index bd81ec0..0000000
--- a/node_modules/shelljs/test/config.js
+++ /dev/null
@@ -1,50 +0,0 @@
-var shell = require('..');
-
-var assert = require('assert'),
- child = require('child_process');
-
-function numLines(str) {
- return typeof str === 'string' ? str.match(/\n/g).length : 0;
-}
-
-//
-// config.silent
-//
-
-assert.equal(shell.config.silent, false); // default
-
-shell.config.silent = true;
-assert.equal(shell.config.silent, true);
-
-shell.config.silent = false;
-assert.equal(shell.config.silent, false);
-
-//
-// config.fatal
-//
-
-assert.equal(shell.config.fatal, false); // default
-
-//
-// config.fatal = false
-//
-shell.mkdir('-p', 'tmp');
-var file = 'tmp/tempscript'+Math.random()+'.js',
- script = 'require(\'../../global.js\'); config.silent=true; config.fatal=false; cp("this_file_doesnt_exist", "."); echo("got here");';
-script.to(file);
-child.exec('node '+file, function(err, stdout, stderr) {
- assert.ok(stdout.match('got here'));
-
- //
- // config.fatal = true
- //
- shell.mkdir('-p', 'tmp');
- var file = 'tmp/tempscript'+Math.random()+'.js',
- script = 'require(\'../../global.js\'); config.silent=true; config.fatal=true; cp("this_file_doesnt_exist", "."); echo("got here");';
- script.to(file);
- child.exec('node '+file, function(err, stdout, stderr) {
- assert.ok(!stdout.match('got here'));
-
- shell.exit(123);
- });
-});
http://git-wip-us.apache.org/repos/asf/cordova-browser/blob/012b9d3b/node_modules/shelljs/test/cp.js
----------------------------------------------------------------------
diff --git a/node_modules/shelljs/test/cp.js b/node_modules/shelljs/test/cp.js
deleted file mode 100644
index 39b3ba9..0000000
--- a/node_modules/shelljs/test/cp.js
+++ /dev/null
@@ -1,143 +0,0 @@
-var shell = require('..');
-
-var assert = require('assert'),
- path = require('path'),
- fs = require('fs');
-
-// Node shims for < v0.7
-fs.existsSync = fs.existsSync || path.existsSync;
-
-shell.config.silent = true;
-
-function numLines(str) {
- return typeof str === 'string' ? str.match(/\n/g).length : 0;
-}
-
-shell.rm('-rf', 'tmp');
-shell.mkdir('tmp');
-
-//
-// Invalids
-//
-
-shell.cp();
-assert.ok(shell.error());
-
-shell.cp('file1');
-assert.ok(shell.error());
-
-shell.cp('-f');
-assert.ok(shell.error());
-
-shell.rm('-rf', 'tmp/*');
-shell.cp('-@', 'resources/file1', 'tmp/file1'); // option not supported, files OK
-assert.ok(shell.error());
-assert.equal(fs.existsSync('tmp/file1'), false);
-
-shell.cp('-Z', 'asdfasdf', 'tmp/file2'); // option not supported, files NOT OK
-assert.ok(shell.error());
-assert.equal(fs.existsSync('tmp/file2'), false);
-
-shell.cp('asdfasdf', 'tmp'); // source does not exist
-assert.ok(shell.error());
-assert.equal(numLines(shell.error()), 1);
-assert.equal(fs.existsSync('tmp/asdfasdf'), false);
-
-shell.cp('asdfasdf1', 'asdfasdf2', 'tmp'); // sources do not exist
-assert.ok(shell.error());
-assert.equal(numLines(shell.error()), 2);
-assert.equal(fs.existsSync('tmp/asdfasdf1'), false);
-assert.equal(fs.existsSync('tmp/asdfasdf2'), false);
-
-shell.cp('asdfasdf1', 'asdfasdf2', 'resources/file1'); // too many sources (dest is file)
-assert.ok(shell.error());
-
-shell.cp('resources/file1', 'resources/file2'); // dest already exists
-assert.ok(shell.error());
-
-shell.cp('resources/file1', 'resources/file2', 'tmp/a_file'); // too many sources
-assert.ok(shell.error());
-assert.equal(fs.existsSync('tmp/a_file'), false);
-
-//
-// Valids
-//
-
-// simple - to dir
-shell.cp('resources/file1', 'tmp');
-assert.equal(shell.error(), null);
-assert.equal(fs.existsSync('tmp/file1'), true);
-
-// simple - to file
-shell.cp('resources/file2', 'tmp/file2');
-assert.equal(shell.error(), null);
-assert.equal(fs.existsSync('tmp/file2'), true);
-
-// simple - file list
-shell.rm('-rf', 'tmp/*');
-shell.cp('resources/file1', 'resources/file2', 'tmp');
-assert.equal(shell.error(), null);
-assert.equal(fs.existsSync('tmp/file1'), true);
-assert.equal(fs.existsSync('tmp/file2'), true);
-
-// simple - file list, array syntax
-shell.rm('-rf', 'tmp/*');
-shell.cp(['resources/file1', 'resources/file2'], 'tmp');
-assert.equal(shell.error(), null);
-assert.equal(fs.existsSync('tmp/file1'), true);
-assert.equal(fs.existsSync('tmp/file2'), true);
-
-shell.cp('resources/file2', 'tmp/file3');
-assert.equal(fs.existsSync('tmp/file3'), true);
-shell.cp('-f', 'resources/file2', 'tmp/file3'); // file exists, but -f specified
-assert.equal(shell.error(), null);
-assert.equal(fs.existsSync('tmp/file3'), true);
-
-// wildcard
-shell.rm('tmp/file1', 'tmp/file2');
-shell.cp('resources/file*', 'tmp');
-assert.equal(shell.error(), null);
-assert.equal(fs.existsSync('tmp/file1'), true);
-assert.equal(fs.existsSync('tmp/file2'), true);
-
-//recursive, nothing exists
-shell.rm('-rf', 'tmp/*');
-shell.cp('-R', 'resources/cp', 'tmp');
-assert.equal(shell.error(), null);
-assert.equal(shell.ls('-R', 'resources/cp') + '', shell.ls('-R', 'tmp/cp') + '');
-
-//recursive, nothing exists, source ends in '/' (see Github issue #15)
-shell.rm('-rf', 'tmp/*');
-shell.cp('-R', 'resources/cp/', 'tmp/');
-assert.equal(shell.error(), null);
-assert.equal(shell.ls('-R', 'resources/cp') + '', shell.ls('-R', 'tmp') + '');
-
-//recursive, everything exists, no force flag
-shell.rm('-rf', 'tmp/*');
-shell.cp('-R', 'resources/cp', 'tmp');
-shell.cp('-R', 'resources/cp', 'tmp');
-assert.equal(shell.error(), null); // crash test only
-
-//recursive, everything exists, with force flag
-shell.rm('-rf', 'tmp/*');
-shell.cp('-R', 'resources/cp', 'tmp');
-'changing things around'.to('tmp/cp/dir_a/z');
-assert.notEqual(shell.cat('resources/cp/dir_a/z'), shell.cat('tmp/cp/dir_a/z')); // before cp
-shell.cp('-Rf', 'resources/cp', 'tmp');
-assert.equal(shell.error(), null);
-assert.equal(shell.cat('resources/cp/dir_a/z'), shell.cat('tmp/cp/dir_a/z')); // after cp
-
-//recursive, creates dest dir since it's only one level deep (see Github issue #44)
-shell.rm('-rf', 'tmp/*');
-shell.cp('-r', 'resources/issue44/*', 'tmp/dir2');
-assert.equal(shell.error(), null);
-assert.equal(shell.ls('-R', 'resources/issue44') + '', shell.ls('-R', 'tmp/dir2') + '');
-assert.equal(shell.cat('resources/issue44/main.js'), shell.cat('tmp/dir2/main.js'));
-
-//recursive, does *not* create dest dir since it's too deep (see Github issue #44)
-shell.rm('-rf', 'tmp/*');
-shell.cp('-r', 'resources/issue44/*', 'tmp/dir2/dir3');
-assert.ok(shell.error());
-assert.equal(fs.existsSync('tmp/dir2'), false);
-
-shell.exit(123);
http://git-wip-us.apache.org/repos/asf/cordova-browser/blob/012b9d3b/node_modules/shelljs/test/dirs.js
----------------------------------------------------------------------
diff --git a/node_modules/shelljs/test/dirs.js b/node_modules/shelljs/test/dirs.js
deleted file mode 100644
index e9f11e6..0000000
--- a/node_modules/shelljs/test/dirs.js
+++ /dev/null
@@ -1,37 +0,0 @@
-var shell = require('..');
-
-var assert = require('assert'),
- path = require('path'),
- fs = require('fs');
-
-// Node shims for < v0.7
-fs.existsSync = fs.existsSync || path.existsSync;
-
-shell.config.silent = true;
-
-var root = path.resolve();
-
-shell.pushd('resources/pushd');
-shell.pushd('a');
-
-var trail = [
- path.resolve(root, 'resources/pushd/a'),
- path.resolve(root, 'resources/pushd'),
- root
-];
-
-assert.deepEqual(shell.dirs(), trail);
-
-// Single items
-assert.equal(shell.dirs('+0'), trail[0]);
-assert.equal(shell.dirs('+1'), trail[1]);
-assert.equal(shell.dirs('+2'), trail[2]);
-assert.equal(shell.dirs('-0'), trail[2]);
-assert.equal(shell.dirs('-1'), trail[1]);
-assert.equal(shell.dirs('-2'), trail[0]);
-
-// Clearing items
-assert.deepEqual(shell.dirs('-c'), []);
-assert(!shell.error());
-
-shell.exit(123);
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-browser/blob/012b9d3b/node_modules/shelljs/test/echo.js
----------------------------------------------------------------------
diff --git a/node_modules/shelljs/test/echo.js b/node_modules/shelljs/test/echo.js
deleted file mode 100644
index 82faa51..0000000
--- a/node_modules/shelljs/test/echo.js
+++ /dev/null
@@ -1,50 +0,0 @@
-var shell = require('..');
-
-var assert = require('assert'),
- path = require('path'),
- fs = require('fs'),
- child = require('child_process');
-
-// Node shims for < v0.7
-fs.existsSync = fs.existsSync || path.existsSync;
-
-shell.config.silent = true;
-
-function numLines(str) {
- return typeof str === 'string' ? str.match(/\n/g).length : 0;
-}
-
-shell.rm('-rf', 'tmp');
-shell.mkdir('tmp');
-
-//
-// Valids
-//
-
-
-// From here on we use child.exec() to intercept the stdout
-
-
-// simple test with defaults
-shell.mkdir('-p', 'tmp');
-var file = 'tmp/tempscript'+Math.random()+'.js',
- script = 'require(\'../../global.js\'); echo("-asdf", "111");'; // test '-' bug (see issue #20)
-script.to(file);
-child.exec('node '+file, function(err, stdout, stderr) {
- assert.ok(stdout === '-asdf 111\n' || stdout === '-asdf 111\nundefined\n'); // 'undefined' for v0.4
-
- // simple test with silent(true)
- shell.mkdir('-p', 'tmp');
- var file = 'tmp/tempscript'+Math.random()+'.js',
- script = 'require(\'../../global.js\'); config.silent=true; echo(555);';
- script.to(file);
- child.exec('node '+file, function(err, stdout, stderr) {
- assert.ok(stdout === '555\n' || stdout === '555\nundefined\n'); // 'undefined' for v0.4
-
- theEnd();
- });
-});
-
-function theEnd() {
- shell.exit(123);
-}
http://git-wip-us.apache.org/repos/asf/cordova-browser/blob/012b9d3b/node_modules/shelljs/test/env.js
----------------------------------------------------------------------
diff --git a/node_modules/shelljs/test/env.js b/node_modules/shelljs/test/env.js
deleted file mode 100644
index 0e041d6..0000000
--- a/node_modules/shelljs/test/env.js
+++ /dev/null
@@ -1,19 +0,0 @@
-var shell = require('..');
-
-var assert = require('assert');
-
-shell.config.silent = true;
-
-shell.rm('-rf', 'tmp');
-shell.mkdir('tmp');
-
-//
-// Valids
-//
-
-assert.equal(shell.env['PATH'], process.env['PATH']);
-
-shell.env['SHELLJS_TEST'] = 'hello world';
-assert.equal(shell.env['SHELLJS_TEST'], process.env['SHELLJS_TEST']);
-
-shell.exit(123);
http://git-wip-us.apache.org/repos/asf/cordova-browser/blob/012b9d3b/node_modules/shelljs/test/exec.js
----------------------------------------------------------------------
diff --git a/node_modules/shelljs/test/exec.js b/node_modules/shelljs/test/exec.js
deleted file mode 100644
index e721808..0000000
--- a/node_modules/shelljs/test/exec.js
+++ /dev/null
@@ -1,109 +0,0 @@
-var shell = require('..');
-
-var assert = require('assert'),
- path = require('path'),
- fs = require('fs'),
- util = require('util'),
- child = require('child_process');
-
-shell.config.silent = true;
-
-function numLines(str) {
- return typeof str === 'string' ? str.match(/\n/g).length : 0;
-}
-
-//
-// Invalids
-//
-
-shell.exec();
-assert.ok(shell.error());
-
-var result = shell.exec('asdfasdf'); // could not find command
-assert.ok(result.code > 0);
-
-
-//
-// Valids
-//
-
-//
-// sync
-//
-
-// check if stdout goes to output
-var result = shell.exec('node -e \"console.log(1234);\"');
-assert.equal(shell.error(), null);
-assert.equal(result.code, 0);
-assert.ok(result.output === '1234\n' || result.output === '1234\nundefined\n'); // 'undefined' for v0.4
-
-// check if stderr goes to output
-var result = shell.exec('node -e \"console.error(1234);\"');
-assert.equal(shell.error(), null);
-assert.equal(result.code, 0);
-assert.ok(result.output === '1234\n' || result.output === '1234\nundefined\n'); // 'undefined' for v0.4
-
-// check if stdout + stderr go to output
-var result = shell.exec('node -e \"console.error(1234); console.log(666);\"');
-assert.equal(shell.error(), null);
-assert.equal(result.code, 0);
-assert.ok(result.output === '1234\n666\n' || result.output === '1234\n666\nundefined\n'); // 'undefined' for v0.4
-
-// check exit code
-var result = shell.exec('node -e \"process.exit(12);\"');
-assert.equal(shell.error(), null);
-assert.equal(result.code, 12);
-
-// interaction with cd
-shell.cd('resources/external');
-var result = shell.exec('node node_script.js');
-assert.equal(shell.error(), null);
-assert.equal(result.code, 0);
-assert.equal(result.output, 'node_script_1234\n');
-shell.cd('../..');
-
-// check quotes escaping
-var result = shell.exec( util.format('node -e "console.log(%s);"', "\\\"\\'+\\'_\\'+\\'\\\"") );
-assert.equal(shell.error(), null);
-assert.equal(result.code, 0);
-assert.equal(result.output, "'+'_'+'\n");
-
-//
-// async
-//
-
-// no callback
-var c = shell.exec('node -e \"console.log(1234)\"', {async:true});
-assert.equal(shell.error(), null);
-assert.ok('stdout' in c, 'async exec returns child process object');
-
-//
-// callback as 2nd argument
-//
-shell.exec('node -e \"console.log(5678);\"', function(code, output) {
- assert.equal(code, 0);
- assert.ok(output === '5678\n' || output === '5678\nundefined\n'); // 'undefined' for v0.4
-
- //
- // callback as 3rd argument
- //
- shell.exec('node -e \"console.log(5566);\"', {async:true}, function(code, output) {
- assert.equal(code, 0);
- assert.ok(output === '5566\n' || output === '5566\nundefined\n'); // 'undefined' for v0.4
-
- //
- // callback as 3rd argument (slient:true)
- //
- shell.exec('node -e \"console.log(5678);\"', {silent:true}, function(code, output) {
- assert.equal(code, 0);
- assert.ok(output === '5678\n' || output === '5678\nundefined\n'); // 'undefined' for v0.4
-
- shell.exit(123);
-
- });
-
- });
-
-});
-
-assert.equal(shell.error(), null);
http://git-wip-us.apache.org/repos/asf/cordova-browser/blob/012b9d3b/node_modules/shelljs/test/find.js
----------------------------------------------------------------------
diff --git a/node_modules/shelljs/test/find.js b/node_modules/shelljs/test/find.js
deleted file mode 100644
index d375f86..0000000
--- a/node_modules/shelljs/test/find.js
+++ /dev/null
@@ -1,56 +0,0 @@
-var shell = require('..');
-
-var assert = require('assert'),
- path = require('path'),
- fs = require('fs');
-
-// Node shims for < v0.7
-fs.existsSync = fs.existsSync || path.existsSync;
-
-shell.config.silent = true;
-
-shell.rm('-rf', 'tmp');
-shell.mkdir('tmp');
-
-//
-// Invalids
-//
-
-var result = shell.find(); // no paths given
-assert.ok(shell.error());
-
-//
-// Valids
-//
-
-// current path
-shell.cd('resources/find');
-var result = shell.find('.');
-assert.equal(shell.error(), null);
-assert.equal(result.indexOf('.hidden') > -1, true);
-assert.equal(result.indexOf('dir1/dir11/a_dir11') > -1, true);
-assert.equal(result.length, 11);
-shell.cd('../..');
-
-// simple path
-var result = shell.find('resources/find');
-assert.equal(shell.error(), null);
-assert.equal(result.indexOf('resources/find/.hidden') > -1, true);
-assert.equal(result.indexOf('resources/find/dir1/dir11/a_dir11') > -1, true);
-assert.equal(result.length, 11);
-
-// multiple paths - comma
-var result = shell.find('resources/find/dir1', 'resources/find/dir2');
-assert.equal(shell.error(), null);
-assert.equal(result.indexOf('resources/find/dir1/dir11/a_dir11') > -1, true);
-assert.equal(result.indexOf('resources/find/dir2/a_dir1') > -1, true);
-assert.equal(result.length, 6);
-
-// multiple paths - array
-var result = shell.find(['resources/find/dir1', 'resources/find/dir2']);
-assert.equal(shell.error(), null);
-assert.equal(result.indexOf('resources/find/dir1/dir11/a_dir11') > -1, true);
-assert.equal(result.indexOf('resources/find/dir2/a_dir1') > -1, true);
-assert.equal(result.length, 6);
-
-shell.exit(123);
http://git-wip-us.apache.org/repos/asf/cordova-browser/blob/012b9d3b/node_modules/shelljs/test/grep.js
----------------------------------------------------------------------
diff --git a/node_modules/shelljs/test/grep.js b/node_modules/shelljs/test/grep.js
deleted file mode 100644
index 71db982..0000000
--- a/node_modules/shelljs/test/grep.js
+++ /dev/null
@@ -1,59 +0,0 @@
-var shell = require('..');
-
-var assert = require('assert'),
- path = require('path'),
- fs = require('fs');
-
-// Node shims for < v0.7
-fs.existsSync = fs.existsSync || path.existsSync;
-
-shell.config.silent = true;
-
-function numLines(str) {
- return typeof str === 'string' ? str.match(/\n/g).length : 0;
-}
-
-shell.rm('-rf', 'tmp');
-shell.mkdir('tmp');
-
-//
-// Invalids
-//
-
-shell.grep();
-assert.ok(shell.error());
-
-shell.grep(/asdf/g); // too few args
-assert.ok(shell.error());
-
-assert.equal(fs.existsSync('/asdfasdf'), false); // sanity check
-shell.grep(/asdf/g, '/asdfasdf'); // no such file
-assert.ok(shell.error());
-
-//
-// Valids
-//
-
-var result = shell.grep('line', 'resources/a.txt');
-assert.equal(shell.error(), null);
-assert.equal(result.split('\n').length - 1, 4);
-
-var result = shell.grep('-v', 'line', 'resources/a.txt');
-assert.equal(shell.error(), null);
-assert.equal(result.split('\n').length - 1, 8);
-
-var result = shell.grep('line one', 'resources/a.txt');
-assert.equal(shell.error(), null);
-assert.equal(result, 'This is line one\n');
-
-// multiple files
-var result = shell.grep(/test/, 'resources/file1.txt', 'resources/file2.txt');
-assert.equal(shell.error(), null);
-assert.equal(result, 'test1\ntest2\n');
-
-// multiple files, array syntax
-var result = shell.grep(/test/, ['resources/file1.txt', 'resources/file2.txt']);
-assert.equal(shell.error(), null);
-assert.equal(result, 'test1\ntest2\n');
-
-shell.exit(123);
http://git-wip-us.apache.org/repos/asf/cordova-browser/blob/012b9d3b/node_modules/shelljs/test/ls.js
----------------------------------------------------------------------
diff --git a/node_modules/shelljs/test/ls.js b/node_modules/shelljs/test/ls.js
deleted file mode 100644
index 5067b7d..0000000
--- a/node_modules/shelljs/test/ls.js
+++ /dev/null
@@ -1,202 +0,0 @@
-var shell = require('..');
-
-var assert = require('assert'),
- path = require('path'),
- fs = require('fs');
-
-// Node shims for < v0.7
-fs.existsSync = fs.existsSync || path.existsSync;
-
-shell.config.silent = true;
-
-function numLines(str) {
- return typeof str === 'string' ? str.match(/\n/g).length : 0;
-}
-
-shell.rm('-rf', 'tmp');
-shell.mkdir('tmp');
-
-//
-// Invalids
-//
-
-assert.equal(fs.existsSync('/asdfasdf'), false); // sanity check
-var result = shell.ls('/asdfasdf'); // no such file or dir
-assert.ok(shell.error());
-assert.equal(result.length, 0);
-
-//
-// Valids
-//
-
-var result = shell.ls();
-assert.equal(shell.error(), null);
-
-var result = shell.ls('/');
-assert.equal(shell.error(), null);
-
-// no args
-shell.cd('resources/ls');
-var result = shell.ls();
-assert.equal(shell.error(), null);
-assert.equal(result.indexOf('file1') > -1, true);
-assert.equal(result.indexOf('file2') > -1, true);
-assert.equal(result.indexOf('file1.js') > -1, true);
-assert.equal(result.indexOf('file2.js') > -1, true);
-assert.equal(result.indexOf('filename(with)[chars$]^that.must+be-escaped') > -1, true);
-assert.equal(result.indexOf('a_dir') > -1, true);
-assert.equal(result.length, 6);
-shell.cd('../..');
-
-// simple arg
-var result = shell.ls('resources/ls');
-assert.equal(shell.error(), null);
-assert.equal(result.indexOf('file1') > -1, true);
-assert.equal(result.indexOf('file2') > -1, true);
-assert.equal(result.indexOf('file1.js') > -1, true);
-assert.equal(result.indexOf('file2.js') > -1, true);
-assert.equal(result.indexOf('filename(with)[chars$]^that.must+be-escaped') > -1, true);
-assert.equal(result.indexOf('a_dir') > -1, true);
-assert.equal(result.length, 6);
-
-// no args, 'all' option
-shell.cd('resources/ls');
-var result = shell.ls('-A');
-assert.equal(shell.error(), null);
-assert.equal(result.indexOf('file1') > -1, true);
-assert.equal(result.indexOf('file2') > -1, true);
-assert.equal(result.indexOf('file1.js') > -1, true);
-assert.equal(result.indexOf('file2.js') > -1, true);
-assert.equal(result.indexOf('filename(with)[chars$]^that.must+be-escaped') > -1, true);
-assert.equal(result.indexOf('a_dir') > -1, true);
-assert.equal(result.indexOf('.hidden_file') > -1, true);
-assert.equal(result.indexOf('.hidden_dir') > -1, true);
-assert.equal(result.length, 8);
-shell.cd('../..');
-
-// no args, 'all' option
-shell.cd('resources/ls');
-var result = shell.ls('-a'); // (deprecated) backwards compatibility test
-assert.equal(shell.error(), null);
-assert.equal(result.indexOf('file1') > -1, true);
-assert.equal(result.indexOf('file2') > -1, true);
-assert.equal(result.indexOf('file1.js') > -1, true);
-assert.equal(result.indexOf('file2.js') > -1, true);
-assert.equal(result.indexOf('filename(with)[chars$]^that.must+be-escaped') > -1, true);
-assert.equal(result.indexOf('a_dir') > -1, true);
-assert.equal(result.indexOf('.hidden_file') > -1, true);
-assert.equal(result.indexOf('.hidden_dir') > -1, true);
-assert.equal(result.length, 8);
-shell.cd('../..');
-
-// wildcard, simple
-var result = shell.ls('resources/ls/*');
-assert.equal(shell.error(), null);
-assert.equal(result.indexOf('resources/ls/file1') > -1, true);
-assert.equal(result.indexOf('resources/ls/file2') > -1, true);
-assert.equal(result.indexOf('resources/ls/file1.js') > -1, true);
-assert.equal(result.indexOf('resources/ls/file2.js') > -1, true);
-assert.equal(result.indexOf('resources/ls/filename(with)[chars$]^that.must+be-escaped') > -1, true);
-assert.equal(result.indexOf('resources/ls/a_dir') > -1, true);
-assert.equal(result.length, 6);
-
-// wildcard, hidden only
-var result = shell.ls('resources/ls/.*');
-assert.equal(shell.error(), null);
-assert.equal(result.indexOf('resources/ls/.hidden_file') > -1, true);
-assert.equal(result.indexOf('resources/ls/.hidden_dir') > -1, true);
-assert.equal(result.length, 2);
-
-// wildcard, mid-file
-var result = shell.ls('resources/ls/f*le*');
-assert.equal(shell.error(), null);
-assert.equal(result.length, 5);
-assert.equal(result.indexOf('resources/ls/file1') > -1, true);
-assert.equal(result.indexOf('resources/ls/file2') > -1, true);
-assert.equal(result.indexOf('resources/ls/file1.js') > -1, true);
-assert.equal(result.indexOf('resources/ls/file2.js') > -1, true);
-assert.equal(result.indexOf('resources/ls/filename(with)[chars$]^that.must+be-escaped') > -1, true);
-
-// wildcard, mid-file with dot (should escape dot for regex)
-var result = shell.ls('resources/ls/f*le*.js');
-assert.equal(shell.error(), null);
-assert.equal(result.length, 2);
-assert.equal(result.indexOf('resources/ls/file1.js') > -1, true);
-assert.equal(result.indexOf('resources/ls/file2.js') > -1, true);
-
-// wildcard, should not do partial matches
-var result = shell.ls('resources/ls/*.j'); // shouldn't get .js
-assert.equal(shell.error(), null);
-assert.equal(result.length, 0);
-
-// wildcard, all files with extension
-var result = shell.ls('resources/ls/*.*');
-assert.equal(shell.error(), null);
-assert.equal(result.length, 3);
-assert.equal(result.indexOf('resources/ls/file1.js') > -1, true);
-assert.equal(result.indexOf('resources/ls/file2.js') > -1, true);
-assert.equal(result.indexOf('resources/ls/filename(with)[chars$]^that.must+be-escaped') > -1, true);
-
-// wildcard, with additional path
-var result = shell.ls('resources/ls/f*le*.js', 'resources/ls/a_dir');
-assert.equal(shell.error(), null);
-assert.equal(result.length, 4);
-assert.equal(result.indexOf('resources/ls/file1.js') > -1, true);
-assert.equal(result.indexOf('resources/ls/file2.js') > -1, true);
-assert.equal(result.indexOf('b_dir') > -1, true); // no wildcard == no path prefix
-assert.equal(result.indexOf('nada') > -1, true); // no wildcard == no path prefix
-
-// wildcard for both paths
-var result = shell.ls('resources/ls/f*le*.js', 'resources/ls/a_dir/*');
-assert.equal(shell.error(), null);
-assert.equal(result.length, 4);
-assert.equal(result.indexOf('resources/ls/file1.js') > -1, true);
-assert.equal(result.indexOf('resources/ls/file2.js') > -1, true);
-assert.equal(result.indexOf('resources/ls/a_dir/b_dir') > -1, true);
-assert.equal(result.indexOf('resources/ls/a_dir/nada') > -1, true);
-
-// wildcard for both paths, array
-var result = shell.ls(['resources/ls/f*le*.js', 'resources/ls/a_dir/*']);
-assert.equal(shell.error(), null);
-assert.equal(result.length, 4);
-assert.equal(result.indexOf('resources/ls/file1.js') > -1, true);
-assert.equal(result.indexOf('resources/ls/file2.js') > -1, true);
-assert.equal(result.indexOf('resources/ls/a_dir/b_dir') > -1, true);
-assert.equal(result.indexOf('resources/ls/a_dir/nada') > -1, true);
-
-// recursive, no path
-shell.cd('resources/ls');
-var result = shell.ls('-R');
-assert.equal(shell.error(), null);
-assert.equal(result.indexOf('a_dir') > -1, true);
-assert.equal(result.indexOf('a_dir/b_dir') > -1, true);
-assert.equal(result.indexOf('a_dir/b_dir/z') > -1, true);
-assert.equal(result.length, 9);
-shell.cd('../..');
-
-// recusive, path given
-var result = shell.ls('-R', 'resources/ls');
-assert.equal(shell.error(), null);
-assert.equal(result.indexOf('a_dir') > -1, true);
-assert.equal(result.indexOf('a_dir/b_dir') > -1, true);
-assert.equal(result.indexOf('a_dir/b_dir/z') > -1, true);
-assert.equal(result.length, 9);
-
-// recusive, path given - 'all' flag
-var result = shell.ls('-RA', 'resources/ls');
-assert.equal(shell.error(), null);
-assert.equal(result.indexOf('a_dir') > -1, true);
-assert.equal(result.indexOf('a_dir/b_dir') > -1, true);
-assert.equal(result.indexOf('a_dir/b_dir/z') > -1, true);
-assert.equal(result.indexOf('a_dir/.hidden_dir/nada') > -1, true);
-assert.equal(result.length, 14);
-
-// recursive, wildcard
-var result = shell.ls('-R', 'resources/ls/*');
-assert.equal(shell.error(), null);
-assert.equal(result.indexOf('resources/ls/a_dir') > -1, true);
-assert.equal(result.indexOf('resources/ls/a_dir/b_dir') > -1, true);
-assert.equal(result.indexOf('resources/ls/a_dir/b_dir/z') > -1, true);
-assert.equal(result.length, 9);
-
-shell.exit(123);
http://git-wip-us.apache.org/repos/asf/cordova-browser/blob/012b9d3b/node_modules/shelljs/test/make.js
----------------------------------------------------------------------
diff --git a/node_modules/shelljs/test/make.js b/node_modules/shelljs/test/make.js
deleted file mode 100644
index 3edbd8c..0000000
--- a/node_modules/shelljs/test/make.js
+++ /dev/null
@@ -1,20 +0,0 @@
-var shell = require('..'),
- child = require('child_process'),
- assert = require('assert');
-
-shell.mkdir('-p', 'tmp');
-var file = 'tmp/tempscript'+Math.random()+'.js',
- script = 'require(\'../../make.js\');' +
- 'target.all=function(){' +
- ' echo("first"); '+
- ' cp("this_file_doesnt_exist", ".");' +
- ' echo("second");' +
- '}';
-
-script.to(file);
-child.exec('node '+file, function(err, stdout, stderr) {
- assert.ok(stdout.match('first'));
- assert.ok(!stdout.match('second')); // Make should die on errors, so this should never get echoed
-
- shell.exit(123);
-});
http://git-wip-us.apache.org/repos/asf/cordova-browser/blob/012b9d3b/node_modules/shelljs/test/mkdir.js
----------------------------------------------------------------------
diff --git a/node_modules/shelljs/test/mkdir.js b/node_modules/shelljs/test/mkdir.js
deleted file mode 100644
index 1f93422..0000000
--- a/node_modules/shelljs/test/mkdir.js
+++ /dev/null
@@ -1,79 +0,0 @@
-var shell = require('..');
-
-var assert = require('assert'),
- path = require('path'),
- fs = require('fs');
-
-// Node shims for < v0.7
-fs.existsSync = fs.existsSync || path.existsSync;
-
-shell.config.silent = true;
-
-function numLines(str) {
- return typeof str === 'string' ? str.match(/\n/g).length : 0;
-}
-
-shell.rm('-rf', 'tmp');
-shell.mkdir('tmp');
-
-//
-// Invalids
-//
-
-shell.mkdir();
-assert.ok(shell.error());
-
-var mtime = fs.statSync('tmp').mtime.toString();
-shell.mkdir('tmp'); // dir already exists
-assert.ok(shell.error());
-assert.equal(fs.statSync('tmp').mtime.toString(), mtime); // didn't mess with dir
-
-assert.equal(fs.existsSync('/asdfasdf'), false); // sanity check
-shell.mkdir('/asdfasdf/asdfasdf'); // root path does not exist
-assert.ok(shell.error());
-assert.equal(fs.existsSync('/asdfasdf'), false);
-
-//
-// Valids
-//
-
-assert.equal(fs.existsSync('tmp/t1'), false);
-shell.mkdir('tmp/t1'); // simple dir
-assert.equal(shell.error(), null);
-assert.equal(fs.existsSync('tmp/t1'), true);
-
-assert.equal(fs.existsSync('tmp/t2'), false);
-assert.equal(fs.existsSync('tmp/t3'), false);
-shell.mkdir('tmp/t2', 'tmp/t3'); // multiple dirs
-assert.equal(shell.error(), null);
-assert.equal(fs.existsSync('tmp/t2'), true);
-assert.equal(fs.existsSync('tmp/t3'), true);
-
-assert.equal(fs.existsSync('tmp/t1'), true);
-assert.equal(fs.existsSync('tmp/t4'), false);
-shell.mkdir('tmp/t1', 'tmp/t4'); // one dir exists, one doesn't
-assert.equal(numLines(shell.error()), 1);
-assert.equal(fs.existsSync('tmp/t1'), true);
-assert.equal(fs.existsSync('tmp/t4'), true);
-
-assert.equal(fs.existsSync('tmp/a'), false);
-shell.mkdir('-p', 'tmp/a/b/c');
-assert.equal(shell.error(), null);
-assert.equal(fs.existsSync('tmp/a/b/c'), true);
-shell.rm('-Rf', 'tmp/a'); // revert
-
-// multiple dirs
-shell.mkdir('-p', 'tmp/zzza', 'tmp/zzzb', 'tmp/zzzc');
-assert.equal(shell.error(), null);
-assert.equal(fs.existsSync('tmp/zzza'), true);
-assert.equal(fs.existsSync('tmp/zzzb'), true);
-assert.equal(fs.existsSync('tmp/zzzc'), true);
-
-// multiple dirs, array syntax
-shell.mkdir('-p', ['tmp/yyya', 'tmp/yyyb', 'tmp/yyyc']);
-assert.equal(shell.error(), null);
-assert.equal(fs.existsSync('tmp/yyya'), true);
-assert.equal(fs.existsSync('tmp/yyyb'), true);
-assert.equal(fs.existsSync('tmp/yyyc'), true);
-
-shell.exit(123);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org