http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/a7f059c0/node_modules/inflight/inflight.js ---------------------------------------------------------------------- diff --git a/node_modules/inflight/inflight.js b/node_modules/inflight/inflight.js new file mode 100644 index 0000000..8bc96cb --- /dev/null +++ b/node_modules/inflight/inflight.js @@ -0,0 +1,44 @@ +var wrappy = require('wrappy') +var reqs = Object.create(null) +var once = require('once') + +module.exports = wrappy(inflight) + +function inflight (key, cb) { + if (reqs[key]) { + reqs[key].push(cb) + return null + } else { + reqs[key] = [cb] + return makeres(key) + } +} + +function makeres (key) { + return once(function RES () { + var cbs = reqs[key] + var len = cbs.length + var args = slice(arguments) + for (var i = 0; i < len; i++) { + cbs[i].apply(null, args) + } + if (cbs.length > len) { + // added more in the interim. + // de-zalgo, just in case, but don't call again. + cbs.splice(0, len) + process.nextTick(function () { + RES.apply(null, args) + }) + } else { + delete reqs[key] + } + }) +} + +function slice (args) { + var length = args.length + var array = [] + + for (var i = 0; i < length; i++) array[i] = args[i] + return array +}
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/a7f059c0/node_modules/inflight/package.json ---------------------------------------------------------------------- diff --git a/node_modules/inflight/package.json b/node_modules/inflight/package.json new file mode 100644 index 0000000..0f38634 --- /dev/null +++ b/node_modules/inflight/package.json @@ -0,0 +1,86 @@ +{ + "_args": [ + [ + "inflight@^1.0.4", + "/Users/steveng/repo/cordova/cordova-ios/node_modules/glob" + ] + ], + "_from": "inflight@>=1.0.4 <2.0.0", + "_id": "[email protected]", + "_inCache": true, + "_installable": true, + "_location": "/inflight", + "_nodeVersion": "0.10.32", + "_npmUser": { + "email": "[email protected]", + "name": "othiym23" + }, + "_npmVersion": "2.1.3", + "_phantomChildren": {}, + "_requested": { + "name": "inflight", + "raw": "inflight@^1.0.4", + "rawSpec": "^1.0.4", + "scope": null, + "spec": ">=1.0.4 <2.0.0", + "type": "range" + }, + "_requiredBy": [ + "/glob" + ], + "_resolved": "http://registry.npmjs.org/inflight/-/inflight-1.0.4.tgz", + "_shasum": "6cbb4521ebd51ce0ec0a936bfd7657ef7e9b172a", + "_shrinkwrap": null, + "_spec": "inflight@^1.0.4", + "_where": "/Users/steveng/repo/cordova/cordova-ios/node_modules/glob", + "author": { + "email": "[email protected]", + "name": "Isaac Z. Schlueter", + "url": "http://blog.izs.me/" + }, + "bugs": { + "url": "https://github.com/isaacs/inflight/issues" + }, + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + }, + "description": "Add callbacks to requests in flight to avoid async duplication", + "devDependencies": { + "tap": "^0.4.10" + }, + "directories": {}, + "dist": { + "shasum": "6cbb4521ebd51ce0ec0a936bfd7657ef7e9b172a", + "tarball": "http://registry.npmjs.org/inflight/-/inflight-1.0.4.tgz" + }, + "gitHead": "c7b5531d572a867064d4a1da9e013e8910b7d1ba", + "homepage": "https://github.com/isaacs/inflight", + "license": "ISC", + "main": "inflight.js", + "maintainers": [ + { + "name": "isaacs", + "email": "[email protected]" + }, + { + "name": "othiym23", + "email": "[email protected]" + }, + { + "name": "iarna", + "email": "[email protected]" + } + ], + "name": "inflight", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git://github.com/isaacs/inflight.git" + }, + "scripts": { + "test": "tap test.js" + }, + "version": "1.0.4" +} http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/a7f059c0/node_modules/inflight/test.js ---------------------------------------------------------------------- diff --git a/node_modules/inflight/test.js b/node_modules/inflight/test.js new file mode 100644 index 0000000..2bb75b3 --- /dev/null +++ b/node_modules/inflight/test.js @@ -0,0 +1,97 @@ +var test = require('tap').test +var inf = require('./inflight.js') + + +function req (key, cb) { + cb = inf(key, cb) + if (cb) setTimeout(function () { + cb(key) + cb(key) + }) + return cb +} + +test('basic', function (t) { + var calleda = false + var a = req('key', function (k) { + t.notOk(calleda) + calleda = true + t.equal(k, 'key') + if (calledb) t.end() + }) + t.ok(a, 'first returned cb function') + + var calledb = false + var b = req('key', function (k) { + t.notOk(calledb) + calledb = true + t.equal(k, 'key') + if (calleda) t.end() + }) + + t.notOk(b, 'second should get falsey inflight response') +}) + +test('timing', function (t) { + var expect = [ + 'method one', + 'start one', + 'end one', + 'two', + 'tick', + 'three' + ] + var i = 0 + + function log (m) { + t.equal(m, expect[i], m + ' === ' + expect[i]) + ++i + if (i === expect.length) + t.end() + } + + function method (name, cb) { + log('method ' + name) + process.nextTick(cb) + } + + var one = inf('foo', function () { + log('start one') + var three = inf('foo', function () { + log('three') + }) + if (three) method('three', three) + log('end one') + }) + + method('one', one) + + var two = inf('foo', function () { + log('two') + }) + if (two) method('one', two) + + process.nextTick(log.bind(null, 'tick')) +}) + +test('parameters', function (t) { + t.plan(8) + + var a = inf('key', function (first, second, third) { + t.equal(first, 1) + t.equal(second, 2) + t.equal(third, 3) + }) + t.ok(a, 'first returned cb function') + + var b = inf('key', function (first, second, third) { + t.equal(first, 1) + t.equal(second, 2) + t.equal(third, 3) + }) + t.notOk(b, 'second should get falsey inflight response') + + setTimeout(function () { + a(1, 2, 3) + }) +}) http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/a7f059c0/node_modules/inherits/LICENSE ---------------------------------------------------------------------- diff --git a/node_modules/inherits/LICENSE b/node_modules/inherits/LICENSE new file mode 100644 index 0000000..dea3013 --- /dev/null +++ b/node_modules/inherits/LICENSE @@ -0,0 +1,16 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter + +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/a7f059c0/node_modules/inherits/README.md ---------------------------------------------------------------------- diff --git a/node_modules/inherits/README.md b/node_modules/inherits/README.md new file mode 100644 index 0000000..b1c5665 --- /dev/null +++ b/node_modules/inherits/README.md @@ -0,0 +1,42 @@ +Browser-friendly inheritance fully compatible with standard node.js +[inherits](http://nodejs.org/api/util.html#util_util_inherits_constructor_superconstructor). + +This package exports standard `inherits` from node.js `util` module in +node environment, but also provides alternative browser-friendly +implementation through [browser +field](https://gist.github.com/shtylman/4339901). Alternative +implementation is a literal copy of standard one located in standalone +module to avoid requiring of `util`. It also has a shim for old +browsers with no `Object.create` support. + +While keeping you sure you are using standard `inherits` +implementation in node.js environment, it allows bundlers such as +[browserify](https://github.com/substack/node-browserify) to not +include full `util` package to your client code if all you need is +just `inherits` function. It worth, because browser shim for `util` +package is large and `inherits` is often the single function you need +from it. + +It's recommended to use this package instead of +`require('util').inherits` for any code that has chances to be used +not only in node.js but in browser too. + +## usage + +```js +var inherits = require('inherits'); +// then use exactly as the standard one +``` + +## note on version ~1.0 + +Version ~1.0 had completely different motivation and is not compatible +neither with 2.0 nor with standard node.js `inherits`. + +If you are using version ~1.0 and planning to switch to ~2.0, be +careful: + +* new version uses `super_` instead of `super` for referencing + superclass +* new version overwrites current prototype while old one preserves any + existing fields on it http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/a7f059c0/node_modules/inherits/inherits.js ---------------------------------------------------------------------- diff --git a/node_modules/inherits/inherits.js b/node_modules/inherits/inherits.js new file mode 100644 index 0000000..29f5e24 --- /dev/null +++ b/node_modules/inherits/inherits.js @@ -0,0 +1 @@ +module.exports = require('util').inherits http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/a7f059c0/node_modules/inherits/inherits_browser.js ---------------------------------------------------------------------- diff --git a/node_modules/inherits/inherits_browser.js b/node_modules/inherits/inherits_browser.js new file mode 100644 index 0000000..c1e78a7 --- /dev/null +++ b/node_modules/inherits/inherits_browser.js @@ -0,0 +1,23 @@ +if (typeof Object.create === 'function') { + // implementation from standard node.js 'util' module + module.exports = function inherits(ctor, superCtor) { + ctor.super_ = superCtor + ctor.prototype = Object.create(superCtor.prototype, { + constructor: { + value: ctor, + enumerable: false, + writable: true, + configurable: true + } + }); + }; +} else { + // old school shim for old browsers + module.exports = function inherits(ctor, superCtor) { + ctor.super_ = superCtor + var TempCtor = function () {} + TempCtor.prototype = superCtor.prototype + ctor.prototype = new TempCtor() + ctor.prototype.constructor = ctor + } +} http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/a7f059c0/node_modules/inherits/package.json ---------------------------------------------------------------------- diff --git a/node_modules/inherits/package.json b/node_modules/inherits/package.json new file mode 100644 index 0000000..729919d --- /dev/null +++ b/node_modules/inherits/package.json @@ -0,0 +1,77 @@ +{ + "_args": [ + [ + "inherits@2", + "/Users/steveng/repo/cordova/cordova-ios/node_modules/glob" + ] + ], + "_from": "inherits@>=2.0.0 <3.0.0", + "_id": "[email protected]", + "_inCache": true, + "_installable": true, + "_location": "/inherits", + "_npmUser": { + "email": "[email protected]", + "name": "isaacs" + }, + "_npmVersion": "1.3.8", + "_phantomChildren": {}, + "_requested": { + "name": "inherits", + "raw": "inherits@2", + "rawSpec": "2", + "scope": null, + "spec": ">=2.0.0 <3.0.0", + "type": "range" + }, + "_requiredBy": [ + "/glob" + ], + "_resolved": "http://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz", + "_shasum": "b17d08d326b4423e568eff719f91b0b1cbdf69f1", + "_shrinkwrap": null, + "_spec": "inherits@2", + "_where": "/Users/steveng/repo/cordova/cordova-ios/node_modules/glob", + "browser": "./inherits_browser.js", + "bugs": { + "url": "https://github.com/isaacs/inherits/issues" + }, + "dependencies": {}, + "description": "Browser-friendly inheritance fully compatible with standard node.js inherits()", + "devDependencies": {}, + "directories": {}, + "dist": { + "shasum": "b17d08d326b4423e568eff719f91b0b1cbdf69f1", + "tarball": "http://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz" + }, + "homepage": "https://github.com/isaacs/inherits#readme", + "keywords": [ + "browser", + "browserify", + "class", + "inheritance", + "inherits", + "klass", + "object-oriented", + "oop" + ], + "license": "ISC", + "main": "./inherits.js", + "maintainers": [ + { + "name": "isaacs", + "email": "[email protected]" + } + ], + "name": "inherits", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git://github.com/isaacs/inherits.git" + }, + "scripts": { + "test": "node test" + }, + "version": "2.0.1" +} http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/a7f059c0/node_modules/inherits/test.js ---------------------------------------------------------------------- diff --git a/node_modules/inherits/test.js b/node_modules/inherits/test.js new file mode 100644 index 0000000..fc53012 --- /dev/null +++ b/node_modules/inherits/test.js @@ -0,0 +1,25 @@ +var inherits = require('./inherits.js') +var assert = require('assert') + +function test(c) { + assert(c.constructor === Child) + assert(c.constructor.super_ === Parent) + assert(Object.getPrototypeOf(c) === Child.prototype) + assert(Object.getPrototypeOf(Object.getPrototypeOf(c)) === Parent.prototype) + assert(c instanceof Child) + assert(c instanceof Parent) +} + +function Child() { + Parent.call(this) + test(this) +} + +function Parent() {} + +inherits(Child, Parent) + +var c = new Child +test(c) + +console.log('ok') http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/a7f059c0/node_modules/ios-sim/.npmignore ---------------------------------------------------------------------- diff --git a/node_modules/ios-sim/.npmignore b/node_modules/ios-sim/.npmignore new file mode 100644 index 0000000..71ffef6 --- /dev/null +++ b/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/a7f059c0/node_modules/ios-sim/CONTRIBUTING.md ---------------------------------------------------------------------- diff --git a/node_modules/ios-sim/CONTRIBUTING.md b/node_modules/ios-sim/CONTRIBUTING.md new file mode 100644 index 0000000..b132d71 --- /dev/null +++ b/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/a7f059c0/node_modules/ios-sim/LICENSE ---------------------------------------------------------------------- diff --git a/node_modules/ios-sim/LICENSE b/node_modules/ios-sim/LICENSE new file mode 100644 index 0000000..f5768b4 --- /dev/null +++ b/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/a7f059c0/node_modules/ios-sim/README.md ---------------------------------------------------------------------- diff --git a/node_modules/ios-sim/README.md b/node_modules/ios-sim/README.md new file mode 100644 index 0000000..addf3c8 --- /dev/null +++ b/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/a7f059c0/node_modules/ios-sim/bin/ios-sim ---------------------------------------------------------------------- diff --git a/node_modules/ios-sim/bin/ios-sim b/node_modules/ios-sim/bin/ios-sim new file mode 100755 index 0000000..bab9b88 --- /dev/null +++ b/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/a7f059c0/node_modules/ios-sim/bin/ios-sim.cmd ---------------------------------------------------------------------- diff --git a/node_modules/ios-sim/bin/ios-sim.cmd b/node_modules/ios-sim/bin/ios-sim.cmd new file mode 100755 index 0000000..18927ed --- /dev/null +++ b/node_modules/ios-sim/bin/ios-sim.cmd @@ -0,0 +1 @@ +@node "%~dpn0" %* http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/a7f059c0/node_modules/ios-sim/doc/help.txt ---------------------------------------------------------------------- diff --git a/node_modules/ios-sim/doc/help.txt b/node_modules/ios-sim/doc/help.txt new file mode 100644 index 0000000..925a0f8 --- /dev/null +++ b/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/a7f059c0/node_modules/ios-sim/ios-sim.js ---------------------------------------------------------------------- diff --git a/node_modules/ios-sim/ios-sim.js b/node_modules/ios-sim/ios-sim.js new file mode 100644 index 0000000..4547126 --- /dev/null +++ b/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/a7f059c0/node_modules/ios-sim/node_modules/.bin/nopt ---------------------------------------------------------------------- diff --git a/node_modules/ios-sim/node_modules/.bin/nopt b/node_modules/ios-sim/node_modules/.bin/nopt new file mode 120000 index 0000000..6b6566e --- /dev/null +++ b/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/a7f059c0/node_modules/ios-sim/node_modules/bplist-parser/.npmignore ---------------------------------------------------------------------- diff --git a/node_modules/ios-sim/node_modules/bplist-parser/.npmignore b/node_modules/ios-sim/node_modules/bplist-parser/.npmignore new file mode 100644 index 0000000..a9b46ea --- /dev/null +++ b/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/a7f059c0/node_modules/ios-sim/node_modules/bplist-parser/README.md ---------------------------------------------------------------------- diff --git a/node_modules/ios-sim/node_modules/bplist-parser/README.md b/node_modules/ios-sim/node_modules/bplist-parser/README.md new file mode 100644 index 0000000..37e5e1c --- /dev/null +++ b/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/a7f059c0/node_modules/ios-sim/node_modules/bplist-parser/bplistParser.js ---------------------------------------------------------------------- diff --git a/node_modules/ios-sim/node_modules/bplist-parser/bplistParser.js b/node_modules/ios-sim/node_modules/bplist-parser/bplistParser.js new file mode 100644 index 0000000..e818454 --- /dev/null +++ b/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/a7f059c0/node_modules/ios-sim/node_modules/bplist-parser/package.json ---------------------------------------------------------------------- diff --git a/node_modules/ios-sim/node_modules/bplist-parser/package.json b/node_modules/ios-sim/node_modules/bplist-parser/package.json new file mode 100644 index 0000000..ac14385 --- /dev/null +++ b/node_modules/ios-sim/node_modules/bplist-parser/package.json @@ -0,0 +1,78 @@ +{ + "_args": [ + [ + "bplist-parser@^0.0.6", + "/Users/steveng/repo/cordova/cordova-ios/node_modules/ios-sim" + ] + ], + "_from": "bplist-parser@>=0.0.6 <0.0.7", + "_id": "[email protected]", + "_inCache": true, + "_installable": true, + "_location": "/ios-sim/bplist-parser", + "_npmUser": { + "email": "[email protected]", + "name": "joeferner" + }, + "_npmVersion": "1.4.14", + "_phantomChildren": {}, + "_requested": { + "name": "bplist-parser", + "raw": "bplist-parser@^0.0.6", + "rawSpec": "^0.0.6", + "scope": null, + "spec": ">=0.0.6 <0.0.7", + "type": "range" + }, + "_requiredBy": [ + "/ios-sim" + ], + "_resolved": "http://registry.npmjs.org/bplist-parser/-/bplist-parser-0.0.6.tgz", + "_shasum": "38da3471817df9d44ab3892e27707bbbd75a11b9", + "_shrinkwrap": null, + "_spec": "bplist-parser@^0.0.6", + "_where": "/Users/steveng/repo/cordova/cordova-ios/node_modules/ios-sim", + "author": { + "email": "[email protected]", + "name": "Joe Ferner" + }, + "bugs": { + "url": "https://github.com/nearinfinity/node-bplist-parser/issues" + }, + "dependencies": {}, + "description": "Binary plist parser.", + "devDependencies": { + "nodeunit": "~0.7.4" + }, + "directories": {}, + "dist": { + "shasum": "38da3471817df9d44ab3892e27707bbbd75a11b9", + "tarball": "http://registry.npmjs.org/bplist-parser/-/bplist-parser-0.0.6.tgz" + }, + "gitHead": "a2230a5df3c7014ffbe5761bcb091ea2d061b47b", + "homepage": "https://github.com/nearinfinity/node-bplist-parser", + "keywords": [ + "bplist", + "parser", + "plist" + ], + "license": "MIT", + "main": "bplistParser.js", + "maintainers": [ + { + "name": "joeferner", + "email": "[email protected]" + } + ], + "name": "bplist-parser", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git+https://github.com/nearinfinity/node-bplist-parser.git" + }, + "scripts": { + "test": "./node_modules/nodeunit/bin/nodeunit test" + }, + "version": "0.0.6" +} http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/a7f059c0/node_modules/ios-sim/node_modules/bplist-parser/test/airplay.bplist ---------------------------------------------------------------------- diff --git a/node_modules/ios-sim/node_modules/bplist-parser/test/airplay.bplist b/node_modules/ios-sim/node_modules/bplist-parser/test/airplay.bplist new file mode 100644 index 0000000..931adea Binary files /dev/null and b/node_modules/ios-sim/node_modules/bplist-parser/test/airplay.bplist differ http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/a7f059c0/node_modules/ios-sim/node_modules/bplist-parser/test/iTunes-small.bplist ---------------------------------------------------------------------- diff --git a/node_modules/ios-sim/node_modules/bplist-parser/test/iTunes-small.bplist b/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/node_modules/ios-sim/node_modules/bplist-parser/test/iTunes-small.bplist differ http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/a7f059c0/node_modules/ios-sim/node_modules/bplist-parser/test/parseTest.js ---------------------------------------------------------------------- diff --git a/node_modules/ios-sim/node_modules/bplist-parser/test/parseTest.js b/node_modules/ios-sim/node_modules/bplist-parser/test/parseTest.js new file mode 100644 index 0000000..dcb6dd0 --- /dev/null +++ b/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/a7f059c0/node_modules/ios-sim/node_modules/bplist-parser/test/sample1.bplist ---------------------------------------------------------------------- diff --git a/node_modules/ios-sim/node_modules/bplist-parser/test/sample1.bplist b/node_modules/ios-sim/node_modules/bplist-parser/test/sample1.bplist new file mode 100644 index 0000000..5b808ff Binary files /dev/null and b/node_modules/ios-sim/node_modules/bplist-parser/test/sample1.bplist differ http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/a7f059c0/node_modules/ios-sim/node_modules/bplist-parser/test/sample2.bplist ---------------------------------------------------------------------- diff --git a/node_modules/ios-sim/node_modules/bplist-parser/test/sample2.bplist b/node_modules/ios-sim/node_modules/bplist-parser/test/sample2.bplist new file mode 100644 index 0000000..fc42979 Binary files /dev/null and b/node_modules/ios-sim/node_modules/bplist-parser/test/sample2.bplist differ http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/a7f059c0/node_modules/ios-sim/node_modules/bplist-parser/test/uid.bplist ---------------------------------------------------------------------- diff --git a/node_modules/ios-sim/node_modules/bplist-parser/test/uid.bplist b/node_modules/ios-sim/node_modules/bplist-parser/test/uid.bplist new file mode 100644 index 0000000..59f341e Binary files /dev/null and b/node_modules/ios-sim/node_modules/bplist-parser/test/uid.bplist differ http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/a7f059c0/node_modules/ios-sim/node_modules/bplist-parser/test/utf16.bplist ---------------------------------------------------------------------- diff --git a/node_modules/ios-sim/node_modules/bplist-parser/test/utf16.bplist b/node_modules/ios-sim/node_modules/bplist-parser/test/utf16.bplist new file mode 100644 index 0000000..ba4bcfa Binary files /dev/null and b/node_modules/ios-sim/node_modules/bplist-parser/test/utf16.bplist differ http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/a7f059c0/node_modules/ios-sim/node_modules/nopt/.npmignore ---------------------------------------------------------------------- diff --git a/node_modules/ios-sim/node_modules/nopt/.npmignore b/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/a7f059c0/node_modules/ios-sim/node_modules/nopt/LICENSE ---------------------------------------------------------------------- diff --git a/node_modules/ios-sim/node_modules/nopt/LICENSE b/node_modules/ios-sim/node_modules/nopt/LICENSE new file mode 100644 index 0000000..05a4010 --- /dev/null +++ b/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/a7f059c0/node_modules/ios-sim/node_modules/nopt/README.md ---------------------------------------------------------------------- diff --git a/node_modules/ios-sim/node_modules/nopt/README.md b/node_modules/ios-sim/node_modules/nopt/README.md new file mode 100644 index 0000000..e364799 --- /dev/null +++ b/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/a7f059c0/node_modules/ios-sim/node_modules/nopt/bin/nopt.js ---------------------------------------------------------------------- diff --git a/node_modules/ios-sim/node_modules/nopt/bin/nopt.js b/node_modules/ios-sim/node_modules/nopt/bin/nopt.js new file mode 100755 index 0000000..df90c72 --- /dev/null +++ b/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/a7f059c0/node_modules/ios-sim/node_modules/nopt/examples/my-program.js ---------------------------------------------------------------------- diff --git a/node_modules/ios-sim/node_modules/nopt/examples/my-program.js b/node_modules/ios-sim/node_modules/nopt/examples/my-program.js new file mode 100755 index 0000000..142447e --- /dev/null +++ b/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/a7f059c0/node_modules/ios-sim/node_modules/nopt/lib/nopt.js ---------------------------------------------------------------------- diff --git a/node_modules/ios-sim/node_modules/nopt/lib/nopt.js b/node_modules/ios-sim/node_modules/nopt/lib/nopt.js new file mode 100644 index 0000000..ff41bbc --- /dev/null +++ b/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/a7f059c0/node_modules/ios-sim/node_modules/nopt/package.json ---------------------------------------------------------------------- diff --git a/node_modules/ios-sim/node_modules/nopt/package.json b/node_modules/ios-sim/node_modules/nopt/package.json new file mode 100644 index 0000000..97cc46a --- /dev/null +++ b/node_modules/ios-sim/node_modules/nopt/package.json @@ -0,0 +1,85 @@ +{ + "_args": [ + [ + "[email protected]", + "/Users/steveng/repo/cordova/cordova-ios/node_modules/ios-sim" + ] + ], + "_defaultsLoaded": true, + "_engineSupported": true, + "_from": "[email protected]", + "_id": "[email protected]", + "_inCache": true, + "_installable": true, + "_location": "/ios-sim/nopt", + "_nodeVersion": "v0.5.8-pre", + "_npmUser": { + "email": "[email protected]", + "name": "isaacs" + }, + "_npmVersion": "1.0.30", + "_phantomChildren": {}, + "_requested": { + "name": "nopt", + "raw": "[email protected]", + "rawSpec": "1.0.9", + "scope": null, + "spec": "1.0.9", + "type": "version" + }, + "_requiredBy": [ + "/ios-sim" + ], + "_resolved": "http://registry.npmjs.org/nopt/-/nopt-1.0.9.tgz", + "_shasum": "3bc0d7cba7bfb0d5a676dbed7c0ebe48a4fd454e", + "_shrinkwrap": null, + "_spec": "[email protected]", + "_where": "/Users/steveng/repo/cordova/cordova-ios/node_modules/ios-sim", + "author": { + "email": "[email protected]", + "name": "Isaac Z. Schlueter", + "url": "http://blog.izs.me/" + }, + "bin": { + "nopt": "./bin/nopt.js" + }, + "bugs": { + "url": "https://github.com/isaacs/nopt/issues" + }, + "dependencies": { + "abbrev": "1" + }, + "description": "Option parsing for Node, supporting types, shorthands, etc. Used by npm.", + "devDependencies": {}, + "directories": {}, + "dist": { + "shasum": "3bc0d7cba7bfb0d5a676dbed7c0ebe48a4fd454e", + "tarball": "http://registry.npmjs.org/nopt/-/nopt-1.0.9.tgz" + }, + "engines": { + "node": "*" + }, + "homepage": "https://github.com/isaacs/nopt#readme", + "license": { + "type": "MIT", + "url": "https://github.com/isaacs/nopt/raw/master/LICENSE" + }, + "main": "lib/nopt.js", + "maintainers": [ + { + "name": "isaacs", + "email": "[email protected]" + } + ], + "name": "nopt", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git://github.com/isaacs/nopt.git" + }, + "scripts": { + "test": "node lib/nopt.js" + }, + "version": "1.0.9" +} http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/a7f059c0/node_modules/ios-sim/package.json ---------------------------------------------------------------------- diff --git a/node_modules/ios-sim/package.json b/node_modules/ios-sim/package.json new file mode 100644 index 0000000..3b281c0 --- /dev/null +++ b/node_modules/ios-sim/package.json @@ -0,0 +1,98 @@ +{ + "_args": [ + [ + "ios-sim@^5.0.6", + "/Users/steveng/repo/cordova/cordova-ios" + ] + ], + "_from": "ios-sim@>=5.0.6 <6.0.0", + "_id": "[email protected]", + "_inCache": true, + "_installable": true, + "_location": "/ios-sim", + "_nodeVersion": "0.12.7", + "_npmUser": { + "email": "[email protected]", + "name": "shazron" + }, + "_npmVersion": "2.11.3", + "_phantomChildren": { + "abbrev": "1.0.7" + }, + "_requested": { + "name": "ios-sim", + "raw": "ios-sim@^5.0.6", + "rawSpec": "^5.0.6", + "scope": null, + "spec": ">=5.0.6 <6.0.0", + "type": "range" + }, + "_requiredBy": [ + "/" + ], + "_resolved": "http://registry.npmjs.org/ios-sim/-/ios-sim-5.0.6.tgz", + "_shasum": "15c8e34aa9ed79df9edea26260efbba803fae7c6", + "_shrinkwrap": null, + "_spec": "ios-sim@^5.0.6", + "_where": "/Users/steveng/repo/cordova/cordova-ios", + "author": { + "name": "Shazron Abdullah" + }, + "bin": { + "ios-sim": "./bin/ios-sim" + }, + "bugs": { + "url": "https://github.com/phonegap/ios-sim/issues" + }, + "dependencies": { + "bplist-parser": "^0.0.6", + "nopt": "1.0.9", + "simctl": "^0.0.8" + }, + "description": "launch iOS apps into the iOS Simulator from the command line (Xcode 6.0+)", + "devDependencies": {}, + "directories": {}, + "dist": { + "shasum": "15c8e34aa9ed79df9edea26260efbba803fae7c6", + "tarball": "http://registry.npmjs.org/ios-sim/-/ios-sim-5.0.6.tgz" + }, + "engines": { + "node": ">=0.10.0" + }, + "gitHead": "5ae111d494f547c301b00e068cbd8aef46cf3988", + "homepage": "https://github.com/phonegap/ios-sim#readme", + "keywords": [ + "iOS Simulator", + "ios-sim" + ], + "license": "MIT", + "main": "ios-sim.js", + "maintainers": [ + { + "name": "macdonst", + "email": "[email protected]" + }, + { + "name": "purplecabbage", + "email": "[email protected]" + }, + { + "name": "shazron", + "email": "[email protected]" + }, + { + "name": "stevegill", + "email": "[email protected]" + } + ], + "name": "ios-sim", + "optionalDependencies": {}, + "preferGlobal": "true", + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git+https://github.com/phonegap/ios-sim.git" + }, + "scripts": {}, + "version": "5.0.6" +} http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/a7f059c0/node_modules/ios-sim/resources/buildbox/build.sh ---------------------------------------------------------------------- diff --git a/node_modules/ios-sim/resources/buildbox/build.sh b/node_modules/ios-sim/resources/buildbox/build.sh new file mode 100755 index 0000000..4e33b66 --- /dev/null +++ b/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/a7f059c0/node_modules/ios-sim/src/cli.js ---------------------------------------------------------------------- diff --git a/node_modules/ios-sim/src/cli.js b/node_modules/ios-sim/src/cli.js new file mode 100644 index 0000000..2b822e4 --- /dev/null +++ b/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; + --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
