initial commit

This commit is contained in:
2017-05-20 16:42:43 -04:00
commit e6530a1fa6
2106 changed files with 206258 additions and 0 deletions

4
node_modules/touch/.npmignore generated vendored Normal file
View File

@@ -0,0 +1,4 @@
node_modules/
coverage/
.nyc_output/
nyc_output/

8
node_modules/touch/.travis.yml generated vendored Normal file
View File

@@ -0,0 +1,8 @@
language: node_js
node_js:
- '0.8'
- '0.10'
- '0.12'
- 'iojs'
before_install:
- npm install -g npm@latest

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

@@ -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.

39
node_modules/touch/README.md generated vendored Normal file
View File

@@ -0,0 +1,39 @@
# node-touch
For all your node touching needs.
## Installing
```bash
npm install touch
```
## CLI Usage:
See `man touch`
## API Usage:
```javascript
var touch = require("touch")
```
Gives you the following functions:
* `touch(filename, options, cb)`
* `touch.sync(filename, options)`
* `touch.ftouch(fd, options, cb)`
* `touch.ftouchSync(fd, options)`
## Options
* `force` like `touch -f` Boolean
* `time` like `touch -t <date>` Can be a Date object, or any parseable
Date string, or epoch ms number.
* `atime` like `touch -a` Can be either a Boolean, or a Date.
* `mtime` like `touch -m` Can be either a Boolean, or a Date.
* `ref` like `touch -r <file>` Must be path to a file.
* `nocreate` like `touch -c` Boolean
If neither `atime` nor `mtime` are set, then both values are set. If
one of them is set, then the other is not.

32
node_modules/touch/bin/touch.js generated vendored Normal file
View File

@@ -0,0 +1,32 @@
#!/usr/bin/env node
var touch = require("../touch")
, fs = require("fs")
, path = require("path")
, nopt = require("nopt")
, types = { atime: Boolean
, mtime: Boolean
, time: Date
, ref: path
, nocreate: Boolean
, force: Boolean }
, shorthands = { a: "--atime"
, m: "--mtime"
, r: "--ref"
, t: "--time"
, c: "--nocreate"
, f: "--force" }
var options = nopt(types, shorthands)
var files = options.argv.remain
delete options.argv
files.forEach(function (file) {
touch(file, options, function (er) {
if (er) {
console.error("bad touch!")
throw er
}
console.error(file, fs.statSync(file))
})
})

91
node_modules/touch/package.json generated vendored Normal file
View File

@@ -0,0 +1,91 @@
{
"_args": [
[
{
"raw": "touch@1.0.0",
"scope": null,
"escapedName": "touch",
"name": "touch",
"rawSpec": "1.0.0",
"spec": "1.0.0",
"type": "version"
},
"C:\\Users\\chvra\\Documents\\angular-play\\nodeRest\\node_modules\\nodemon"
]
],
"_from": "touch@1.0.0",
"_id": "touch@1.0.0",
"_inCache": true,
"_location": "/touch",
"_nodeVersion": "2.2.1",
"_npmUser": {
"name": "isaacs",
"email": "isaacs@npmjs.com"
},
"_npmVersion": "3.1.0",
"_phantomChildren": {},
"_requested": {
"raw": "touch@1.0.0",
"scope": null,
"escapedName": "touch",
"name": "touch",
"rawSpec": "1.0.0",
"spec": "1.0.0",
"type": "version"
},
"_requiredBy": [
"/nodemon"
],
"_resolved": "https://registry.npmjs.org/touch/-/touch-1.0.0.tgz",
"_shasum": "449cbe2dbae5a8c8038e30d71fa0ff464947c4de",
"_shrinkwrap": null,
"_spec": "touch@1.0.0",
"_where": "C:\\Users\\chvra\\Documents\\angular-play\\nodeRest\\node_modules\\nodemon",
"author": {
"name": "Isaac Z. Schlueter",
"email": "i@izs.me",
"url": "http://blog.izs.me/"
},
"bin": {
"touch": "./bin/touch.js"
},
"bugs": {
"url": "https://github.com/isaacs/node-touch/issues"
},
"dependencies": {
"nopt": "~1.0.10"
},
"description": "like touch(1) in node",
"devDependencies": {
"tap": "^1.3.1"
},
"directories": {},
"dist": {
"shasum": "449cbe2dbae5a8c8038e30d71fa0ff464947c4de",
"tarball": "https://registry.npmjs.org/touch/-/touch-1.0.0.tgz"
},
"engines": {
"node": ">=0.6"
},
"gitHead": "f73938c01bd10fe70fae5af3f37fc8c6162e9852",
"homepage": "https://github.com/isaacs/node-touch#readme",
"license": "ISC",
"main": "touch.js",
"maintainers": [
{
"name": "isaacs",
"email": "i@izs.me"
}
],
"name": "touch",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"repository": {
"type": "git",
"url": "git://github.com/isaacs/node-touch.git"
},
"scripts": {
"test": "tap test/*.js"
},
"version": "1.0.0"
}

221
node_modules/touch/test/basic.js generated vendored Normal file
View File

@@ -0,0 +1,221 @@
var fs = require("fs")
var touch = require("../touch.js")
var t = require('tap')
function _ (fn) { return function (er) {
if (er) throw er
fn()
}}
var files = [
'sync',
'sync-ref',
'async',
'async-ref'
]
files.forEach(function (f) {
try { fs.unlinkSync(f) } catch (e) {}
})
var now = Math.floor(Date.now() / 1000) * 1000
var then = now - 1000000000 // now - 1Msec
t.test('set both to now', function (t) {
touch.sync("sync")
touch("async", _(function () {
var astat = fs.statSync("async")
var sstat = fs.statSync("sync")
var asa = astat.atime.getTime()
var ssa = sstat.atime.getTime()
var asm = astat.mtime.getTime()
var ssm = sstat.mtime.getTime()
t.equal(asm, asa)
t.equal(ssm, ssa)
t.equal(ssa, now)
t.equal(asa, now)
// ctime should always be now-ish
t.ok(Math.abs(Date.now() - sstat.ctime.getTime()) < 1000)
t.ok(Math.abs(Date.now() - astat.ctime.getTime()) < 1000)
t.end()
}))
})
t.test('set both to now, using futimes', function (t) {
function runTest (closeAfter) {
t.test('closeAfter=' + closeAfter, function (t) {
var sfd = fs.openSync('sync', 'w')
if (closeAfter) {
touch.ftouchSync(sfd, { closeAfter: true })
} else {
touch.ftouchSync(sfd)
fs.closeSync(sfd)
}
var afd = fs.openSync('async', 'w')
t.equal(afd, sfd)
var then = _(function () {
if (!closeAfter) {
fs.closeSync(afd)
}
var astat = fs.statSync("async")
var sstat = fs.statSync("sync")
var asa = astat.atime.getTime()
var ssa = sstat.atime.getTime()
var asm = astat.mtime.getTime()
var ssm = sstat.mtime.getTime()
t.equal(asm, asa)
t.equal(ssm, ssa)
t.equal(ssa, now)
t.equal(asa, now)
// ctime should always be now-ish
t.ok(Math.abs(Date.now() - sstat.ctime.getTime()) < 1000)
t.ok(Math.abs(Date.now() - astat.ctime.getTime()) < 1000)
t.end()
})
if (closeAfter) {
touch.ftouch(afd, {closeAfter: true}, then)
} else {
touch.ftouch(afd, then)
}
})
}
runTest(true)
runTest(false)
t.end()
})
t.test('set both to now - 1Msec', function (t) {
// also use force, just for funsies
touch.sync("sync", { time: then, force: true })
touch("async", { time: then, force: true }, _(function () {
var astat = fs.statSync("async")
var sstat = fs.statSync("sync")
var asa = astat.atime.getTime()
var ssa = sstat.atime.getTime()
var asm = astat.mtime.getTime()
var ssm = sstat.mtime.getTime()
t.notEqual(asm, now)
t.equal(asa, asm)
t.notEqual(ssm, now)
t.equal(ssa, ssm)
t.equal(ssa, then)
t.equal(asa, then)
t.ok(Math.abs(Date.now() - sstat.ctime.getTime()) < 1000)
t.ok(Math.abs(Date.now() - astat.ctime.getTime()) < 1000)
t.end()
}))
})
t.test('set mtime to now', function (t) {
touch.sync("sync", { time: now, mtime: true })
touch("async", { time: now, mtime: true }, _(function () {
var astat = fs.statSync("async")
var sstat = fs.statSync("sync")
var asa = astat.atime.getTime()
var ssa = sstat.atime.getTime()
var asm = astat.mtime.getTime()
var ssm = sstat.mtime.getTime()
t.notEqual(asa, asm)
t.notEqual(ssa, ssm)
t.equal(ssa, then)
t.equal(asa, then)
t.equal(ssm, now)
t.equal(asm, now)
t.ok(Math.abs(Date.now() - sstat.ctime.getTime()) < 1000)
t.ok(Math.abs(Date.now() - astat.ctime.getTime()) < 1000)
t.end()
}))
})
t.test('set atime to now', function (t) {
touch.sync("sync", { time: now, atime: true })
touch("async", { time: now, atime: true }, _(function () {
var astat = fs.statSync("async")
var sstat = fs.statSync("sync")
var asa = astat.atime.getTime()
var ssa = sstat.atime.getTime()
var asm = astat.mtime.getTime()
var ssm = sstat.mtime.getTime()
t.equal(asm, now)
t.equal(ssm, now)
t.equal(asa, now)
t.equal(ssa, now)
t.ok(Math.abs(Date.now() - sstat.ctime.getTime()) < 1000)
t.ok(Math.abs(Date.now() - astat.ctime.getTime()) < 1000)
t.end()
}))
})
t.test('nocreate should throw on ENOENT', function (t) {
t.throws(function () {
touch.sync('sync-noent', { nocreate: true })
})
touch('async-noent', { nocreate: true }, function (er) {
t.isa(er, Error)
t.end()
})
})
t.test('use one file as ref for another', function (t) {
touch.sync('sync-ref', { ref: 'sync' })
touch('async-ref', { ref: 'async' }, _(function () {
var astat = fs.statSync("async")
var sstat = fs.statSync("sync")
var arstat = fs.statSync('async-ref')
var srstat = fs.statSync('sync-ref')
var asa = astat.atime.getTime()
var ssa = sstat.atime.getTime()
var arsa = arstat.atime.getTime()
var srsa = srstat.atime.getTime()
var asm = astat.mtime.getTime()
var ssm = sstat.mtime.getTime()
var arsm = arstat.mtime.getTime()
var srsm = srstat.mtime.getTime()
var arsc = arstat.ctime.getTime()
var srsc = srstat.ctime.getTime()
t.equal(asm, arsm)
t.equal(ssm, srsm)
t.equal(asa, arsa)
t.equal(ssa, srsa)
t.ok(Math.abs(Date.now() - srsc) < 1000)
t.ok(Math.abs(Date.now() - arsc) < 1000)
t.end()
}))
})
t.test('cleanup', function (t) {
files.forEach(function (f) {
t.doesNotThrow('rm ' + f, function () {
fs.unlinkSync(f)
})
})
t.end()
})

158
node_modules/touch/touch.js generated vendored Normal file
View File

@@ -0,0 +1,158 @@
var fs = require("fs")
, cons = require("constants")
module.exports = touch
touch.touchSync = touch.sync = function (f, options) {
return touch(f, options)
}
touch.ftouch = ftouch
touch.ftouchSync = ftouch.sync = function (fd, options) {
return ftouch(fd, options)
}
function validOpts (options) {
options = Object.create(options || {})
// {mtime: true}, {ctime: true}
// If set to something else, then treat as epoch ms value
var now = new Date(options.time || Date.now())
if (!options.atime && !options.mtime) {
options.atime = options.mtime = now
} else {
if (true === options.atime) {
options.atime = now
}
if (true === options.mtime) {
options.mtime = now
}
}
var oflags = 0
if (!options.force) {
oflags = oflags | cons.O_RDWR
}
if (!options.nocreate) {
oflags = oflags | cons.O_CREAT
}
options.oflags = oflags
return options
}
function optionsRef (then, arg, options, cb) {
if (!options.ref) return then(arg, options, cb)
return cb
? fs.stat(options.ref, optionsRefcb(then, arg, options, cb))
: optionsRefcb(then, arg, options)(null, fs.statSync(options.ref))
}
function optionsRefcb (then, arg, options, cb) { return function (er, s) {
if (er) {
er.path = er.file = options.ref
return cb(er)
}
options.atime = options.atime && s.atime.getTime()
options.mtime = options.mtime && s.mtime.getTime()
// so we don't keep doing this.
options.ref = null
return then(arg, options, cb)
}}
function touch (f, options, cb) {
if (typeof options === "function") cb = options, options = null
options = validOpts(options)
return optionsRef(touch_, f, validOpts(options), cb)
}
function touch_ (f, options, cb) {
return openThenF(f, options, cb)
}
function openThenF (f, options, cb) {
options.closeAfter = true
return cb
? fs.open(f, options.oflags, openThenFcb(options, cb))
: openThenFcb(options)(null, fs.openSync(f, options.oflags))
}
function openThenFcb (options, cb) { return function (er, fd) {
if (er) {
if (fd && options.closeAfter) fs.close(fd, function () {})
return cb(er)
}
return ftouch(fd, options, cb)
}}
function ftouch (fd, options, cb) {
if (typeof options === "function") cb = options, options = null
return optionsRef(ftouch_, fd, validOpts(options), cb)
}
function ftouch_ (fd, options, cb) {
// still not set. leave as what the file already has.
return fstatThenFutimes(fd, options, cb)
}
function fstatThenFutimes (fd, options, cb) {
if (options.atime && options.mtime) return thenFutimes(fd, options, cb)
return cb
? fs.fstat(fd, fstatThenFutimescb(fd, options, cb))
: fstatThenFutimescb(fd, options)(null, fs.fstatSync(fd))
}
function fstatThenFutimescb (fd, options, cb) { return function (er, s) {
if (er) {
if (options.closeAfter) fs.close(fd, function () {})
return cb(er)
}
options.atime = options.atime || s.atime.getTime()
options.mtime = options.mtime || s.mtime.getTime()
return thenFutimes(fd, options, cb)
}}
function thenFutimes (fd, options, cb) {
if (typeof options.atime === "object") {
options.atime = options.atime.getTime()
}
if (typeof options.mtime === "object") {
options.mtime = options.mtime.getTime()
}
var a = parseInt(options.atime / 1000, 10)
, m = parseInt(options.mtime / 1000, 10)
return cb
? fs.futimes(fd, a, m, thenFutimescb(fd, options, cb))
: thenFutimescb(fd, options)(null, fs.futimesSync(fd, a, m))
}
function thenFutimescb (fd, options, cb) { return function (er, res) {
if (er) {
if (options.closeAfter) fs.close(fd, function () {})
return cb(er)
}
return finish(fd, options, res, cb)
}}
function finish (fd, options, res, cb) {
return options.closeAfter ? finishClose(fd, options, res, cb)
: cb ? cb(null, res)
: res
}
function finishClose (fd, options, res, cb) {
return cb
? fs.close(fd, finishClosecb(res, options, cb))
: finishClosecb(res, options)(null, fs.closeSync(fd))
}
function finishClosecb (res, options, cb) { return function (er) {
if (er) return cb(er)
options.closeAfter = null
return finish(null, options, res, cb)
}}