CB-12546: move check_reqs to templates directory and update module references.

This commit is contained in:
filmaj 2017-03-14 14:18:00 -07:00
parent 6395eda0c8
commit d40c22441f
19 changed files with 1079 additions and 14 deletions

View File

@ -19,7 +19,7 @@
under the License.
*/
var check_reqs = require('./lib/check_reqs');
var check_reqs = require('./templates/cordova/lib/check_reqs');
check_reqs.run().done(
function success() {

View File

@ -23,7 +23,7 @@ var shell = require('shelljs'),
Q = require('q'),
path = require('path'),
fs = require('fs'),
check_reqs = require('./check_reqs'),
check_reqs = require('./../templates/cordova/lib/check_reqs'),
ROOT = path.join(__dirname, '..', '..');
var MIN_SDK_VERSION = 16;
@ -146,9 +146,7 @@ function copyScripts(projectPath) {
shell.cp('-r', srcScriptsDir, projectPath);
shell.cp('-r', path.join(ROOT, 'node_modules'), destScriptsDir);
shell.cp(path.join(ROOT, 'bin', 'check_reqs*'), destScriptsDir);
shell.cp(path.join(ROOT, 'bin', 'lib', 'check_reqs.js'), path.join(projectPath, 'cordova', 'lib', 'check_reqs.js'));
shell.cp(path.join(ROOT, 'bin', 'android_sdk_version*'), destScriptsDir);
shell.cp(path.join(ROOT, 'bin', 'lib', 'android_sdk.js'), path.join(projectPath, 'cordova', 'lib', 'android_sdk.js'));
}
/**

View File

@ -27,7 +27,7 @@ var shelljs = require('shelljs'),
path = require('path'),
fs = require('fs'),
os = require('os'),
ROOT = path.join(__dirname, '..', '..');
ROOT = path.join(__dirname, '..', '..', '..', '..');
var CordovaError = require('cordova-common').CordovaError;
@ -58,7 +58,8 @@ module.exports.isDarwin = function() {
return (process.platform == 'darwin');
};
// Get valid target from framework/project.properties
// Get valid target from framework/project.properties if run from this repo
// Otherwise get target from project.properties file within a generated cordova-android project
module.exports.get_target = function() {
function extractFromFile(filePath) {
var target = shelljs.grep(/\btarget=/, filePath);

View File

@ -31,6 +31,7 @@ var superspawn = require('cordova-common').superspawn;
var CordovaError = require('cordova-common').CordovaError;
var shelljs = require('shelljs');
var android_sdk = require('./android_sdk');
var check_reqs = require('./check_reqs');
var Q = require('q');
var os = require('os');
@ -200,8 +201,7 @@ module.exports.best_image = function() {
var closest = 9999;
var best = images[0];
// Loading check_reqs at run-time to avoid test-time vs run-time directory structure difference issue
var project_target = require('./check_reqs').get_target().replace('android-', '');
var project_target = check_reqs.get_target().replace('android-', '');
for (var i in images) {
var target = images[i].target;
if(target) {
@ -280,8 +280,7 @@ module.exports.start = function(emulator_ID, boot_timeout) {
return best.name;
}
// Loading check_reqs at run-time to avoid test-time vs run-time directory structure difference issue
var androidCmd = require('./check_reqs').getAbsoluteAndroidCmd();
var androidCmd = check_reqs.getAbsoluteAndroidCmd();
return Q.reject(new CordovaError('No emulator images (avds) found.\n' +
'1. Download desired System Image by running: ' + androidCmd + ' sdk\n' +
'2. Create an AVD by running: ' + androidCmd + ' avd\n' +

View File

@ -22,7 +22,7 @@
var devices = require('./device');
// Usage support for when args are given
require('../lib/check_reqs').check_android().then(function() {
require('./check_reqs').check_android().then(function() {
devices.list().done(function(device_list) {
device_list && device_list.forEach(function(dev) {
console.log(dev);

View File

@ -22,7 +22,7 @@
var emulators = require('./emulator');
// Usage support for when args are given
require('../lib/check_reqs').check_android().then(function() {
require('./check_reqs').check_android().then(function() {
emulators.list_images().done(function(emulator_list) {
emulator_list && emulator_list.forEach(function(emu) {
console.log(emu.name);

View File

@ -22,7 +22,7 @@
var emulators = require('./emulator');
// Usage support for when args are given
require('../lib/check_reqs').check_android().then(function() {
require('./check_reqs').check_android().then(function() {
emulators.list_started().done(function(emulator_list) {
emulator_list && emulator_list.forEach(function(emu) {
console.log(emu);

15
node_modules/pseudomap/LICENSE generated vendored Normal file
View File

@ -0,0 +1,15 @@
The ISC License
Copyright (c) Isaac Z. Schlueter and Contributors
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

60
node_modules/pseudomap/README.md generated vendored Normal file
View File

@ -0,0 +1,60 @@
# pseudomap
A thing that is a lot like ES6 `Map`, but without iterators, for use
in environments where `for..of` syntax and `Map` are not available.
If you need iterators, or just in general a more faithful polyfill to
ES6 Maps, check out [es6-map](http://npm.im/es6-map).
If you are in an environment where `Map` is supported, then that will
be returned instead, unless `process.env.TEST_PSEUDOMAP` is set.
You can use any value as keys, and any value as data. Setting again
with the identical key will overwrite the previous value.
Internally, data is stored on an `Object.create(null)` style object.
The key is coerced to a string to generate the key on the internal
data-bag object. The original key used is stored along with the data.
In the event of a stringified-key collision, a new key is generated by
appending an increasing number to the stringified-key until finding
either the intended key or an empty spot.
Note that because object traversal order of plain objects is not
guaranteed to be identical to insertion order, the insertion order
guarantee of `Map.prototype.forEach` is not guaranteed in this
implementation. However, in all versions of Node.js and V8 where this
module works, `forEach` does traverse data in insertion order.
## API
Most of the [Map
API](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map),
with the following exceptions:
1. A `Map` object is not an iterator.
2. `values`, `keys`, and `entries` methods are not implemented,
because they return iterators.
3. The argument to the constructor can be an Array of `[key, value]`
pairs, or a `Map` or `PseudoMap` object. But, since iterators
aren't used, passing any plain-old iterator won't initialize the
map properly.
## USAGE
Use just like a regular ES6 Map.
```javascript
var PseudoMap = require('pseudomap')
// optionally provide a pseudomap, or an array of [key,value] pairs
// as the argument to initialize the map with
var myMap = new PseudoMap()
myMap.set(1, 'number 1')
myMap.set('1', 'string 1')
var akey = {}
var bkey = {}
myMap.set(akey, { some: 'data' })
myMap.set(bkey, { some: 'other data' })
```

9
node_modules/pseudomap/map.js generated vendored Normal file
View File

@ -0,0 +1,9 @@
if (process.env.npm_package_name === 'pseudomap' &&
process.env.npm_lifecycle_script === 'test')
process.env.TEST_PSEUDOMAP = 'true'
if (typeof Map === 'function' && !process.env.TEST_PSEUDOMAP) {
module.exports = Map
} else {
module.exports = require('./pseudomap')
}

85
node_modules/pseudomap/package.json generated vendored Normal file
View File

@ -0,0 +1,85 @@
{
"_args": [
[
{
"raw": "pseudomap@^1.0.1",
"scope": null,
"escapedName": "pseudomap",
"name": "pseudomap",
"rawSpec": "^1.0.1",
"spec": ">=1.0.1 <2.0.0",
"type": "range"
},
"/Users/maj/src/cordova-android/node_modules/lru-cache"
]
],
"_from": "pseudomap@>=1.0.1 <2.0.0",
"_id": "pseudomap@1.0.2",
"_inCache": true,
"_location": "/pseudomap",
"_nodeVersion": "4.0.0",
"_npmUser": {
"name": "isaacs",
"email": "i@izs.me"
},
"_npmVersion": "3.3.2",
"_phantomChildren": {},
"_requested": {
"raw": "pseudomap@^1.0.1",
"scope": null,
"escapedName": "pseudomap",
"name": "pseudomap",
"rawSpec": "^1.0.1",
"spec": ">=1.0.1 <2.0.0",
"type": "range"
},
"_requiredBy": [
"/lru-cache"
],
"_resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz",
"_shasum": "f052a28da70e618917ef0a8ac34c1ae5a68286b3",
"_shrinkwrap": null,
"_spec": "pseudomap@^1.0.1",
"_where": "/Users/maj/src/cordova-android/node_modules/lru-cache",
"author": {
"name": "Isaac Z. Schlueter",
"email": "i@izs.me",
"url": "http://blog.izs.me/"
},
"bugs": {
"url": "https://github.com/isaacs/pseudomap/issues"
},
"dependencies": {},
"description": "A thing that is a lot like ES6 `Map`, but without iterators, for use in environments where `for..of` syntax and `Map` are not available.",
"devDependencies": {
"tap": "^2.3.1"
},
"directories": {
"test": "test"
},
"dist": {
"shasum": "f052a28da70e618917ef0a8ac34c1ae5a68286b3",
"tarball": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz"
},
"gitHead": "b6dc728207a0321ede6479e34506d3e0e13a940b",
"homepage": "https://github.com/isaacs/pseudomap#readme",
"license": "ISC",
"main": "map.js",
"maintainers": [
{
"name": "isaacs",
"email": "i@izs.me"
}
],
"name": "pseudomap",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"repository": {
"type": "git",
"url": "git+https://github.com/isaacs/pseudomap.git"
},
"scripts": {
"test": "tap test/*.js"
},
"version": "1.0.2"
}

113
node_modules/pseudomap/pseudomap.js generated vendored Normal file
View File

@ -0,0 +1,113 @@
var hasOwnProperty = Object.prototype.hasOwnProperty
module.exports = PseudoMap
function PseudoMap (set) {
if (!(this instanceof PseudoMap)) // whyyyyyyy
throw new TypeError("Constructor PseudoMap requires 'new'")
this.clear()
if (set) {
if ((set instanceof PseudoMap) ||
(typeof Map === 'function' && set instanceof Map))
set.forEach(function (value, key) {
this.set(key, value)
}, this)
else if (Array.isArray(set))
set.forEach(function (kv) {
this.set(kv[0], kv[1])
}, this)
else
throw new TypeError('invalid argument')
}
}
PseudoMap.prototype.forEach = function (fn, thisp) {
thisp = thisp || this
Object.keys(this._data).forEach(function (k) {
if (k !== 'size')
fn.call(thisp, this._data[k].value, this._data[k].key)
}, this)
}
PseudoMap.prototype.has = function (k) {
return !!find(this._data, k)
}
PseudoMap.prototype.get = function (k) {
var res = find(this._data, k)
return res && res.value
}
PseudoMap.prototype.set = function (k, v) {
set(this._data, k, v)
}
PseudoMap.prototype.delete = function (k) {
var res = find(this._data, k)
if (res) {
delete this._data[res._index]
this._data.size--
}
}
PseudoMap.prototype.clear = function () {
var data = Object.create(null)
data.size = 0
Object.defineProperty(this, '_data', {
value: data,
enumerable: false,
configurable: true,
writable: false
})
}
Object.defineProperty(PseudoMap.prototype, 'size', {
get: function () {
return this._data.size
},
set: function (n) {},
enumerable: true,
configurable: true
})
PseudoMap.prototype.values =
PseudoMap.prototype.keys =
PseudoMap.prototype.entries = function () {
throw new Error('iterators are not implemented in this version')
}
// Either identical, or both NaN
function same (a, b) {
return a === b || a !== a && b !== b
}
function Entry (k, v, i) {
this.key = k
this.value = v
this._index = i
}
function find (data, k) {
for (var i = 0, s = '_' + k, key = s;
hasOwnProperty.call(data, key);
key = s + i++) {
if (same(data[key].key, k))
return data[key]
}
}
function set (data, k, v) {
for (var i = 0, s = '_' + k, key = s;
hasOwnProperty.call(data, key);
key = s + i++) {
if (same(data[key].key, k)) {
data[key].value = v
return
}
}
data.size++
data[key] = new Entry(k, v, key)
}

86
node_modules/pseudomap/test/basic.js generated vendored Normal file
View File

@ -0,0 +1,86 @@
var t = require('tap')
process.env.TEST_PSEUDOMAP = 'true'
var PM = require('../')
runTests(PM)
// if possible, verify that Map also behaves the same way
if (typeof Map === 'function')
runTests(Map)
function runTests (Map) {
t.throws(Map)
var m = new Map()
t.equal(m.size, 0)
m.set(1, '1 string')
t.equal(m.get(1), '1 string')
t.equal(m.size, 1)
m.size = 1000
t.equal(m.size, 1)
m.size = 0
t.equal(m.size, 1)
m = new Map([[1, 'number 1'], ['1', 'string 1']])
t.equal(m.get(1), 'number 1')
t.equal(m.get('1'), 'string 1')
t.equal(m.size, 2)
m = new Map(m)
t.equal(m.get(1), 'number 1')
t.equal(m.get('1'), 'string 1')
t.equal(m.size, 2)
var akey = {}
var bkey = {}
m.set(akey, { some: 'data' })
m.set(bkey, { some: 'other data' })
t.same(m.get(akey), { some: 'data' })
t.same(m.get(bkey), { some: 'other data' })
t.equal(m.size, 4)
var x = /x/
var y = /x/
m.set(x, 'x regex')
m.set(y, 'y regex')
t.equal(m.get(x), 'x regex')
m.set(x, 'x again')
t.equal(m.get(x), 'x again')
t.equal(m.size, 6)
m.set(NaN, 'not a number')
t.equal(m.get(NaN), 'not a number')
m.set(NaN, 'it is a ' + typeof NaN)
t.equal(m.get(NaN), 'it is a number')
m.set('NaN', 'stringie nan')
t.equal(m.get(NaN), 'it is a number')
t.equal(m.get('NaN'), 'stringie nan')
t.equal(m.size, 8)
m.delete(NaN)
t.equal(m.get(NaN), undefined)
t.equal(m.size, 7)
var expect = [
{ value: 'number 1', key: 1 },
{ value: 'string 1', key: '1' },
{ value: { some: 'data' }, key: {} },
{ value: { some: 'other data' }, key: {} },
{ value: 'x again', key: /x/ },
{ value: 'y regex', key: /x/ },
{ value: 'stringie nan', key: 'NaN' }
]
var actual = []
m.forEach(function (value, key) {
actual.push({ value: value, key: key })
})
t.same(actual, expect)
m.clear()
t.equal(m.size, 0)
}

15
node_modules/yallist/LICENSE generated vendored Normal file
View File

@ -0,0 +1,15 @@
The ISC License
Copyright (c) Isaac Z. Schlueter and Contributors
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

204
node_modules/yallist/README.md generated vendored Normal file
View File

@ -0,0 +1,204 @@
# yallist
Yet Another Linked List
There are many doubly-linked list implementations like it, but this
one is mine.
For when an array would be too big, and a Map can't be iterated in
reverse order.
[![Build Status](https://travis-ci.org/isaacs/yallist.svg?branch=master)](https://travis-ci.org/isaacs/yallist) [![Coverage Status](https://coveralls.io/repos/isaacs/yallist/badge.svg?service=github)](https://coveralls.io/github/isaacs/yallist)
## basic usage
```javascript
var yallist = require('yallist')
var myList = yallist.create([1, 2, 3])
myList.push('foo')
myList.unshift('bar')
// of course pop() and shift() are there, too
console.log(myList.toArray()) // ['bar', 1, 2, 3, 'foo']
myList.forEach(function (k) {
// walk the list head to tail
})
myList.forEachReverse(function (k, index, list) {
// walk the list tail to head
})
var myDoubledList = myList.map(function (k) {
return k + k
})
// now myDoubledList contains ['barbar', 2, 4, 6, 'foofoo']
// mapReverse is also a thing
var myDoubledListReverse = myList.mapReverse(function (k) {
return k + k
}) // ['foofoo', 6, 4, 2, 'barbar']
var reduced = myList.reduce(function (set, entry) {
set += entry
return set
}, 'start')
console.log(reduced) // 'startfoo123bar'
```
## api
The whole API is considered "public".
Functions with the same name as an Array method work more or less the
same way.
There's reverse versions of most things because that's the point.
### Yallist
Default export, the class that holds and manages a list.
Call it with either a forEach-able (like an array) or a set of
arguments, to initialize the list.
The Array-ish methods all act like you'd expect. No magic length,
though, so if you change that it won't automatically prune or add
empty spots.
### Yallist.create(..)
Alias for Yallist function. Some people like factories.
#### yallist.head
The first node in the list
#### yallist.tail
The last node in the list
#### yallist.length
The number of nodes in the list. (Change this at your peril. It is
not magic like Array length.)
#### yallist.toArray()
Convert the list to an array.
#### yallist.forEach(fn, [thisp])
Call a function on each item in the list.
#### yallist.forEachReverse(fn, [thisp])
Call a function on each item in the list, in reverse order.
#### yallist.get(n)
Get the data at position `n` in the list. If you use this a lot,
probably better off just using an Array.
#### yallist.getReverse(n)
Get the data at position `n`, counting from the tail.
#### yallist.map(fn, thisp)
Create a new Yallist with the result of calling the function on each
item.
#### yallist.mapReverse(fn, thisp)
Same as `map`, but in reverse.
#### yallist.pop()
Get the data from the list tail, and remove the tail from the list.
#### yallist.push(item, ...)
Insert one or more items to the tail of the list.
#### yallist.reduce(fn, initialValue)
Like Array.reduce.
#### yallist.reduceReverse
Like Array.reduce, but in reverse.
#### yallist.reverse
Reverse the list in place.
#### yallist.shift()
Get the data from the list head, and remove the head from the list.
#### yallist.slice([from], [to])
Just like Array.slice, but returns a new Yallist.
#### yallist.sliceReverse([from], [to])
Just like yallist.slice, but the result is returned in reverse.
#### yallist.toArray()
Create an array representation of the list.
#### yallist.toArrayReverse()
Create a reversed array representation of the list.
#### yallist.unshift(item, ...)
Insert one or more items to the head of the list.
#### yallist.unshiftNode(node)
Move a Node object to the front of the list. (That is, pull it out of
wherever it lives, and make it the new head.)
If the node belongs to a different list, then that list will remove it
first.
#### yallist.pushNode(node)
Move a Node object to the end of the list. (That is, pull it out of
wherever it lives, and make it the new tail.)
If the node belongs to a list already, then that list will remove it
first.
#### yallist.removeNode(node)
Remove a node from the list, preserving referential integrity of head
and tail and other nodes.
Will throw an error if you try to have a list remove a node that
doesn't belong to it.
### Yallist.Node
The class that holds the data and is actually the list.
Call with `var n = new Node(value, previousNode, nextNode)`
Note that if you do direct operations on Nodes themselves, it's very
easy to get into weird states where the list is broken. Be careful :)
#### node.next
The next node in the list.
#### node.prev
The previous node in the list.
#### node.value
The data the node contains.
#### node.list
The list to which this node belongs. (Null if it does not belong to
any list.)

7
node_modules/yallist/iterator.js generated vendored Normal file
View File

@ -0,0 +1,7 @@
var Yallist = require('./yallist.js')
Yallist.prototype[Symbol.iterator] = function* () {
for (let walker = this.head; walker; walker = walker.next) {
yield walker.value
}
}

96
node_modules/yallist/package.json generated vendored Normal file
View File

@ -0,0 +1,96 @@
{
"_args": [
[
{
"raw": "yallist@^2.0.0",
"scope": null,
"escapedName": "yallist",
"name": "yallist",
"rawSpec": "^2.0.0",
"spec": ">=2.0.0 <3.0.0",
"type": "range"
},
"/Users/maj/src/cordova-android/node_modules/lru-cache"
]
],
"_from": "yallist@>=2.0.0 <3.0.0",
"_id": "yallist@2.1.2",
"_inCache": true,
"_location": "/yallist",
"_nodeVersion": "8.0.0-pre",
"_npmOperationalInternal": {
"host": "packages-12-west.internal.npmjs.com",
"tmp": "tmp/yallist-2.1.2.tgz_1489443365033_0.47744474792853"
},
"_npmUser": {
"name": "isaacs",
"email": "i@izs.me"
},
"_npmVersion": "4.3.0",
"_phantomChildren": {},
"_requested": {
"raw": "yallist@^2.0.0",
"scope": null,
"escapedName": "yallist",
"name": "yallist",
"rawSpec": "^2.0.0",
"spec": ">=2.0.0 <3.0.0",
"type": "range"
},
"_requiredBy": [
"/lru-cache"
],
"_resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz",
"_shasum": "1c11f9218f076089a47dd512f93c6699a6a81d52",
"_shrinkwrap": null,
"_spec": "yallist@^2.0.0",
"_where": "/Users/maj/src/cordova-android/node_modules/lru-cache",
"author": {
"name": "Isaac Z. Schlueter",
"email": "i@izs.me",
"url": "http://blog.izs.me/"
},
"bugs": {
"url": "https://github.com/isaacs/yallist/issues"
},
"dependencies": {},
"description": "Yet Another Linked List",
"devDependencies": {
"tap": "^10.3.0"
},
"directories": {
"test": "test"
},
"dist": {
"shasum": "1c11f9218f076089a47dd512f93c6699a6a81d52",
"tarball": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz"
},
"files": [
"yallist.js",
"iterator.js"
],
"gitHead": "566cd4cd1e2ce57ffa84e295981cd9aa72319391",
"homepage": "https://github.com/isaacs/yallist#readme",
"license": "ISC",
"main": "yallist.js",
"maintainers": [
{
"name": "isaacs",
"email": "i@izs.me"
}
],
"name": "yallist",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"repository": {
"type": "git",
"url": "git+https://github.com/isaacs/yallist.git"
},
"scripts": {
"postpublish": "git push origin --all; git push origin --tags",
"postversion": "npm publish",
"preversion": "npm test",
"test": "tap test/*.js --100"
},
"version": "2.1.2"
}

370
node_modules/yallist/yallist.js generated vendored Normal file
View File

@ -0,0 +1,370 @@
module.exports = Yallist
Yallist.Node = Node
Yallist.create = Yallist
function Yallist (list) {
var self = this
if (!(self instanceof Yallist)) {
self = new Yallist()
}
self.tail = null
self.head = null
self.length = 0
if (list && typeof list.forEach === 'function') {
list.forEach(function (item) {
self.push(item)
})
} else if (arguments.length > 0) {
for (var i = 0, l = arguments.length; i < l; i++) {
self.push(arguments[i])
}
}
return self
}
Yallist.prototype.removeNode = function (node) {
if (node.list !== this) {
throw new Error('removing node which does not belong to this list')
}
var next = node.next
var prev = node.prev
if (next) {
next.prev = prev
}
if (prev) {
prev.next = next
}
if (node === this.head) {
this.head = next
}
if (node === this.tail) {
this.tail = prev
}
node.list.length--
node.next = null
node.prev = null
node.list = null
}
Yallist.prototype.unshiftNode = function (node) {
if (node === this.head) {
return
}
if (node.list) {
node.list.removeNode(node)
}
var head = this.head
node.list = this
node.next = head
if (head) {
head.prev = node
}
this.head = node
if (!this.tail) {
this.tail = node
}
this.length++
}
Yallist.prototype.pushNode = function (node) {
if (node === this.tail) {
return
}
if (node.list) {
node.list.removeNode(node)
}
var tail = this.tail
node.list = this
node.prev = tail
if (tail) {
tail.next = node
}
this.tail = node
if (!this.head) {
this.head = node
}
this.length++
}
Yallist.prototype.push = function () {
for (var i = 0, l = arguments.length; i < l; i++) {
push(this, arguments[i])
}
return this.length
}
Yallist.prototype.unshift = function () {
for (var i = 0, l = arguments.length; i < l; i++) {
unshift(this, arguments[i])
}
return this.length
}
Yallist.prototype.pop = function () {
if (!this.tail) {
return undefined
}
var res = this.tail.value
this.tail = this.tail.prev
if (this.tail) {
this.tail.next = null
} else {
this.head = null
}
this.length--
return res
}
Yallist.prototype.shift = function () {
if (!this.head) {
return undefined
}
var res = this.head.value
this.head = this.head.next
if (this.head) {
this.head.prev = null
} else {
this.tail = null
}
this.length--
return res
}
Yallist.prototype.forEach = function (fn, thisp) {
thisp = thisp || this
for (var walker = this.head, i = 0; walker !== null; i++) {
fn.call(thisp, walker.value, i, this)
walker = walker.next
}
}
Yallist.prototype.forEachReverse = function (fn, thisp) {
thisp = thisp || this
for (var walker = this.tail, i = this.length - 1; walker !== null; i--) {
fn.call(thisp, walker.value, i, this)
walker = walker.prev
}
}
Yallist.prototype.get = function (n) {
for (var i = 0, walker = this.head; walker !== null && i < n; i++) {
// abort out of the list early if we hit a cycle
walker = walker.next
}
if (i === n && walker !== null) {
return walker.value
}
}
Yallist.prototype.getReverse = function (n) {
for (var i = 0, walker = this.tail; walker !== null && i < n; i++) {
// abort out of the list early if we hit a cycle
walker = walker.prev
}
if (i === n && walker !== null) {
return walker.value
}
}
Yallist.prototype.map = function (fn, thisp) {
thisp = thisp || this
var res = new Yallist()
for (var walker = this.head; walker !== null;) {
res.push(fn.call(thisp, walker.value, this))
walker = walker.next
}
return res
}
Yallist.prototype.mapReverse = function (fn, thisp) {
thisp = thisp || this
var res = new Yallist()
for (var walker = this.tail; walker !== null;) {
res.push(fn.call(thisp, walker.value, this))
walker = walker.prev
}
return res
}
Yallist.prototype.reduce = function (fn, initial) {
var acc
var walker = this.head
if (arguments.length > 1) {
acc = initial
} else if (this.head) {
walker = this.head.next
acc = this.head.value
} else {
throw new TypeError('Reduce of empty list with no initial value')
}
for (var i = 0; walker !== null; i++) {
acc = fn(acc, walker.value, i)
walker = walker.next
}
return acc
}
Yallist.prototype.reduceReverse = function (fn, initial) {
var acc
var walker = this.tail
if (arguments.length > 1) {
acc = initial
} else if (this.tail) {
walker = this.tail.prev
acc = this.tail.value
} else {
throw new TypeError('Reduce of empty list with no initial value')
}
for (var i = this.length - 1; walker !== null; i--) {
acc = fn(acc, walker.value, i)
walker = walker.prev
}
return acc
}
Yallist.prototype.toArray = function () {
var arr = new Array(this.length)
for (var i = 0, walker = this.head; walker !== null; i++) {
arr[i] = walker.value
walker = walker.next
}
return arr
}
Yallist.prototype.toArrayReverse = function () {
var arr = new Array(this.length)
for (var i = 0, walker = this.tail; walker !== null; i++) {
arr[i] = walker.value
walker = walker.prev
}
return arr
}
Yallist.prototype.slice = function (from, to) {
to = to || this.length
if (to < 0) {
to += this.length
}
from = from || 0
if (from < 0) {
from += this.length
}
var ret = new Yallist()
if (to < from || to < 0) {
return ret
}
if (from < 0) {
from = 0
}
if (to > this.length) {
to = this.length
}
for (var i = 0, walker = this.head; walker !== null && i < from; i++) {
walker = walker.next
}
for (; walker !== null && i < to; i++, walker = walker.next) {
ret.push(walker.value)
}
return ret
}
Yallist.prototype.sliceReverse = function (from, to) {
to = to || this.length
if (to < 0) {
to += this.length
}
from = from || 0
if (from < 0) {
from += this.length
}
var ret = new Yallist()
if (to < from || to < 0) {
return ret
}
if (from < 0) {
from = 0
}
if (to > this.length) {
to = this.length
}
for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) {
walker = walker.prev
}
for (; walker !== null && i > from; i--, walker = walker.prev) {
ret.push(walker.value)
}
return ret
}
Yallist.prototype.reverse = function () {
var head = this.head
var tail = this.tail
for (var walker = head; walker !== null; walker = walker.prev) {
var p = walker.prev
walker.prev = walker.next
walker.next = p
}
this.head = tail
this.tail = head
return this
}
function push (self, item) {
self.tail = new Node(item, self.tail, null, self)
if (!self.head) {
self.head = self.tail
}
self.length++
}
function unshift (self, item) {
self.head = new Node(item, null, self.head, self)
if (!self.tail) {
self.tail = self.head
}
self.length++
}
function Node (value, prev, next, list) {
if (!(this instanceof Node)) {
return new Node(value, prev, next, list)
}
this.list = list
this.value = value
if (prev) {
prev.next = this
this.prev = prev
} else {
this.prev = null
}
if (next) {
next.prev = this
this.next = next
} else {
this.next = null
}
}

View File

@ -18,7 +18,7 @@
*/
/* jshint laxcomma:true */
var check_reqs = require("../../bin/lib/check_reqs");
var check_reqs = require("../../bin/templates/cordova/lib/check_reqs");
var shelljs = require("shelljs");
var fs = require("fs");
var path = require("path");
@ -211,4 +211,11 @@ describe("check_reqs", function () {
});
});
});
describe("get_target", function() {
it("should retrieve target from framework project.properties file", function() {
var target = check_reqs.get_target();
expect(target).toBeDefined();
expect(target).toContain("android-");
});
});
});