WIP - add extractor, generate snippet_data
This commit is contained in:
15
node_modules/copyfiles/.jshintrc
generated
vendored
Normal file
15
node_modules/copyfiles/.jshintrc
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
{
|
||||
"node": true,
|
||||
"curly": true,
|
||||
"eqeqeq": true,
|
||||
"immed": true,
|
||||
"newcap": true,
|
||||
"noarg": true,
|
||||
"sub": true,
|
||||
"undef": "nofunc",
|
||||
"strict": true,
|
||||
"white": true,
|
||||
"indent": 2,
|
||||
"trailing": true,
|
||||
"quotmark": "single"
|
||||
}
|
||||
7
node_modules/copyfiles/.npmignore
generated
vendored
Normal file
7
node_modules/copyfiles/.npmignore
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
node_modules
|
||||
.DS_Store
|
||||
*~
|
||||
coverage
|
||||
Thumbs.db
|
||||
.bak
|
||||
.tmp
|
||||
3
node_modules/copyfiles/.travis.yml
generated
vendored
Normal file
3
node_modules/copyfiles/.travis.yml
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- 0.10
|
||||
24
node_modules/copyfiles/copyfiles
generated
vendored
Executable file
24
node_modules/copyfiles/copyfiles
generated
vendored
Executable file
@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env node
|
||||
'use strict';
|
||||
var copyfiles = require('./index');
|
||||
var pkg = require('./package.json');
|
||||
var program = require('ltcdr');
|
||||
program.version(pkg.version)
|
||||
.option('-u, --up [levels]', 'slice a path off the bottom of the paths', parseInt)
|
||||
.option('-a --all', 'include files and directories whose names begin with a dot (.)')
|
||||
.option('-f, --flat', 'flatten the output')
|
||||
.option('-e, --exclude [pattern]', 'pattern or glob to exclude')
|
||||
.option('-s, --soft', 'do not overwrite destination files if they exist')
|
||||
.usage('[options] inFile [more files ...] outDirectory')
|
||||
.parse(process.argv);
|
||||
if (program.flat) {
|
||||
program.up = true;
|
||||
}
|
||||
copyfiles(program.args, program, function (err) {
|
||||
if (err) {
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
} else {
|
||||
process.exit(0);
|
||||
}
|
||||
});
|
||||
24
node_modules/copyfiles/copyup
generated
vendored
Executable file
24
node_modules/copyfiles/copyup
generated
vendored
Executable file
@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env node
|
||||
'use strict';
|
||||
var copyfiles = require('./index');
|
||||
var pkg = require('./package.json');
|
||||
var program = require('ltcdr');
|
||||
program.version(pkg.version)
|
||||
.option('-u, --up [levels]', 'slice a path off the bottom of the paths', parseInt, 1)
|
||||
.option('-a --all', 'include files and directories whose names begin with a dot (.)')
|
||||
.option('-f, --flat', 'flatten the output')
|
||||
.option('-e, --exclude', 'pattern or glob to exclude')
|
||||
.option('-s, --soft', 'do not overwrite destination files if they exist')
|
||||
.usage('[options] inFile [more files ...] outDirectory')
|
||||
.parse(process.argv);
|
||||
if (program.flat) {
|
||||
program.up = true;
|
||||
}
|
||||
copyfiles(program.args, program, function (err) {
|
||||
if (err) {
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
} else {
|
||||
process.exit(0);
|
||||
}
|
||||
});
|
||||
120
node_modules/copyfiles/index.js
generated
vendored
Executable file
120
node_modules/copyfiles/index.js
generated
vendored
Executable file
@ -0,0 +1,120 @@
|
||||
'use strict';
|
||||
var path = require('path');
|
||||
var fs = require('fs');
|
||||
var glob = require('glob');
|
||||
var mkdirp = require('mkdirp');
|
||||
var through = require('through2').obj;
|
||||
var noms = require('noms').obj;
|
||||
function toStream(array) {
|
||||
var length = array.length;
|
||||
var i = 0;
|
||||
return noms(function (done) {
|
||||
if (i >= length) {
|
||||
this.push(null);
|
||||
}
|
||||
this.push(array[i++]);
|
||||
done();
|
||||
});
|
||||
}
|
||||
function depth(string) {
|
||||
return path.normalize(string).split(path.sep).length - 1;
|
||||
}
|
||||
function dealWith(inPath, up) {
|
||||
if (!up) {
|
||||
return inPath;
|
||||
}
|
||||
if (up === true) {
|
||||
return path.basename(inPath);
|
||||
}
|
||||
if (depth(inPath) < up) {
|
||||
throw new Error('cant go up that far');
|
||||
}
|
||||
return path.join.apply(path, path.normalize(inPath).split(path.sep).slice(up));
|
||||
}
|
||||
module.exports = copyFiles;
|
||||
function copyFiles(args, config, callback) {
|
||||
if (typeof config === 'function') {
|
||||
callback = config;
|
||||
config = {
|
||||
up:0
|
||||
};
|
||||
}
|
||||
if (typeof config !== 'object' && config) {
|
||||
config = {
|
||||
up: config
|
||||
};
|
||||
}
|
||||
var opts = config.up || 0;
|
||||
var soft = config.soft;
|
||||
if (typeof callback !== 'function') {
|
||||
throw new Error('callback is not optional');
|
||||
}
|
||||
var input = args.slice();
|
||||
var outDir = input.pop();
|
||||
var globOpts = {};
|
||||
if (config.exclude) {
|
||||
globOpts.ignore = config.exclude;
|
||||
}
|
||||
if (config.all) {
|
||||
globOpts.dot = true;
|
||||
}
|
||||
toStream(input)
|
||||
.pipe(through(function (pathName, _, next) {
|
||||
var self = this;
|
||||
glob(pathName, globOpts, function (err, paths) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
}
|
||||
paths.forEach(function (unglobbedPath) {
|
||||
self.push(unglobbedPath);
|
||||
});
|
||||
next();
|
||||
});
|
||||
}))
|
||||
.pipe(through(function (pathName, _, next) {
|
||||
fs.stat(pathName, function (err, pathStat) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
}
|
||||
var outName = path.join(outDir, dealWith(pathName, opts));
|
||||
function done(){
|
||||
mkdirp(path.dirname(outName), function (err) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
}
|
||||
next(null, pathName);
|
||||
});
|
||||
}
|
||||
if (pathStat.isDirectory()) {
|
||||
return next();
|
||||
}
|
||||
if (!pathStat.isFile()) {
|
||||
return next(new Error('how can it be neither file nor folder?'))
|
||||
}
|
||||
if (!soft) {
|
||||
return done();
|
||||
}
|
||||
fs.stat(outName, function(err){
|
||||
if(!err){
|
||||
//file exists
|
||||
return next()
|
||||
}
|
||||
if (err.code === 'ENOENT') {
|
||||
//file does not exist
|
||||
return done();
|
||||
}
|
||||
// other error
|
||||
return next(err)
|
||||
})
|
||||
});
|
||||
}))
|
||||
.pipe(through(function (pathName, _, next) {
|
||||
var outName = path.join(outDir, dealWith(pathName, opts));
|
||||
fs.createReadStream(pathName)
|
||||
.pipe(fs.createWriteStream(outName))
|
||||
.on('error', next)
|
||||
.on('finish', next);
|
||||
}))
|
||||
.on('error', callback)
|
||||
.on('finish', callback);
|
||||
}
|
||||
19
node_modules/copyfiles/license.md
generated
vendored
Normal file
19
node_modules/copyfiles/license.md
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
# Copyright (c) 2014 Calvin Metcalf
|
||||
|
||||
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.**
|
||||
61
node_modules/copyfiles/package.json
generated
vendored
Normal file
61
node_modules/copyfiles/package.json
generated
vendored
Normal file
@ -0,0 +1,61 @@
|
||||
{
|
||||
"_from": "copyfiles@^1.2.0",
|
||||
"_id": "copyfiles@1.2.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-qNo6xBqiIgrim9PFi2mEKU8sWTw=",
|
||||
"_location": "/copyfiles",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "copyfiles@^1.2.0",
|
||||
"name": "copyfiles",
|
||||
"escapedName": "copyfiles",
|
||||
"rawSpec": "^1.2.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.2.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/gatsby"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/copyfiles/-/copyfiles-1.2.0.tgz",
|
||||
"_shasum": "a8da3ac41aa2220ae29bd3c58b6984294f2c593c",
|
||||
"_spec": "copyfiles@^1.2.0",
|
||||
"_where": "/Users/stefanfejes/Projects/30-seconds-of-python-code/node_modules/gatsby",
|
||||
"author": "",
|
||||
"bin": {
|
||||
"copyfiles": "./copyfiles",
|
||||
"copyup": "./copyup"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/calvinmetcalf/copyfiles/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"glob": "^7.0.5",
|
||||
"ltcdr": "^2.2.1",
|
||||
"minimatch": "^3.0.3",
|
||||
"mkdirp": "^0.5.1",
|
||||
"noms": "0.0.0",
|
||||
"through2": "^2.0.1"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "copy some files",
|
||||
"devDependencies": {
|
||||
"rimraf": "^2.2.6",
|
||||
"tap-spec": "^4.1.1",
|
||||
"tape": "^4.6.0"
|
||||
},
|
||||
"homepage": "https://github.com/calvinmetcalf/copyfiles#readme",
|
||||
"license": "ISC",
|
||||
"main": "index.js",
|
||||
"name": "copyfiles",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/calvinmetcalf/copyfiles.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "tape test/test.*.js | tspec"
|
||||
},
|
||||
"version": "1.2.0"
|
||||
}
|
||||
88
node_modules/copyfiles/readme.md
generated
vendored
Normal file
88
node_modules/copyfiles/readme.md
generated
vendored
Normal file
@ -0,0 +1,88 @@
|
||||
copyfiles [](https://travis-ci.org/calvinmetcalf/copyfiles)
|
||||
===
|
||||
|
||||
copy files easily
|
||||
|
||||
### Install
|
||||
|
||||
```bash
|
||||
npm install copyfiles -g
|
||||
```
|
||||
### Command Line
|
||||
|
||||
copy some files, give it a bunch of arguments, (which can include globs), the last one
|
||||
is the out directory (which it will create if necessary).
|
||||
|
||||
```bash
|
||||
copyfiles foo foobar foo/bar/*.js out
|
||||
```
|
||||
|
||||
you now have a directory called out, with the files foo and foobar in it, it also has a directory named foo with a directory named
|
||||
bar in it that has all the files from foo/bar that match the glob.
|
||||
|
||||
If all the files are in a folder that you don't want in the path out path, ex:
|
||||
|
||||
```bash
|
||||
copyfiles something/*.js out
|
||||
```
|
||||
|
||||
which would put all the js files in `out/something`, you can use the `--up` (or `-u`) option
|
||||
|
||||
```bash
|
||||
copyfiles -u 1 something/*.js out
|
||||
```
|
||||
|
||||
which would put all the js files in `out`
|
||||
|
||||
you can also just do -f which will flatten all the output into one directory, so with files ./foo/a.txt and ./foo/bar/b.txt
|
||||
|
||||
```bash
|
||||
copyfiles -f ./foo/*.txt ./foo/bar/*.txt out
|
||||
```
|
||||
|
||||
will put a.txt and b.txt into out
|
||||
|
||||
if your terminal doesn't support globstars then you can quote them
|
||||
|
||||
```bash
|
||||
copyfiles -f ./foo/**/*.txt out
|
||||
```
|
||||
|
||||
does not work by default on a mac
|
||||
|
||||
but
|
||||
|
||||
```bash
|
||||
copyfiles -f './foo/**/*.txt' out
|
||||
```
|
||||
|
||||
does.
|
||||
|
||||
You could quote globstars as a part of input:
|
||||
```bash
|
||||
copyfiles some.json './some_folder/*.json' ./dist/ && echo 'JSON files copied.'
|
||||
```
|
||||
|
||||
You can use the -e option to exclude some files from the pattern, so to exclude all all files ending in .test.js you could do
|
||||
|
||||
```bash
|
||||
copyfiles -e "**/*.test.js" -f ./foo/**/*.js out
|
||||
```
|
||||
|
||||
Other options include
|
||||
|
||||
- `-a` or `--all` which includes files that start with a dot.
|
||||
- `-s` or `--soft` to soft copy, which will not overwrite existing files.
|
||||
|
||||
## copyup
|
||||
|
||||
also creates a `copyup` command which is identical to `copyfiles` but `-up` defaults to 1
|
||||
|
||||
### Programic API
|
||||
|
||||
```js
|
||||
var copyfiles = require('copyfiles');
|
||||
|
||||
copyfiles([paths], opt, callback);
|
||||
```
|
||||
takes an array of paths, last one is the destination path, also takes an optional argument which the -u option if a number, otherwise if it's `true` it's the flat option.
|
||||
237
node_modules/copyfiles/test/test.fromNode.js
generated
vendored
Normal file
237
node_modules/copyfiles/test/test.fromNode.js
generated
vendored
Normal file
@ -0,0 +1,237 @@
|
||||
'use strict';
|
||||
var test = require('tape');
|
||||
var copyfiles = require('../');
|
||||
var rimraf = require('rimraf');
|
||||
var fs = require('fs');
|
||||
var mkdirp = require('mkdirp');
|
||||
var cp = require('child_process');
|
||||
|
||||
function after(t) {
|
||||
rimraf('output', function (err) {
|
||||
t.error(err, 'rm out');
|
||||
rimraf('input', function (err) {
|
||||
t.error(err, 'rm input');
|
||||
t.end();
|
||||
});
|
||||
});
|
||||
}
|
||||
function before(t) {
|
||||
mkdirp('input/other', function (err) {
|
||||
t.error(err, 'rm input');
|
||||
t.end();
|
||||
});
|
||||
}
|
||||
|
||||
test('normal', function (t) {
|
||||
t.test('setup', before);
|
||||
t.test('copy stuff', function (t) {
|
||||
fs.writeFileSync('input/a.txt', 'a');
|
||||
fs.writeFileSync('input/b.txt', 'b');
|
||||
fs.writeFileSync('input/c.js', 'c');
|
||||
copyfiles(['input/*.txt', 'output'], function (err) {
|
||||
t.error(err, 'copyfiles');
|
||||
fs.readdir('output/input', function (err, files) {
|
||||
t.error(err, 'readdir');
|
||||
t.deepEquals(files, ['a.txt', 'b.txt'], 'correct number of things');
|
||||
t.end();
|
||||
});
|
||||
});
|
||||
});
|
||||
t.test('teardown', after);
|
||||
});
|
||||
test('exclude', function (t) {
|
||||
t.test('setup', before);
|
||||
t.test('copy stuff', function (t) {
|
||||
fs.writeFileSync('input/a.txt', 'a');
|
||||
fs.writeFileSync('input/b.txt', 'b');
|
||||
fs.writeFileSync('input/c.js.txt', 'c');
|
||||
copyfiles( ['input/*.txt', 'output'], {
|
||||
exclude: '**/*.js.txt'
|
||||
}, function (err) {
|
||||
t.error(err, 'copyfiles');
|
||||
fs.readdir('output/input', function (err, files) {
|
||||
t.error(err, 'readdir');
|
||||
t.deepEquals(files, ['a.txt', 'b.txt'], 'correct number of things');
|
||||
t.end();
|
||||
});
|
||||
});
|
||||
});
|
||||
t.test('teardown', after);
|
||||
});
|
||||
test('all', function (t) {
|
||||
t.test('setup', before);
|
||||
t.test('copy stuff', function (t) {
|
||||
fs.writeFileSync('input/a.txt', 'a');
|
||||
fs.writeFileSync('input/b.txt', 'b');
|
||||
fs.writeFileSync('input/.c.txt', 'c');
|
||||
copyfiles( ['input/*.txt', 'output'], {
|
||||
all: true
|
||||
}, function (err) {
|
||||
t.error(err, 'copyfiles');
|
||||
fs.readdir('output/input', function (err, files) {
|
||||
t.error(err, 'readdir');
|
||||
t.deepEquals(files, ['.c.txt', 'a.txt', 'b.txt'], 'correct number of things');
|
||||
t.end();
|
||||
});
|
||||
});
|
||||
});
|
||||
t.test('teardown', after);
|
||||
});
|
||||
test('all from cl', function (t) {
|
||||
t.test('setup', before);
|
||||
t.test('copy stuff', function (t) {
|
||||
fs.writeFileSync('input/a.txt', 'a');
|
||||
fs.writeFileSync('input/b.txt', 'b');
|
||||
fs.writeFileSync('input/.c.txt', 'c');
|
||||
cp.spawnSync('./copyfiles', ['-a', 'input/*.txt', 'output']);
|
||||
fs.readdir('output/input', function (err, files) {
|
||||
t.error(err, 'readdir');
|
||||
t.deepEquals(files, ['.c.txt', 'a.txt', 'b.txt'], 'correct number of things');
|
||||
t.end();
|
||||
});
|
||||
});
|
||||
t.test('teardown', after);
|
||||
});
|
||||
test('all from cl 2', function (t) {
|
||||
t.test('setup', before);
|
||||
t.test('copy stuff', function (t) {
|
||||
fs.writeFileSync('input/a.txt', 'a');
|
||||
fs.writeFileSync('input/b.txt', 'b');
|
||||
fs.writeFileSync('input/.c.txt', 'c');
|
||||
cp.spawnSync('./copyfiles', ['--all', 'input/*.txt', 'output']);
|
||||
fs.readdir('output/input', function (err, files) {
|
||||
t.error(err, 'readdir');
|
||||
t.deepEquals(files, ['.c.txt', 'a.txt', 'b.txt'], 'correct number of things');
|
||||
t.end();
|
||||
});
|
||||
});
|
||||
t.test('teardown', after);
|
||||
});
|
||||
test('soft', function (t) {
|
||||
t.test('setup', before);
|
||||
t.test('copy stuff', function (t) {
|
||||
mkdirp('output/input/other', function(){
|
||||
fs.writeFileSync('input/a.txt', 'inputA');
|
||||
fs.writeFileSync('output/input/a.txt', 'outputA');
|
||||
t.equal( fs.readFileSync('output/input/a.txt').toString(), 'outputA' )
|
||||
fs.writeFileSync('input/b.txt', 'b');
|
||||
fs.writeFileSync('input/other/c.txt', 'inputC');
|
||||
fs.writeFileSync('output/input/other/c.txt', 'outputC');
|
||||
fs.writeFileSync('input/other/d.txt', 'd');
|
||||
copyfiles(['input/**/*.txt', 'output'], {soft:true}, function (err) {
|
||||
t.error(err, 'copyfiles');
|
||||
fs.readdir('output/input', function (err, files) {
|
||||
t.error(err, 'readdir');
|
||||
t.deepEquals(files, ['a.txt', 'b.txt', 'other'], 'correct number of things');
|
||||
t.equal( fs.readFileSync('output/input/a.txt').toString(), 'outputA' )
|
||||
t.equal( fs.readFileSync('output/input/b.txt').toString(), 'b')
|
||||
t.equal( fs.readFileSync('output/input/other/c.txt').toString(), 'outputC')
|
||||
t.end();
|
||||
});
|
||||
});
|
||||
})
|
||||
});
|
||||
t.test('teardown', after);
|
||||
});
|
||||
test('soft from cl', function (t) {
|
||||
t.test('setup', before);
|
||||
t.test('copy stuff', function (t) {
|
||||
mkdirp('output/input/other', function(){
|
||||
fs.writeFileSync('input/a.txt', 'inputA');
|
||||
fs.writeFileSync('output/input/a.txt', 'outputA');
|
||||
t.equal( fs.readFileSync('output/input/a.txt').toString(), 'outputA' )
|
||||
fs.writeFileSync('input/b.txt', 'b');
|
||||
fs.writeFileSync('input/other/c.txt', 'inputC');
|
||||
fs.writeFileSync('output/input/other/c.txt', 'outputC');
|
||||
fs.writeFileSync('input/other/d.txt', 'd');
|
||||
cp.spawnSync('./copyfiles', ['-s', 'input/**/*.txt', 'output']);
|
||||
|
||||
fs.readdir('output/input', function (err, files) {
|
||||
t.error(err, 'readdir');
|
||||
t.deepEquals(files, ['a.txt', 'b.txt', 'other'], 'correct number of things');
|
||||
t.equal( fs.readFileSync('output/input/a.txt').toString(), 'outputA' )
|
||||
t.equal( fs.readFileSync('output/input/b.txt').toString(), 'b')
|
||||
t.equal( fs.readFileSync('output/input/other/c.txt').toString(), 'outputC')
|
||||
t.end();
|
||||
});
|
||||
});
|
||||
});
|
||||
t.test('teardown', after);
|
||||
});
|
||||
test('soft from cl 2', function (t) {
|
||||
t.test('setup', before);
|
||||
t.test('copy stuff', function (t) {
|
||||
mkdirp('output/input/other', function(){
|
||||
fs.writeFileSync('input/a.txt', 'inputA');
|
||||
fs.writeFileSync('output/input/a.txt', 'outputA');
|
||||
t.equal( fs.readFileSync('output/input/a.txt').toString(), 'outputA' )
|
||||
fs.writeFileSync('input/b.txt', 'b');
|
||||
fs.writeFileSync('input/other/c.txt', 'inputC');
|
||||
fs.writeFileSync('output/input/other/c.txt', 'outputC');
|
||||
fs.writeFileSync('input/other/d.txt', 'd');
|
||||
cp.spawnSync('./copyfiles', ['--soft', 'input/**/*.txt', 'output']);
|
||||
|
||||
fs.readdir('output/input', function (err, files) {
|
||||
t.error(err, 'readdir');
|
||||
t.deepEquals(files, ['a.txt', 'b.txt', 'other'], 'correct number of things');
|
||||
t.equal( fs.readFileSync('output/input/a.txt').toString(), 'outputA' )
|
||||
t.equal( fs.readFileSync('output/input/b.txt').toString(), 'b')
|
||||
t.equal( fs.readFileSync('output/input/other/c.txt').toString(), 'outputC')
|
||||
t.end();
|
||||
});
|
||||
});
|
||||
});
|
||||
t.test('teardown', after);
|
||||
});
|
||||
test('with up', function (t) {
|
||||
t.test('setup', before);
|
||||
t.test('copy stuff', function (t) {
|
||||
fs.writeFileSync('input/a.txt', 'a');
|
||||
fs.writeFileSync('input/b.txt', 'b');
|
||||
fs.writeFileSync('input/c.js', 'c');
|
||||
copyfiles(['input/*.txt', 'output'], 1, function (err) {
|
||||
t.error(err, 'copyfiles');
|
||||
fs.readdir('output', function (err, files) {
|
||||
t.error(err, 'readdir');
|
||||
t.deepEquals(files, ['a.txt', 'b.txt'], 'correct number of things');
|
||||
t.end();
|
||||
});
|
||||
});
|
||||
});
|
||||
t.test('teardown', after);
|
||||
});
|
||||
|
||||
test('with up 2', function (t) {
|
||||
t.test('setup', before);
|
||||
t.test('copy stuff', function (t) {
|
||||
fs.writeFileSync('input/other/a.txt', 'a');
|
||||
fs.writeFileSync('input/other/b.txt', 'b');
|
||||
fs.writeFileSync('input/other/c.js', 'c');
|
||||
copyfiles(['input/**/*.txt', 'output'], 2, function (err) {
|
||||
t.error(err, 'copyfiles');
|
||||
fs.readdir('output', function (err, files) {
|
||||
t.error(err, 'readdir');
|
||||
t.deepEquals(files, ['a.txt', 'b.txt'], 'correct number of things');
|
||||
t.end();
|
||||
});
|
||||
});
|
||||
});
|
||||
t.test('teardown', after);
|
||||
});
|
||||
test('flatten', function (t) {
|
||||
t.test('setup', before);
|
||||
t.test('copy stuff', function (t) {
|
||||
fs.writeFileSync('input/other/a.txt', 'a');
|
||||
fs.writeFileSync('input/b.txt', 'b');
|
||||
fs.writeFileSync('input/other/c.js', 'c');
|
||||
copyfiles(['input/**/*.txt', 'output'], true, function (err) {
|
||||
t.error(err, 'copyfiles');
|
||||
fs.readdir('output', function (err, files) {
|
||||
t.error(err, 'readdir');
|
||||
t.deepEquals(files, ['a.txt', 'b.txt'], 'correct number of things');
|
||||
t.end();
|
||||
});
|
||||
});
|
||||
});
|
||||
t.test('teardown', after);
|
||||
});
|
||||
Reference in New Issue
Block a user