http://git-wip-us.apache.org/repos/asf/incubator-cmda/blob/a9a83675/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/graceful-fs/LICENSE ---------------------------------------------------------------------- diff --git a/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/graceful-fs/LICENSE b/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/graceful-fs/LICENSE new file mode 100644 index 0000000..0c44ae7 --- /dev/null +++ b/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/graceful-fs/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) Isaac Z. Schlueter ("Author") +All rights reserved. + +The BSD License + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS +BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
http://git-wip-us.apache.org/repos/asf/incubator-cmda/blob/a9a83675/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/graceful-fs/README.md ---------------------------------------------------------------------- diff --git a/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/graceful-fs/README.md b/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/graceful-fs/README.md new file mode 100644 index 0000000..eb1a109 --- /dev/null +++ b/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/graceful-fs/README.md @@ -0,0 +1,26 @@ +# graceful-fs + +graceful-fs functions as a drop-in replacement for the fs module, +making various improvements. + +The improvements are meant to normalize behavior across different +platforms and environments, and to make filesystem access more +resilient to errors. + +## Improvements over fs module + +graceful-fs: + +* Queues up `open` and `readdir` calls, and retries them once + something closes if there is an EMFILE error from too many file + descriptors. +* fixes `lchmod` for Node versions prior to 0.6.2. +* implements `fs.lutimes` if possible. Otherwise it becomes a noop. +* ignores `EINVAL` and `EPERM` errors in `chown`, `fchown` or + `lchown` if the user isn't root. +* makes `lchmod` and `lchown` become noops, if not available. +* retries reading a file if `read` results in EAGAIN error. + +On Windows, it retries renaming a file for up to one second if `EACCESS` +or `EPERM` error occurs, likely because antivirus software has locked +the directory. http://git-wip-us.apache.org/repos/asf/incubator-cmda/blob/a9a83675/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/graceful-fs/graceful-fs.js ---------------------------------------------------------------------- diff --git a/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/graceful-fs/graceful-fs.js b/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/graceful-fs/graceful-fs.js new file mode 100644 index 0000000..1865f92 --- /dev/null +++ b/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/graceful-fs/graceful-fs.js @@ -0,0 +1,159 @@ +// Monkey-patching the fs module. +// It's ugly, but there is simply no other way to do this. +var fs = module.exports = require('fs') + +var assert = require('assert') + +// fix up some busted stuff, mostly on windows and old nodes +require('./polyfills.js') + +// The EMFILE enqueuing stuff + +var util = require('util') + +function noop () {} + +var debug = noop +var util = require('util') +if (util.debuglog) + debug = util.debuglog('gfs') +else if (/\bgfs\b/i.test(process.env.NODE_DEBUG || '')) + debug = function() { + var m = util.format.apply(util, arguments) + m = 'GFS: ' + m.split(/\n/).join('\nGFS: ') + console.error(m) + } + +if (/\bgfs\b/i.test(process.env.NODE_DEBUG || '')) { + process.on('exit', function() { + debug('fds', fds) + debug(queue) + assert.equal(queue.length, 0) + }) +} + + +var originalOpen = fs.open +fs.open = open + +function open(path, flags, mode, cb) { + if (typeof mode === "function") cb = mode, mode = null + if (typeof cb !== "function") cb = noop + new OpenReq(path, flags, mode, cb) +} + +function OpenReq(path, flags, mode, cb) { + this.path = path + this.flags = flags + this.mode = mode + this.cb = cb + Req.call(this) +} + +util.inherits(OpenReq, Req) + +OpenReq.prototype.process = function() { + originalOpen.call(fs, this.path, this.flags, this.mode, this.done) +} + +var fds = {} +OpenReq.prototype.done = function(er, fd) { + debug('open done', er, fd) + if (fd) + fds['fd' + fd] = this.path + Req.prototype.done.call(this, er, fd) +} + + +var originalReaddir = fs.readdir +fs.readdir = readdir + +function readdir(path, cb) { + if (typeof cb !== "function") cb = noop + new ReaddirReq(path, cb) +} + +function ReaddirReq(path, cb) { + this.path = path + this.cb = cb + Req.call(this) +} + +util.inherits(ReaddirReq, Req) + +ReaddirReq.prototype.process = function() { + originalReaddir.call(fs, this.path, this.done) +} + +ReaddirReq.prototype.done = function(er, files) { + Req.prototype.done.call(this, er, files) + onclose() +} + + +var originalClose = fs.close +fs.close = close + +function close (fd, cb) { + debug('close', fd) + if (typeof cb !== "function") cb = noop + delete fds['fd' + fd] + originalClose.call(fs, fd, function(er) { + onclose() + cb(er) + }) +} + + +var originalCloseSync = fs.closeSync +fs.closeSync = closeSync + +function closeSync (fd) { + try { + return originalCloseSync(fd) + } finally { + onclose() + } +} + + +// Req class +function Req () { + // start processing + this.done = this.done.bind(this) + this.failures = 0 + this.process() +} + +Req.prototype.done = function (er, result) { + var tryAgain = false + if (er) { + var code = er.code + var tryAgain = code === "EMFILE" + if (process.platform === "win32") + tryAgain = tryAgain || code === "OK" + } + + if (tryAgain) { + this.failures ++ + enqueue(this) + } else { + var cb = this.cb + cb(er, result) + } +} + +var queue = [] + +function enqueue(req) { + queue.push(req) + debug('enqueue %d %s', queue.length, req.constructor.name, req) +} + +function onclose() { + var req = queue.shift() + if (req) { + debug('process', req.constructor.name, req) + req.process() + } +} http://git-wip-us.apache.org/repos/asf/incubator-cmda/blob/a9a83675/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/graceful-fs/package.json ---------------------------------------------------------------------- diff --git a/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/graceful-fs/package.json b/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/graceful-fs/package.json new file mode 100644 index 0000000..1b4a21c --- /dev/null +++ b/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/graceful-fs/package.json @@ -0,0 +1,48 @@ +{ + "author": { + "name": "Isaac Z. Schlueter", + "email": "i...@izs.me", + "url": "http://blog.izs.me" + }, + "name": "graceful-fs", + "description": "A drop-in replacement for fs, making various improvements.", + "version": "2.0.1", + "repository": { + "type": "git", + "url": "git://github.com/isaacs/node-graceful-fs.git" + }, + "main": "graceful-fs.js", + "engines": { + "node": ">=0.4.0" + }, + "directories": { + "test": "test" + }, + "scripts": { + "test": "tap test/*.js" + }, + "keywords": [ + "fs", + "module", + "reading", + "retry", + "retries", + "queue", + "error", + "errors", + "handling", + "EMFILE", + "EAGAIN", + "EINVAL", + "EPERM", + "EACCESS" + ], + "license": "BSD", + "readme": "# graceful-fs\n\ngraceful-fs functions as a drop-in replacement for the fs module,\nmaking various improvements.\n\nThe improvements are meant to normalize behavior across different\nplatforms and environments, and to make filesystem access more\nresilient to errors.\n\n## Improvements over fs module\n\ngraceful-fs:\n\n* Queues up `open` and `readdir` calls, and retries them once\n something closes if there is an EMFILE error from too many file\n descriptors.\n* fixes `lchmod` for Node versions prior to 0.6.2.\n* implements `fs.lutimes` if possible. Otherwise it becomes a noop.\n* ignores `EINVAL` and `EPERM` errors in `chown`, `fchown` or\n `lchown` if the user isn't root.\n* makes `lchmod` and `lchown` become noops, if not available.\n* retries reading a file if `read` results in EAGAIN error.\n\nOn Windows, it retries renaming a file for up to one second if `EACCESS`\nor `EPERM` error occurs, likely because antivirus software has locked\nthe directory.\n", + "readmeFilename": "README.md", + "bugs": { + "url": "https://github.com/isaacs/node-graceful-fs/issues" + }, + "_id": "graceful-fs@2.0.1", + "_from": "graceful-fs@~2.0.0" +} http://git-wip-us.apache.org/repos/asf/incubator-cmda/blob/a9a83675/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/graceful-fs/polyfills.js ---------------------------------------------------------------------- diff --git a/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/graceful-fs/polyfills.js b/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/graceful-fs/polyfills.js new file mode 100644 index 0000000..afc83b3 --- /dev/null +++ b/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/graceful-fs/polyfills.js @@ -0,0 +1,228 @@ +var fs = require('fs') +var constants = require('constants') + +var origCwd = process.cwd +var cwd = null +process.cwd = function() { + if (!cwd) + cwd = origCwd.call(process) + return cwd +} +var chdir = process.chdir +process.chdir = function(d) { + cwd = null + chdir.call(process, d) +} + +// (re-)implement some things that are known busted or missing. + +// lchmod, broken prior to 0.6.2 +// back-port the fix here. +if (constants.hasOwnProperty('O_SYMLINK') && + process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) { + fs.lchmod = function (path, mode, callback) { + callback = callback || noop + fs.open( path + , constants.O_WRONLY | constants.O_SYMLINK + , mode + , function (err, fd) { + if (err) { + callback(err) + return + } + // prefer to return the chmod error, if one occurs, + // but still try to close, and report closing errors if they occur. + fs.fchmod(fd, mode, function (err) { + fs.close(fd, function(err2) { + callback(err || err2) + }) + }) + }) + } + + fs.lchmodSync = function (path, mode) { + var fd = fs.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode) + + // prefer to return the chmod error, if one occurs, + // but still try to close, and report closing errors if they occur. + var err, err2 + try { + var ret = fs.fchmodSync(fd, mode) + } catch (er) { + err = er + } + try { + fs.closeSync(fd) + } catch (er) { + err2 = er + } + if (err || err2) throw (err || err2) + return ret + } +} + + +// lutimes implementation, or no-op +if (!fs.lutimes) { + if (constants.hasOwnProperty("O_SYMLINK")) { + fs.lutimes = function (path, at, mt, cb) { + fs.open(path, constants.O_SYMLINK, function (er, fd) { + cb = cb || noop + if (er) return cb(er) + fs.futimes(fd, at, mt, function (er) { + fs.close(fd, function (er2) { + return cb(er || er2) + }) + }) + }) + } + + fs.lutimesSync = function (path, at, mt) { + var fd = fs.openSync(path, constants.O_SYMLINK) + , err + , err2 + , ret + + try { + var ret = fs.futimesSync(fd, at, mt) + } catch (er) { + err = er + } + try { + fs.closeSync(fd) + } catch (er) { + err2 = er + } + if (err || err2) throw (err || err2) + return ret + } + + } else if (fs.utimensat && constants.hasOwnProperty("AT_SYMLINK_NOFOLLOW")) { + // maybe utimensat will be bound soonish? + fs.lutimes = function (path, at, mt, cb) { + fs.utimensat(path, at, mt, constants.AT_SYMLINK_NOFOLLOW, cb) + } + + fs.lutimesSync = function (path, at, mt) { + return fs.utimensatSync(path, at, mt, constants.AT_SYMLINK_NOFOLLOW) + } + + } else { + fs.lutimes = function (_a, _b, _c, cb) { process.nextTick(cb) } + fs.lutimesSync = function () {} + } +} + + +// https://github.com/isaacs/node-graceful-fs/issues/4 +// Chown should not fail on einval or eperm if non-root. + +fs.chown = chownFix(fs.chown) +fs.fchown = chownFix(fs.fchown) +fs.lchown = chownFix(fs.lchown) + +fs.chownSync = chownFixSync(fs.chownSync) +fs.fchownSync = chownFixSync(fs.fchownSync) +fs.lchownSync = chownFixSync(fs.lchownSync) + +function chownFix (orig) { + if (!orig) return orig + return function (target, uid, gid, cb) { + return orig.call(fs, target, uid, gid, function (er, res) { + if (chownErOk(er)) er = null + cb(er, res) + }) + } +} + +function chownFixSync (orig) { + if (!orig) return orig + return function (target, uid, gid) { + try { + return orig.call(fs, target, uid, gid) + } catch (er) { + if (!chownErOk(er)) throw er + } + } +} + +function chownErOk (er) { + // if there's no getuid, or if getuid() is something other than 0, + // and the error is EINVAL or EPERM, then just ignore it. + // This specific case is a silent failure in cp, install, tar, + // and most other unix tools that manage permissions. + // When running as root, or if other types of errors are encountered, + // then it's strict. + if (!er || (!process.getuid || process.getuid() !== 0) + && (er.code === "EINVAL" || er.code === "EPERM")) return true +} + + +// if lchmod/lchown do not exist, then make them no-ops +if (!fs.lchmod) { + fs.lchmod = function (path, mode, cb) { + process.nextTick(cb) + } + fs.lchmodSync = function () {} +} +if (!fs.lchown) { + fs.lchown = function (path, uid, gid, cb) { + process.nextTick(cb) + } + fs.lchownSync = function () {} +} + + + +// on Windows, A/V software can lock the directory, causing this +// to fail with an EACCES or EPERM if the directory contains newly +// created files. Try again on failure, for up to 1 second. +if (process.platform === "win32") { + var rename_ = fs.rename + fs.rename = function rename (from, to, cb) { + var start = Date.now() + rename_(from, to, function CB (er) { + if (er + && (er.code === "EACCES" || er.code === "EPERM") + && Date.now() - start < 1000) { + return rename_(from, to, CB) + } + cb(er) + }) + } +} + + +// if read() returns EAGAIN, then just try it again. +var read = fs.read +fs.read = function (fd, buffer, offset, length, position, callback_) { + var callback + if (callback_ && typeof callback_ === 'function') { + var eagCounter = 0 + callback = function (er, _, __) { + if (er && er.code === 'EAGAIN' && eagCounter < 10) { + eagCounter ++ + return read.call(fs, fd, buffer, offset, length, position, callback) + } + callback_.apply(this, arguments) + } + } + return read.call(fs, fd, buffer, offset, length, position, callback) +} + +var readSync = fs.readSync +fs.readSync = function (fd, buffer, offset, length, position) { + var eagCounter = 0 + while (true) { + try { + return readSync.call(fs, fd, buffer, offset, length, position) + } catch (er) { + if (er.code === 'EAGAIN' && eagCounter < 10) { + eagCounter ++ + continue + } + throw er + } + } +} + http://git-wip-us.apache.org/repos/asf/incubator-cmda/blob/a9a83675/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/graceful-fs/test/open.js ---------------------------------------------------------------------- diff --git a/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/graceful-fs/test/open.js b/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/graceful-fs/test/open.js new file mode 100644 index 0000000..104f36b --- /dev/null +++ b/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/graceful-fs/test/open.js @@ -0,0 +1,39 @@ +var test = require('tap').test +var fs = require('../graceful-fs.js') + +test('graceful fs is monkeypatched fs', function (t) { + t.equal(fs, require('fs')) + t.end() +}) + +test('open an existing file works', function (t) { + var fd = fs.openSync(__filename, 'r') + fs.closeSync(fd) + fs.open(__filename, 'r', function (er, fd) { + if (er) throw er + fs.close(fd, function (er) { + if (er) throw er + t.pass('works') + t.end() + }) + }) +}) + +test('open a non-existing file throws', function (t) { + var er + try { + var fd = fs.openSync('this file does not exist', 'r') + } catch (x) { + er = x + } + t.ok(er, 'should throw') + t.notOk(fd, 'should not get an fd') + t.equal(er.code, 'ENOENT') + + fs.open('neither does this file', 'r', function (er, fd) { + t.ok(er, 'should throw') + t.notOk(fd, 'should not get an fd') + t.equal(er.code, 'ENOENT') + t.end() + }) +}) http://git-wip-us.apache.org/repos/asf/incubator-cmda/blob/a9a83675/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/inherits/LICENSE ---------------------------------------------------------------------- diff --git a/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/inherits/LICENSE b/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/inherits/LICENSE new file mode 100644 index 0000000..dea3013 --- /dev/null +++ b/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/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/incubator-cmda/blob/a9a83675/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/inherits/README.md ---------------------------------------------------------------------- diff --git a/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/inherits/README.md b/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/inherits/README.md new file mode 100644 index 0000000..b1c5665 --- /dev/null +++ b/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/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/incubator-cmda/blob/a9a83675/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/inherits/inherits.js ---------------------------------------------------------------------- diff --git a/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/inherits/inherits.js b/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/inherits/inherits.js new file mode 100644 index 0000000..29f5e24 --- /dev/null +++ b/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/inherits/inherits.js @@ -0,0 +1 @@ +module.exports = require('util').inherits http://git-wip-us.apache.org/repos/asf/incubator-cmda/blob/a9a83675/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/inherits/inherits_browser.js ---------------------------------------------------------------------- diff --git a/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/inherits/inherits_browser.js b/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/inherits/inherits_browser.js new file mode 100644 index 0000000..c1e78a7 --- /dev/null +++ b/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/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/incubator-cmda/blob/a9a83675/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/inherits/package.json ---------------------------------------------------------------------- diff --git a/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/inherits/package.json b/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/inherits/package.json new file mode 100644 index 0000000..3b4843a --- /dev/null +++ b/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/inherits/package.json @@ -0,0 +1,32 @@ +{ + "name": "inherits", + "description": "Browser-friendly inheritance fully compatible with standard node.js inherits()", + "version": "2.0.1", + "keywords": [ + "inheritance", + "class", + "klass", + "oop", + "object-oriented", + "inherits", + "browser", + "browserify" + ], + "main": "./inherits.js", + "browser": "./inherits_browser.js", + "repository": { + "type": "git", + "url": "git://github.com/isaacs/inherits" + }, + "license": "ISC", + "scripts": { + "test": "node test" + }, + "readme": "Browser-friendly inheritance fully compatible with standard node.js\n[inherits](http://nodejs.org/api/util.html#util_util_inherits_constructor_superconstructor).\n\nThis package exports standard `inherits` from node.js `util` module in\nnode environment, but also provides alternative browser-friendly\nimplementation through [browser\nfield](https://gist.github.com/shtylman/4339901). Alternative\nimplementation is a literal copy of standard one located in standalone\nmodule to avoid requiring of `util`. It also has a shim for old\nbrowsers with no `Object.create` support.\n\nWhile keeping you sure you are using standard `inherits`\nimplementation in node.js environment, it allows bundlers such as\n[browserify](https://github.com/substack/node-browserify) to not\ninclude full `util` package to your client code if all you need is\njust `inherits` function. It worth, because browser shim for `util`\npackage is large and `inherits` is often the single function you need\nfrom it.\n\nIt's recommended to use this package instead of\n`require('util').inherits` for any code that has chances to be used\nnot only in node.js but in browser too.\n\n## usage\n\n```js\nvar inherits = require('inherits');\n// then use exactly as the standard one\n```\n\n## note on version ~1.0\n\nVersion ~1.0 had completely different motivation and is not compatible\nneither with 2.0 nor with standard node.js `inherits`.\n\nIf you are using version ~1.0 and planning to switch to ~2.0, be\ncareful:\n\n* new version uses `super_` instead of `super` for referencing\n superclass\n* new version overwrites current prototype while old one preserves any\n existing fields on it\n", + "readmeFilename": "README.md", + "bugs": { + "url": "https://github.com/isaacs/inherits/issues" + }, + "_id": "inherits@2.0.1", + "_from": "inherits@" +} http://git-wip-us.apache.org/repos/asf/incubator-cmda/blob/a9a83675/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/inherits/test.js ---------------------------------------------------------------------- diff --git a/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/inherits/test.js b/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/inherits/test.js new file mode 100644 index 0000000..fc53012 --- /dev/null +++ b/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/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/incubator-cmda/blob/a9a83675/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/ini/LICENSE ---------------------------------------------------------------------- diff --git a/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/ini/LICENSE b/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/ini/LICENSE new file mode 100644 index 0000000..05a4010 --- /dev/null +++ b/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/ini/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/incubator-cmda/blob/a9a83675/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/ini/README.md ---------------------------------------------------------------------- diff --git a/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/ini/README.md b/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/ini/README.md new file mode 100644 index 0000000..acbe8ec --- /dev/null +++ b/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/ini/README.md @@ -0,0 +1,79 @@ +An ini format parser and serializer for node. + +Sections are treated as nested objects. Items before the first heading +are saved on the object directly. + +## Usage + +Consider an ini-file `config.ini` that looks like this: + + ; this comment is being ignored + scope = global + + [database] + user = dbuser + password = dbpassword + database = use_this_database + + [paths.default] + datadir = /var/lib/data + array[] = first value + array[] = second value + array[] = third value + +You can read, manipulate and write the ini-file like so: + + var fs = require('fs') + , ini = require('ini') + + var config = ini.parse(fs.readFileSync('./config.ini', 'utf-8')) + + config.scope = 'local' + config.database.database = 'use_another_database' + config.paths.default.tmpdir = '/tmp' + delete config.paths.default.datadir + config.paths.default.array.push('fourth value') + + fs.writeFileSync('./config_modified.ini', ini.stringify(config, 'section')) + +This will result in a file called `config_modified.ini` being written to the filesystem with the following content: + + [section] + scope = local + [section.database] + user = dbuser + password = dbpassword + database = use_another_database + [section.paths.default] + tmpdir = /tmp + array[] = first value + array[] = second value + array[] = third value + array[] = fourth value + + +## API + +### decode(inistring) +Decode the ini-style formatted `inistring` into a nested object. + +### parse(inistring) +Alias for `decode(inistring)` + +### encode(object, [section]) +Encode the object `object` into an ini-style formatted string. If the optional parameter `section` is given, then all top-level properties of the object are put into this section and the `section`-string is prepended to all sub-sections, see the usage example above. + +### stringify(object, [section]) +Alias for `encode(object, [section])` + +### safe(val) +Escapes the string `val` such that it is safe to be used as a key or value in an ini-file. Basically escapes quotes. For example + + ini.safe('"unsafe string"') + +would result in + + "\"unsafe string\"" + +### unsafe(val) +Unescapes the string `val` http://git-wip-us.apache.org/repos/asf/incubator-cmda/blob/a9a83675/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/ini/ini.js ---------------------------------------------------------------------- diff --git a/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/ini/ini.js b/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/ini/ini.js new file mode 100644 index 0000000..eaf3209 --- /dev/null +++ b/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/ini/ini.js @@ -0,0 +1,166 @@ + +exports.parse = exports.decode = decode +exports.stringify = exports.encode = encode + +exports.safe = safe +exports.unsafe = unsafe + +var eol = process.platform === "win32" ? "\r\n" : "\n" + +function encode (obj, section) { + var children = [] + , out = "" + + Object.keys(obj).forEach(function (k, _, __) { + var val = obj[k] + if (val && Array.isArray(val)) { + val.forEach(function(item) { + out += safe(k + "[]") + " = " + safe(item) + "\n" + }) + } + else if (val && typeof val === "object") { + children.push(k) + } else { + out += safe(k) + " = " + safe(val) + eol + } + }) + + if (section && out.length) { + out = "[" + safe(section) + "]" + eol + out + } + + children.forEach(function (k, _, __) { + var nk = dotSplit(k).join('\\.') + var child = encode(obj[k], (section ? section + "." : "") + nk) + if (out.length && child.length) { + out += eol + } + out += child + }) + + return out +} + +function dotSplit (str) { + return str.replace(/\1/g, '\2LITERAL\\1LITERAL\2') + .replace(/\\\./g, '\1') + .split(/\./).map(function (part) { + return part.replace(/\1/g, '\\.') + .replace(/\2LITERAL\\1LITERAL\2/g, '\1') + }) +} + +function decode (str) { + var out = {} + , p = out + , section = null + , state = "START" + // section |key = value + , re = /^\[([^\]]*)\]$|^([^=]+)(=(.*))?$/i + , lines = str.split(/[\r\n]+/g) + , section = null + + lines.forEach(function (line, _, __) { + if (!line || line.match(/^\s*;/)) return + var match = line.match(re) + if (!match) return + if (match[1] !== undefined) { + section = unsafe(match[1]) + p = out[section] = out[section] || {} + return + } + var key = unsafe(match[2]) + , value = match[3] ? unsafe((match[4] || "")) : true + switch (value) { + case 'true': + case 'false': + case 'null': value = JSON.parse(value) + } + + // Convert keys with '[]' suffix to an array + if (key.length > 2 && key.slice(-2) === "[]") { + key = key.substring(0, key.length - 2) + if (!p[key]) { + p[key] = [] + } + else if (!Array.isArray(p[key])) { + p[key] = [p[key]] + } + } + + // safeguard against resetting a previously defined + // array by accidentally forgetting the brackets + if (Array.isArray(p[key])) { + p[key].push(value) + } + else { + p[key] = value + } + }) + + // {a:{y:1},"a.b":{x:2}} --> {a:{y:1,b:{x:2}}} + // use a filter to return the keys that have to be deleted. + Object.keys(out).filter(function (k, _, __) { + if (!out[k] || typeof out[k] !== "object" || Array.isArray(out[k])) return false + // see if the parent section is also an object. + // if so, add it to that, and mark this one for deletion + var parts = dotSplit(k) + , p = out + , l = parts.pop() + , nl = l.replace(/\\\./g, '.') + parts.forEach(function (part, _, __) { + if (!p[part] || typeof p[part] !== "object") p[part] = {} + p = p[part] + }) + if (p === out && nl === l) return false + p[nl] = out[k] + return true + }).forEach(function (del, _, __) { + delete out[del] + }) + + return out +} + +function safe (val) { + return ( typeof val !== "string" + || val.match(/[\r\n]/) + || val.match(/^\[/) + || (val.length > 1 + && val.charAt(0) === "\"" + && val.slice(-1) === "\"") + || val !== val.trim() ) + ? JSON.stringify(val) + : val.replace(/;/g, '\\;') +} + +function unsafe (val, doUnesc) { + val = (val || "").trim() + if (val.charAt(0) === "\"" && val.slice(-1) === "\"") { + try { val = JSON.parse(val) } catch (_) {} + } else { + // walk the val to find the first not-escaped ; character + var esc = false + var unesc = ""; + for (var i = 0, l = val.length; i < l; i++) { + var c = val.charAt(i) + if (esc) { + if (c === "\\" || c === ";") + unesc += c + else + unesc += "\\" + c + esc = false + } else if (c === ";") { + break + } else if (c === "\\") { + esc = true + } else { + unesc += c + } + } + if (esc) + unesc += "\\" + return unesc + } + return val +} http://git-wip-us.apache.org/repos/asf/incubator-cmda/blob/a9a83675/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/ini/package.json ---------------------------------------------------------------------- diff --git a/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/ini/package.json b/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/ini/package.json new file mode 100644 index 0000000..41c6360 --- /dev/null +++ b/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/ini/package.json @@ -0,0 +1,29 @@ +{ + "author": { + "name": "Isaac Z. Schlueter", + "email": "i...@izs.me", + "url": "http://blog.izs.me/" + }, + "name": "ini", + "description": "An ini encoder/decoder for node", + "version": "1.1.0", + "repository": { + "type": "git", + "url": "git://github.com/isaacs/ini.git" + }, + "main": "ini.js", + "scripts": { + "test": "tap test/*.js" + }, + "engines": { + "node": "*" + }, + "dependencies": {}, + "devDependencies": { + "tap": "~0.0.9" + }, + "readme": "An ini format parser and serializer for node.\n\nSections are treated as nested objects. Items before the first heading\nare saved on the object directly.\n\n## Usage\n\nConsider an ini-file `config.ini` that looks like this:\n\n ; this comment is being ignored\n scope = global\n\n [database]\n user = dbuser\n password = dbpassword\n database = use_this_database\n\n [paths.default]\n datadir = /var/lib/data\n array[] = first value\n array[] = second value\n array[] = third value\n\nYou can read, manipulate and write the ini-file like so:\n\n var fs = require('fs')\n , ini = require('ini')\n\n var config = ini.parse(fs.readFileSync('./config.ini', 'utf-8'))\n\n config.scope = 'local'\n config.database.database = 'use_another_database'\n config.paths.default.tmpdir = '/tmp'\n delete config.paths.default.datadir\n config.paths.default.array.push('fourth value')\n\n fs.writeFileSync('./config_modified.ini', ini. stringify(config, 'section'))\n\nThis will result in a file called `config_modified.ini` being written to the filesystem with the following content:\n\n [section]\n scope = local\n [section.database]\n user = dbuser\n password = dbpassword\n database = use_another_database\n [section.paths.default]\n tmpdir = /tmp\n array[] = first value\n array[] = second value\n array[] = third value\n array[] = fourth value\n\n\n## API\n\n### decode(inistring)\nDecode the ini-style formatted `inistring` into a nested object.\n\n### parse(inistring)\nAlias for `decode(inistring)`\n\n### encode(object, [section])\nEncode the object `object` into an ini-style formatted string. If the optional parameter `section` is given, then all top-level properties of the object are put into this section and the `section`-string is prepended to all sub-sections, see the usage example above.\n\n### stringify(object, [section])\nAlias for `encode(object, [section])`\n\n### safe(v al)\nEscapes the string `val` such that it is safe to be used as a key or value in an ini-file. Basically escapes quotes. For example\n\n ini.safe('\"unsafe string\"')\n\nwould result in\n\n \"\\\"unsafe string\\\"\"\n\n### unsafe(val)\nUnescapes the string `val`\n", + "readmeFilename": "README.md", + "_id": "ini@1.1.0", + "_from": "ini@latest" +} http://git-wip-us.apache.org/repos/asf/incubator-cmda/blob/a9a83675/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/ini/test/bar.js ---------------------------------------------------------------------- diff --git a/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/ini/test/bar.js b/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/ini/test/bar.js new file mode 100644 index 0000000..cb16176 --- /dev/null +++ b/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/ini/test/bar.js @@ -0,0 +1,23 @@ +//test that parse(stringify(obj) deepEqu + +var ini = require('../') +var test = require('tap').test + +var data = { + 'number': {count: 10}, + 'string': {drink: 'white russian'}, + 'boolean': {isTrue: true}, + 'nested boolean': {theDude: {abides: true, rugCount: 1}} +} + + +test('parse(stringify(x)) deepEqual x', function (t) { + + for (var k in data) { + var s = ini.stringify(data[k]) + console.log(s, data[k]) + t.deepEqual(ini.parse(s), data[k]) + } + + t.end() +}) http://git-wip-us.apache.org/repos/asf/incubator-cmda/blob/a9a83675/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/ini/test/fixtures/foo.ini ---------------------------------------------------------------------- diff --git a/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/ini/test/fixtures/foo.ini b/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/ini/test/fixtures/foo.ini new file mode 100644 index 0000000..1d81378 --- /dev/null +++ b/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/ini/test/fixtures/foo.ini @@ -0,0 +1,47 @@ +o = p + + a with spaces = b c + +; wrap in quotes to JSON-decode and preserve spaces +" xa n p " = "\"\r\nyoyoyo\r\r\n" + +; wrap in quotes to get a key with a bracket, not a section. +"[disturbing]" = hey you never know + +; Test arrays +zr[] = deedee +ar[] = one +ar[] = three +; This should be included in the array +ar = this is included + +; Test resetting of a value (and not turn it into an array) +br = cold +br = warm + +; a section +[a] +av = a val +e = { o: p, a: { av: a val, b: { c: { e: "this [value]" } } } } +j = "{ o: "p", a: { av: "a val", b: { c: { e: "this [value]" } } } }" +"[]" = a square? + +; Nested array +cr[] = four +cr[] = eight + +; nested child without middle parent +; should create otherwise-empty a.b +[a.b.c] +e = 1 +j = 2 + +; dots in the section name should be literally interpreted +[x\.y\.z] +x.y.z = xyz + +[x\.y\.z.a\.b\.c] +a.b.c = abc + +; this next one is not a comment! it's escaped! +nocomment = this\; this is not a comment http://git-wip-us.apache.org/repos/asf/incubator-cmda/blob/a9a83675/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/ini/test/foo.js ---------------------------------------------------------------------- diff --git a/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/ini/test/foo.js b/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/ini/test/foo.js new file mode 100644 index 0000000..3a05eaf --- /dev/null +++ b/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/ini/test/foo.js @@ -0,0 +1,71 @@ +var i = require("../") + , tap = require("tap") + , test = tap.test + , fs = require("fs") + , path = require("path") + , fixture = path.resolve(__dirname, "./fixtures/foo.ini") + , data = fs.readFileSync(fixture, "utf8") + , d + , expectE = 'o = p\n' + + 'a with spaces = b c\n' + + '" xa n p " = "\\"\\r\\nyoyoyo\\r\\r\\n"\n' + + '"[disturbing]" = hey you never know\n' + + 'zr[] = deedee\n' + + 'ar[] = one\n' + + 'ar[] = three\n' + + 'ar[] = this is included\n' + + 'br = warm\n' + + '\n' + + '[a]\n' + + 'av = a val\n' + + 'e = { o: p, a: ' + + '{ av: a val, b: { c: { e: "this [value]" ' + + '} } } }\nj = "\\"{ o: \\"p\\", a: { av:' + + ' \\"a val\\", b: { c: { e: \\"this [value]' + + '\\" } } } }\\""\n"[]" = a square?\n' + + 'cr[] = four\ncr[] = eight\n\n' + +'[a.b.c]\ne = 1\n' + + 'j = 2\n\n[x\\.y\\.z]\nx.y.z = xyz\n\n' + + '[x\\.y\\.z.a\\.b\\.c]\na.b.c = abc\n' + + 'nocomment = this\\; this is not a comment\n' + , expectD = + { o: 'p', + 'a with spaces': 'b c', + " xa n p ":'"\r\nyoyoyo\r\r\n', + '[disturbing]': 'hey you never know', + 'zr': ['deedee'], + 'ar': ['one', 'three', 'this is included'], + 'br': 'warm', + a: + { av: 'a val', + e: '{ o: p, a: { av: a val, b: { c: { e: "this [value]" } } } }', + j: '"{ o: "p", a: { av: "a val", b: { c: { e: "this [value]" } } } }"', + "[]": "a square?", + cr: ['four', 'eight'], + b: { c: { e: '1', j: '2' } } }, + 'x.y.z': { + 'x.y.z': 'xyz', + 'a.b.c': { + 'a.b.c': 'abc', + 'nocomment': 'this\; this is not a comment' + } + } + } + +test("decode from file", function (t) { + var d = i.decode(data) + t.deepEqual(d, expectD) + t.end() +}) + +test("encode from data", function (t) { + var e = i.encode(expectD) + t.deepEqual(e, expectE) + + var obj = {log: { type:'file', level: {label:'debug', value:10} } } + e = i.encode(obj) + t.notEqual(e.slice(0, 1), '\n', 'Never a blank first line') + t.notEqual(e.slice(-2), '\n\n', 'Never a blank final line') + + t.end() +}) http://git-wip-us.apache.org/repos/asf/incubator-cmda/blob/a9a83675/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/init-package-json/README.md ---------------------------------------------------------------------- diff --git a/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/init-package-json/README.md b/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/init-package-json/README.md new file mode 100644 index 0000000..3bdd35f --- /dev/null +++ b/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/init-package-json/README.md @@ -0,0 +1,43 @@ +# init-package-json + +A node module to get your node module started. + +## Usage + +```javascript +var init = require('init-package-json') +var path = require('path') + +// a path to a promzard module. In the event that this file is +// not found, one will be provided for you. +var initFile = path.resolve(process.env.HOME, '.npm-init') + +// the dir where we're doin stuff. +var dir = process.cwd() + +// extra stuff that gets put into the PromZard module's context. +// In npm, this is the resolved config object. Exposed as 'config' +// Optional. +var configData = { some: 'extra stuff' } + +// Any existing stuff from the package.json file is also exposed in the +// PromZard module as the `package` object. There will also be free +// vars for: +// * `filename` path to the package.json file +// * `basename` the tip of the package dir +// * `dirname` the parent of the package dir + +init(dir, initFile, configData, function (er, data) { + // the data's already been written to {dir}/package.json + // now you can do stuff with it +}) +``` + +Or from the command line: + +``` +$ npm-init +``` + +See [PromZard](https://github.com/isaacs/promzard) for details about +what can go in the config file. http://git-wip-us.apache.org/repos/asf/incubator-cmda/blob/a9a83675/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/init-package-json/default-input.js ---------------------------------------------------------------------- diff --git a/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/init-package-json/default-input.js b/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/init-package-json/default-input.js new file mode 100644 index 0000000..b4c01a2 --- /dev/null +++ b/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/init-package-json/default-input.js @@ -0,0 +1,181 @@ +var fs = require('fs') +var path = require('path') +var glob = require('glob') + +// more popular packages should go here, maybe? +function isTestPkg (p) { + return !!p.match(/^(expresso|mocha|tap|coffee-script|coco|streamline)$/) +} + +function niceName (n) { + return n.replace(/^node-|[.-]js$/g, '') +} + +function readDeps (test) { return function (cb) { + fs.readdir('node_modules', function (er, dir) { + if (er) return cb() + var deps = {} + var n = dir.length + if (n === 0) return cb(null, deps) + dir.forEach(function (d) { + if (d.match(/^\./)) return next() + if (test !== isTestPkg(d)) + return next() + + var dp = path.join(dirname, 'node_modules', d, 'package.json') + fs.readFile(dp, 'utf8', function (er, p) { + if (er) return next() + try { p = JSON.parse(p) } + catch (e) { return next() } + if (!p.version) return next() + deps[d] = '~' + p.version + return next() + }) + }) + function next () { + if (--n === 0) return cb(null, deps) + } + }) +}} + + +exports.name = prompt('name', package.name || basename) +exports.version = prompt('version', package.version || '0.0.0') +if (!package.description) { + exports.description = prompt('description') +} + +if (!package.main) { + exports.main = function (cb) { + fs.readdir(dirname, function (er, f) { + if (er) f = [] + + f = f.filter(function (f) { + return f.match(/\.js$/) + }) + + if (f.indexOf('index.js') !== -1) + f = 'index.js' + else if (f.indexOf('main.js') !== -1) + f = 'main.js' + else if (f.indexOf(basename + '.js') !== -1) + f = basename + '.js' + else + f = f[0] + + return cb(null, prompt('entry point', f || 'index.js')) + }) + } +} + +if (!package.bin) { + exports.bin = function (cb) { + fs.readdir(path.resolve(dirname, 'bin'), function (er, d) { + // no bins + if (er) return cb() + // just take the first js file we find there, or nada + return cb(null, d.filter(function (f) { + return f.match(/\.js$/) + })[0]) + }) + } +} + +exports.directories = function (cb) { + fs.readdir(dirname, function (er, dirs) { + if (er) return cb(er) + var res = {} + dirs.forEach(function (d) { + switch (d) { + case 'example': case 'examples': return res.example = d + case 'test': case 'tests': return res.test = d + case 'doc': case 'docs': return res.doc = d + case 'man': return res.man = d + } + }) + if (Object.keys(res).length === 0) res = undefined + return cb(null, res) + }) +} + +if (!package.dependencies) { + exports.dependencies = readDeps(false) +} + +if (!package.devDependencies) { + exports.devDependencies = readDeps(true) +} + +// MUST have a test script! +var s = package.scripts || {} +var notest = 'echo "Error: no test specified" && exit 1' +if (!package.scripts) { + exports.scripts = function (cb) { + fs.readdir(path.join(dirname, 'node_modules'), function (er, d) { + setupScripts(d || [], cb) + }) + } +} +function setupScripts (d, cb) { + // check to see what framework is in use, if any + function tx (test) { + return test || notest + } + + if (!s.test || s.test === notest) { + if (d.indexOf('tap') !== -1) + s.test = prompt('test command', 'tap test/*.js', tx) + else if (d.indexOf('expresso') !== -1) + s.test = prompt('test command', 'expresso test', tx) + else if (d.indexOf('mocha') !== -1) + s.test = prompt('test command', 'mocha', tx) + else + s.test = prompt('test command', tx) + } + + return cb(null, s) +} + +if (!package.repository) { + exports.repository = function (cb) { + fs.readFile('.git/config', 'utf8', function (er, gconf) { + if (er || !gconf) return cb(null, prompt('git repository')) + + gconf = gconf.split(/\r?\n/) + var i = gconf.indexOf('[remote "origin"]') + if (i !== -1) { + var u = gconf[i + 1] + if (!u.match(/^\s*url =/)) u = gconf[i + 2] + if (!u.match(/^\s*url =/)) u = null + else u = u.replace(/^\s*url = /, '') + } + if (u && u.match(/^g...@github.com:/)) + u = u.replace(/^g...@github.com:/, 'git://github.com/') + + return cb(null, prompt('git repository', u)) + }) + } +} + +if (!package.keywords) { + exports.keywords = prompt('keywords', function (s) { + if (!s) return undefined + if (Array.isArray(s)) s = s.join(' ') + if (typeof s !== 'string') return s + return s.split(/[\s,]+/) + }) +} + +if (!package.author) { + exports.author = config.get('init.author.name') + ? { + "name" : config.get('init.author.name'), + "email" : config.get('init.author.email'), + "url" : config.get('init.author.url') + } + : prompt('author') +} + +exports.license = prompt('license', package.license || + config.get('init.license') || + 'BSD-2-Clause') http://git-wip-us.apache.org/repos/asf/incubator-cmda/blob/a9a83675/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/init-package-json/example/example-basic.js ---------------------------------------------------------------------- diff --git a/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/init-package-json/example/example-basic.js b/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/init-package-json/example/example-basic.js new file mode 100644 index 0000000..29b0c81 --- /dev/null +++ b/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/init-package-json/example/example-basic.js @@ -0,0 +1,8 @@ +var init = require('../init-package-json.js') +var path = require('path') +var dir = process.cwd() +var initFile = require.resolve('./init/basic-init.js') + +init(dir, initFile, function (err, data) { + if (!err) console.log('written successfully') +}) http://git-wip-us.apache.org/repos/asf/incubator-cmda/blob/a9a83675/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/init-package-json/example/example-default.js ---------------------------------------------------------------------- diff --git a/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/init-package-json/example/example-default.js b/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/init-package-json/example/example-default.js new file mode 100644 index 0000000..f3aea51 --- /dev/null +++ b/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/init-package-json/example/example-default.js @@ -0,0 +1,7 @@ +var init = require('../init-package-json.js') +var path = require('path') +var dir = process.cwd() + +init(dir, 'file that does not exist', function (err, data) { + if (!err) console.log('written successfully') +}) http://git-wip-us.apache.org/repos/asf/incubator-cmda/blob/a9a83675/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/init-package-json/example/example-npm.js ---------------------------------------------------------------------- diff --git a/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/init-package-json/example/example-npm.js b/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/init-package-json/example/example-npm.js new file mode 100644 index 0000000..b394eea --- /dev/null +++ b/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/init-package-json/example/example-npm.js @@ -0,0 +1,13 @@ +var init = require('../init-package-json.js') +var path = require('path') +var dir = process.cwd() +var npm = require('npm') + +npm.load(function (er, npm) { + if (er) throw er + init(dir, npm.config.get('init-module'), npm.config, function (er, data) { + if (er) throw er + console.log('written successfully') + }) +}) + http://git-wip-us.apache.org/repos/asf/incubator-cmda/blob/a9a83675/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/init-package-json/example/init/basic-init.js ---------------------------------------------------------------------- diff --git a/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/init-package-json/example/init/basic-init.js b/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/init-package-json/example/init/basic-init.js new file mode 100644 index 0000000..c8615cc --- /dev/null +++ b/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/init-package-json/example/init/basic-init.js @@ -0,0 +1 @@ +exports.flavor = prompt("what's your favorite flavor of ice cream buddy?", "I LIKE THEM ALL") \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-cmda/blob/a9a83675/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/init-package-json/init-package-json.js ---------------------------------------------------------------------- diff --git a/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/init-package-json/init-package-json.js b/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/init-package-json/init-package-json.js new file mode 100644 index 0000000..2600e77 --- /dev/null +++ b/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/init-package-json/init-package-json.js @@ -0,0 +1,129 @@ + +module.exports = init + +var PZ = require('promzard').PromZard +var path = require('path') +var def = require.resolve('./default-input.js') + +var fs = require('fs') +var semver = require('semver') +var read = require('read') + +// to validate the data object at the end as a worthwhile package +// and assign default values for things. +// readJson.extras(file, data, cb) +var readJson = require('read-package-json') + +function init (dir, input, config, cb) { + if (typeof config === 'function') + cb = config, config = {} + + // accept either a plain-jane object, or a config object + // with a "get" method. + if (typeof config.get !== 'function') { + var data = config + config = { + get: function (k) { + return data[k] + }, + toJSON: function () { + return data + } + } + } + + var package = path.resolve(dir, 'package.json') + input = path.resolve(input) + var pkg + var ctx = {} + + var es = readJson.extraSet + readJson.extraSet = es.filter(function (fn) { + return fn.name !== 'authors' && fn.name !== 'mans' + }) + readJson(package, function (er, d) { + readJson.extraSet = es + + if (er) pkg = {} + else pkg = d + + ctx.filename = package + ctx.dirname = path.dirname(package) + ctx.basename = path.basename(ctx.dirname) + if (!pkg.version || !semver.valid(pkg.version)) + delete pkg.version + + ctx.package = pkg + ctx.config = config || {} + + // make sure that the input is valid. + // if not, use the default + var pz = new PZ(input, ctx) + pz.backupFile = def + pz.on('error', cb) + pz.on('data', function (data) { + Object.keys(data).forEach(function (k) { + if (data[k] !== undefined && data[k] !== null) pkg[k] = data[k] + }) + + // only do a few of these. + // no need for mans or contributors if they're in the files + var es = readJson.extraSet + readJson.extraSet = es.filter(function (fn) { + return fn.name !== 'authors' && fn.name !== 'mans' + }) + readJson.extras(package, pkg, function (er, pkg) { + readJson.extraSet = es + if (er) return cb(er, pkg) + pkg = unParsePeople(pkg) + // no need for the readme now. + delete pkg.readme + delete pkg.readmeFilename + + // really don't want to have this lying around in the file + delete pkg._id + + // ditto + delete pkg.gitHead + + // if the repo is empty, remove it. + if (!pkg.repository) + delete pkg.repository + + var d = JSON.stringify(pkg, null, 2) + '\n' + console.log('About to write to %s:\n\n%s\n', package, d) + read({prompt:'Is this ok? ', default: 'yes'}, function (er, ok) { + if (!ok || ok.toLowerCase().charAt(0) !== 'y') { + console.log('Aborted.') + } else { + fs.writeFile(package, d, 'utf8', function (er) { + return cb(er, pkg) + }) + } + }) + }) + }) + }) + +} + +// turn the objects into somewhat more humane strings. +function unParsePeople (data) { + if (data.author) data.author = unParsePerson(data.author) + ;["maintainers", "contributors"].forEach(function (set) { + if (!Array.isArray(data[set])) return; + data[set] = data[set].map(unParsePerson) + }) + return data +} + +function unParsePerson (person) { + if (typeof person === "string") return person + var name = person.name || "" + var u = person.url || person.web + var url = u ? (" ("+u+")") : "" + var e = person.email || person.mail + var email = e ? (" <"+e+">") : "" + return name+email+url +} + http://git-wip-us.apache.org/repos/asf/incubator-cmda/blob/a9a83675/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/init-package-json/node_modules/promzard/.npmignore ---------------------------------------------------------------------- diff --git a/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/init-package-json/node_modules/promzard/.npmignore b/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/init-package-json/node_modules/promzard/.npmignore new file mode 100644 index 0000000..15a1789 --- /dev/null +++ b/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/init-package-json/node_modules/promzard/.npmignore @@ -0,0 +1 @@ +example/npm-init/package.json http://git-wip-us.apache.org/repos/asf/incubator-cmda/blob/a9a83675/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/init-package-json/node_modules/promzard/LICENSE ---------------------------------------------------------------------- diff --git a/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/init-package-json/node_modules/promzard/LICENSE b/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/init-package-json/node_modules/promzard/LICENSE new file mode 100644 index 0000000..05eeeb8 --- /dev/null +++ b/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/init-package-json/node_modules/promzard/LICENSE @@ -0,0 +1,15 @@ +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/incubator-cmda/blob/a9a83675/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/init-package-json/node_modules/promzard/README.md ---------------------------------------------------------------------- diff --git a/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/init-package-json/node_modules/promzard/README.md b/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/init-package-json/node_modules/promzard/README.md new file mode 100644 index 0000000..93c0418 --- /dev/null +++ b/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/init-package-json/node_modules/promzard/README.md @@ -0,0 +1,133 @@ +# promzard + +A prompting wizard for building files from specialized PromZard modules. +Used by `npm init`. + +A reimplementation of @SubStack's +[prompter](https://github.com/substack/node-prompter), which does not +use AST traversal. + +From another point of view, it's a reimplementation of +[@Marak](https://github.com/marak)'s +[wizard](https://github.com/Marak/wizard) which doesn't use schemas. + +The goal is a nice drop-in enhancement for `npm init`. + +## Usage + +```javascript +var promzard = require('promzard') +promzard(inputFile, optionalContextAdditions, function (er, data) { + // .. you know what you doing .. +}) +``` + +In the `inputFile` you can have something like this: + +```javascript +var fs = require('fs') +module.exports = { + "greeting": prompt("Who shall you greet?", "world", function (who) { + return "Hello, " + who + }), + "filename": __filename, + "directory": function (cb) { + fs.readdir(__dirname, cb) + } +} +``` + +When run, promzard will display the prompts and resolve the async +functions in order, and then either give you an error, or the resolved +data, ready to be dropped into a JSON file or some other place. + + +### promzard(inputFile, ctx, callback) + +The inputFile is just a node module. You can require() things, set +module.exports, etc. Whatever that module exports is the result, and it +is walked over to call any functions as described below. + +The only caveat is that you must give PromZard the full absolute path +to the module (you can get this via Node's `require.resolve`.) Also, +the `prompt` function is injected into the context object, so watch out. + +Whatever you put in that `ctx` will of course also be available in the +module. You can get quite fancy with this, passing in existing configs +and so on. + +### Class: promzard.PromZard(file, ctx) + +Just like the `promzard` function, but the EventEmitter that makes it +all happen. Emits either a `data` event with the data, or a `error` +event if it blows up. + +If `error` is emitted, then `data` never will be. + +### prompt(...) + +In the promzard input module, you can call the `prompt` function. +This prompts the user to input some data. The arguments are interpreted +based on type: + +1. `string` The first string encountered is the prompt. The second is + the default value. +2. `function` A transformer function which receives the data and returns + something else. More than meets the eye. +3. `object` The `prompt` member is the prompt, the `default` member is + the default value, and the `transform` is the transformer. + +Whatever the final value is, that's what will be put on the resulting +object. + +### Functions + +If there are any functions on the promzard input module's exports, then +promzard will call each of them with a callback. This way, your module +can do asynchronous actions if necessary to validate or ascertain +whatever needs verification. + +The functions are called in the context of the ctx object, and are given +a single argument, which is a callback that should be called with either +an error, or the result to assign to that spot. + +In the async function, you can also call prompt() and return the result +of the prompt in the callback. + +For example, this works fine in a promzard module: + +``` +exports.asyncPrompt = function (cb) { + fs.stat(someFile, function (er, st) { + // if there's an error, no prompt, just error + // otherwise prompt and use the actual file size as the default + cb(er, prompt('file size', st.size)) + }) +} +``` + +You can also return other async functions in the async function +callback. Though that's a bit silly, it could be a handy way to reuse +functionality in some cases. + +### Sync vs Async + +The `prompt()` function is not synchronous, though it appears that way. +It just returns a token that is swapped out when the data object is +walked over asynchronously later, and returns a token. + +For that reason, prompt() calls whose results don't end up on the data +object are never shown to the user. For example, this will only prompt +once: + +``` +exports.promptThreeTimes = prompt('prompt me once', 'shame on you') +exports.promptThreeTimes = prompt('prompt me twice', 'um....') +exports.promptThreeTimes = prompt('you cant prompt me again') +``` + +### Isn't this exactly the sort of 'looks sync' that you said was bad about other libraries? + +Yeah, sorta. I wouldn't use promzard for anything more complicated than +a wizard that spits out prompts to set up a config file or something. +Maybe there are other use cases I haven't considered. http://git-wip-us.apache.org/repos/asf/incubator-cmda/blob/a9a83675/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/init-package-json/node_modules/promzard/example/index.js ---------------------------------------------------------------------- diff --git a/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/init-package-json/node_modules/promzard/example/index.js b/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/init-package-json/node_modules/promzard/example/index.js new file mode 100644 index 0000000..435131f --- /dev/null +++ b/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/init-package-json/node_modules/promzard/example/index.js @@ -0,0 +1,11 @@ +var pz = require('../promzard') + +var path = require('path') +var file = path.resolve(__dirname, 'substack-input.js') +var ctx = { basename: path.basename(path.dirname(file)) } + +pz(file, ctx, function (er, res) { + if (er) + throw er + console.error(JSON.stringify(res, null, 2)) +}) http://git-wip-us.apache.org/repos/asf/incubator-cmda/blob/a9a83675/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/init-package-json/node_modules/promzard/example/npm-init/README.md ---------------------------------------------------------------------- diff --git a/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/init-package-json/node_modules/promzard/example/npm-init/README.md b/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/init-package-json/node_modules/promzard/example/npm-init/README.md new file mode 100644 index 0000000..46e5592 --- /dev/null +++ b/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/init-package-json/node_modules/promzard/example/npm-init/README.md @@ -0,0 +1,8 @@ +# npm-init + +An initter you init wit, innit? + +## More stuff here + +Blerp derp herp lerg borgle pop munch efemerate baz foo a gandt synergy +jorka chatt slurm. http://git-wip-us.apache.org/repos/asf/incubator-cmda/blob/a9a83675/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/init-package-json/node_modules/promzard/example/npm-init/init-input.js ---------------------------------------------------------------------- diff --git a/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/init-package-json/node_modules/promzard/example/npm-init/init-input.js b/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/init-package-json/node_modules/promzard/example/npm-init/init-input.js new file mode 100644 index 0000000..ba7781b --- /dev/null +++ b/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/init-package-json/node_modules/promzard/example/npm-init/init-input.js @@ -0,0 +1,191 @@ +var fs = require('fs') +var path = require('path'); + +module.exports = { + "name" : prompt('name', + typeof name === 'undefined' + ? basename.replace(/^node-|[.-]js$/g, ''): name), + "version" : prompt('version', typeof version !== "undefined" + ? version : '0.0.0'), + "description" : (function () { + if (typeof description !== 'undefined' && description) { + return description + } + var value; + try { + var src = fs.readFileSync('README.md', 'utf8'); + value = src.split('\n').filter(function (line) { + return /\s+/.test(line) + && line.trim() !== basename.replace(/^node-/, '') + && !line.trim().match(/^#/) + ; + })[0] + .trim() + .replace(/^./, function (c) { return c.toLowerCase() }) + .replace(/\.$/, '') + ; + } + catch (e) { + try { + // Wouldn't it be nice if that file mattered? + var d = fs.readFileSync('.git/description', 'utf8') + } catch (e) {} + if (d.trim() && !value) value = d + } + return prompt('description', value); + })(), + "main" : (function () { + var f + try { + f = fs.readdirSync(dirname).filter(function (f) { + return f.match(/\.js$/) + }) + if (f.indexOf('index.js') !== -1) + f = 'index.js' + else if (f.indexOf('main.js') !== -1) + f = 'main.js' + else if (f.indexOf(basename + '.js') !== -1) + f = basename + '.js' + else + f = f[0] + } catch (e) {} + + return prompt('entry point', f || 'index.js') + })(), + "bin" : function (cb) { + fs.readdir(dirname + '/bin', function (er, d) { + // no bins + if (er) return cb() + // just take the first js file we find there, or nada + return cb(null, d.filter(function (f) { + return f.match(/\.js$/) + })[0]) + }) + }, + "directories" : function (cb) { + fs.readdir('.', function (er, dirs) { + if (er) return cb(er) + var res = {} + dirs.forEach(function (d) { + switch (d) { + case 'example': case 'examples': return res.example = d + case 'test': case 'tests': return res.test = d + case 'doc': case 'docs': return res.doc = d + case 'man': return res.man = d + } + }) + if (Object.keys(res).length === 0) res = undefined + return cb(null, res) + }) + }, + "dependencies" : typeof dependencies !== 'undefined' ? dependencies + : function (cb) { + fs.readdir('node_modules', function (er, dir) { + if (er) return cb() + var deps = {} + var n = dir.length + dir.forEach(function (d) { + if (d.match(/^\./)) return next() + if (d.match(/^(expresso|mocha|tap|coffee-script|coco|streamline)$/)) + return next() + fs.readFile('node_modules/' + d + '/package.json', function (er, p) { + if (er) return next() + try { p = JSON.parse(p) } catch (e) { return next() } + if (!p.version) return next() + deps[d] = '~' + p.version + return next() + }) + }) + function next () { + if (--n === 0) return cb(null, deps) + } + }) + }, + "devDependencies" : typeof devDependencies !== 'undefined' ? devDependencies + : function (cb) { + // same as dependencies but for dev deps + fs.readdir('node_modules', function (er, dir) { + if (er) return cb() + var deps = {} + var n = dir.length + dir.forEach(function (d) { + if (d.match(/^\./)) return next() + if (!d.match(/^(expresso|mocha|tap|coffee-script|coco|streamline)$/)) + return next() + fs.readFile('node_modules/' + d + '/package.json', function (er, p) { + if (er) return next() + try { p = JSON.parse(p) } catch (e) { return next() } + if (!p.version) return next() + deps[d] = '~' + p.version + return next() + }) + }) + function next () { + if (--n === 0) return cb(null, deps) + } + }) + }, + "scripts" : (function () { + // check to see what framework is in use, if any + try { var d = fs.readdirSync('node_modules') } + catch (e) { d = [] } + var s = typeof scripts === 'undefined' ? {} : scripts + + if (d.indexOf('coffee-script') !== -1) + s.prepublish = prompt('build command', + s.prepublish || 'coffee src/*.coffee -o lib') + + var notest = 'echo "Error: no test specified" && exit 1' + function tx (test) { + return test || notest + } + + if (!s.test || s.test === notest) { + if (d.indexOf('tap') !== -1) + s.test = prompt('test command', 'tap test/*.js', tx) + else if (d.indexOf('expresso') !== -1) + s.test = prompt('test command', 'expresso test', tx) + else if (d.indexOf('mocha') !== -1) + s.test = prompt('test command', 'mocha', tx) + else + s.test = prompt('test command', tx) + } + + return s + + })(), + + "repository" : (function () { + try { var gconf = fs.readFileSync('.git/config') } + catch (e) { gconf = null } + if (gconf) { + gconf = gconf.split(/\r?\n/) + var i = gconf.indexOf('[remote "origin"]') + if (i !== -1) { + var u = gconf[i + 1] + if (!u.match(/^\s*url =/)) u = gconf[i + 2] + if (!u.match(/^\s*url =/)) u = null + else u = u.replace(/^\s*url = /, '') + } + if (u && u.match(/^g...@github.com:/)) + u = u.replace(/^g...@github.com:/, 'git://github.com/') + } + + return prompt('git repository', u) + })(), + + "keywords" : prompt(function (s) { + if (!s) return undefined + if (Array.isArray(s)) s = s.join(' ') + if (typeof s !== 'string') return s + return s.split(/[\s,]+/) + }), + "author" : config['init.author.name'] + ? { + "name" : config['init.author.name'], + "email" : config['init.author.email'], + "url" : config['init.author.url'] + } + : undefined, + "license" : prompt('license', 'BSD') +} http://git-wip-us.apache.org/repos/asf/incubator-cmda/blob/a9a83675/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/init-package-json/node_modules/promzard/example/npm-init/init.js ---------------------------------------------------------------------- diff --git a/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/init-package-json/node_modules/promzard/example/npm-init/init.js b/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/init-package-json/node_modules/promzard/example/npm-init/init.js new file mode 100644 index 0000000..09484cd --- /dev/null +++ b/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/init-package-json/node_modules/promzard/example/npm-init/init.js @@ -0,0 +1,37 @@ +var PZ = require('../../promzard').PromZard +var path = require('path') +var input = path.resolve(__dirname, 'init-input.js') + +var fs = require('fs') +var package = path.resolve(__dirname, 'package.json') +var pkg + +fs.readFile(package, 'utf8', function (er, d) { + if (er) ctx = {} + try { ctx = JSON.parse(d); pkg = JSON.parse(d) } + catch (e) { ctx = {} } + + ctx.dirname = path.dirname(package) + ctx.basename = path.basename(ctx.dirname) + if (!ctx.version) ctx.version = undefined + + // this should be replaced with the npm conf object + ctx.config = {} + + console.error('ctx=', ctx) + + var pz = new PZ(input, ctx) + + pz.on('data', function (data) { + console.error('pz data', data) + if (!pkg) pkg = {} + Object.keys(data).forEach(function (k) { + if (data[k] !== undefined && data[k] !== null) pkg[k] = data[k] + }) + console.error('package data %s', JSON.stringify(data, null, 2)) + fs.writeFile(package, JSON.stringify(pkg, null, 2), function (er) { + if (er) throw er + console.log('ok') + }) + }) +}) http://git-wip-us.apache.org/repos/asf/incubator-cmda/blob/a9a83675/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/init-package-json/node_modules/promzard/example/npm-init/package.json ---------------------------------------------------------------------- diff --git a/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/init-package-json/node_modules/promzard/example/npm-init/package.json b/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/init-package-json/node_modules/promzard/example/npm-init/package.json new file mode 100644 index 0000000..89c6d1f --- /dev/null +++ b/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/init-package-json/node_modules/promzard/example/npm-init/package.json @@ -0,0 +1,10 @@ +{ + "name": "npm-init", + "version": "0.0.0", + "description": "an initter you init wit, innit?", + "main": "index.js", + "scripts": { + "test": "asdf" + }, + "license": "BSD" +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-cmda/blob/a9a83675/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/init-package-json/node_modules/promzard/example/substack-input.js ---------------------------------------------------------------------- diff --git a/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/init-package-json/node_modules/promzard/example/substack-input.js b/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/init-package-json/node_modules/promzard/example/substack-input.js new file mode 100644 index 0000000..bf7aedb --- /dev/null +++ b/ApacheCMDA_Backend_1.0/project/target/node-modules/webjars/npm/node_modules/init-package-json/node_modules/promzard/example/substack-input.js @@ -0,0 +1,61 @@ +module.exports = { + "name" : basename.replace(/^node-/, ''), + "version" : "0.0.0", + "description" : (function (cb) { + var fs = require('fs'); + var value; + try { + var src = fs.readFileSync('README.markdown', 'utf8'); + value = src.split('\n').filter(function (line) { + return /\s+/.test(line) + && line.trim() !== basename.replace(/^node-/, '') + ; + })[0] + .trim() + .replace(/^./, function (c) { return c.toLowerCase() }) + .replace(/\.$/, '') + ; + } + catch (e) {} + + return prompt('description', value); + })(), + "main" : prompt('entry point', 'index.js'), + "bin" : function (cb) { + var path = require('path'); + var fs = require('fs'); + var exists = fs.exists || path.exists; + exists('bin/cmd.js', function (ex) { + var bin + if (ex) { + var bin = {} + bin[basename.replace(/^node-/, '')] = 'bin/cmd.js' + } + cb(null, bin); + }); + }, + "directories" : { + "example" : "example", + "test" : "test" + }, + "dependencies" : {}, + "devDependencies" : { + "tap" : "~0.2.5" + }, + "scripts" : { + "test" : "tap test/*.js" + }, + "repository" : { + "type" : "git", + "url" : "git://github.com/substack/" + basename + ".git" + }, + "homepage" : "https://github.com/substack/" + basename, + "keywords" : prompt(function (s) { return s.split(/\s+/) }), + "author" : { + "name" : "James Halliday", + "email" : "m...@substack.net", + "url" : "http://substack.net" + }, + "license" : "MIT", + "engine" : { "node" : ">=0.6" } +}