[Pkg-javascript-commits] [node-jscoverage] 02/02: intial commit for debian files
Leo Iannacone
l3on-guest at moszumanska.debian.org
Sun May 11 16:07:06 UTC 2014
This is an automated email from the git hooks/post-receive script.
l3on-guest pushed a commit to branch master
in repository node-jscoverage.
commit 1425b8d780bb1dca0922f78de5f85fd21f5c4b5a
Author: Leo Iannacone <l3on at ubuntu.com>
Date: Sun May 11 18:07:00 2014 +0200
intial commit for debian files
---
debian/changelog | 5 +
debian/compat | 1 +
debian/control | 34 ++
debian/copyright | 34 ++
debian/dirs | 1 +
debian/docs | 1 +
debian/install | 5 +
debian/jscoverage.1 | 12 +
debian/links | 1 +
debian/manpages | 1 +
debian/patches/0001-fix_nodejs_shebang.path | 16 +
debian/patches/0002-bundle_xfs_module.patch | 776 ++++++++++++++++++++++++++++
debian/patches/series | 2 +
debian/rules | 18 +
debian/source/format | 1 +
debian/watch | 7 +
16 files changed, 915 insertions(+)
diff --git a/debian/changelog b/debian/changelog
new file mode 100644
index 0000000..64ead3c
--- /dev/null
+++ b/debian/changelog
@@ -0,0 +1,5 @@
+node-jscoverage (0.5.0~rc2-1) UNRELEASED; urgency=low
+
+ * Initial release (Closes: #747751)
+
+ -- Leo Iannacone <l3on at ubuntu.com> Sun, 11 May 2014 17:58:07 +0200
diff --git a/debian/compat b/debian/compat
new file mode 100644
index 0000000..45a4fb7
--- /dev/null
+++ b/debian/compat
@@ -0,0 +1 @@
+8
diff --git a/debian/control b/debian/control
new file mode 100644
index 0000000..e3a06e6
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,34 @@
+Source: node-jscoverage
+Section: web
+Priority: extra
+Maintainer: Debian Javascript Maintainers <pkg-javascript-devel at lists.alioth.debian.org>
+Uploaders: Leo Iannacone <l3on at ubuntu.com>
+Build-Depends:
+ debhelper (>= 8)
+ , dh-buildinfo
+ , nodejs
+Standards-Version: 3.9.5
+Homepage: https://github.com/fishbar/jscoverage
+Vcs-Git: git://anonscm.debian.org/pkg-javascript/node-jscoverage.git
+Vcs-Browser: http://anonscm.debian.org/gitweb/?p=pkg-javascript/node-jscoverage.git
+
+Package: jscoverage
+Provides: node-jscoverage
+Suggests: mocha
+Architecture: all
+Depends:
+ ${misc:Depends}
+ , nodejs
+ , uglifyjs
+ , ejs.js
+ , node-optimist
+Description: JavaScript coverage tool
+ jscoverage measure the level of coverage of a JavaScript
+ source code.
+ .
+ The coverage level is particular measure which indicates
+ how deeply a source code is tested by a test suite. Source
+ with an high level of coverage are highly tested and have
+ less changes to contain software bugs.
+ .
+ Node.js is an event-based server-side JavaScript engine.
diff --git a/debian/copyright b/debian/copyright
new file mode 100644
index 0000000..d08c986
--- /dev/null
+++ b/debian/copyright
@@ -0,0 +1,34 @@
+Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: jscoverage
+Upstream-Contact: https://github.com/fishbar/jscoverage/issues
+Source: https://github.com/fishbar/jscoverage
+
+Files: *
+Copyright: 2014 fish <zhengxinlin at gmail.com>
+License: Expat
+
+Files: debian/*
+Copyright: 2014 Leo Iannacone <l3on at ubuntu.com>
+License: Expat
+
+License: Expat
+ 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.
+
diff --git a/debian/dirs b/debian/dirs
new file mode 100644
index 0000000..e772481
--- /dev/null
+++ b/debian/dirs
@@ -0,0 +1 @@
+usr/bin
diff --git a/debian/docs b/debian/docs
new file mode 100644
index 0000000..b43bf86
--- /dev/null
+++ b/debian/docs
@@ -0,0 +1 @@
+README.md
diff --git a/debian/install b/debian/install
new file mode 100644
index 0000000..5edee35
--- /dev/null
+++ b/debian/install
@@ -0,0 +1,5 @@
+package.json usr/lib/nodejs/jscoverage/
+bin usr/lib/nodejs/jscoverage/
+lib usr/lib/nodejs/jscoverage/
+reporter usr/lib/nodejs/jscoverage/
+index.js usr/lib/nodejs/jscoverage/
diff --git a/debian/jscoverage.1 b/debian/jscoverage.1
new file mode 100644
index 0000000..6f2e4f2
--- /dev/null
+++ b/debian/jscoverage.1
@@ -0,0 +1,12 @@
+.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.44.1.
+.TH JSCOVERAGE "1" "jscoverage" "User Commands"
+.SH NAME
+jscoverage - JavaScript coverage tool
+.SH SYNOPSYS
+jscoverage \fBsource\fR [\fBdest\fR] [\fB--exclude\fR \fIa,b,c,d\fR]
+
+.SH DESCRIPTION
+\fBjscoverage\fR measure the level of \fIcoverage\fR of a JavaScript source code. The \fIcoverage\fR level is particular measure which indicates how deeply a source code is tested by a \fItest suite\fR. Source with an high level of coverage are highly tested and have less changes to contain software bugs.
+
+.SH FILES
+For more information and \fImocha\fR integration read \fB/usr/share/doc/node-jscoverage/README.md\fR
diff --git a/debian/links b/debian/links
new file mode 100644
index 0000000..83bb7e6
--- /dev/null
+++ b/debian/links
@@ -0,0 +1 @@
+usr/lib/nodejs/jscoverage/bin/jscoverage usr/bin/jscoverage
diff --git a/debian/manpages b/debian/manpages
new file mode 100644
index 0000000..3f1071c
--- /dev/null
+++ b/debian/manpages
@@ -0,0 +1 @@
+debian/jscoverage.1
diff --git a/debian/patches/0001-fix_nodejs_shebang.path b/debian/patches/0001-fix_nodejs_shebang.path
new file mode 100644
index 0000000..7194a06
--- /dev/null
+++ b/debian/patches/0001-fix_nodejs_shebang.path
@@ -0,0 +1,16 @@
+Description: Fix nodejs shebang
+Author: Leo Iannacone <l3on at ubuntu.com>
+Forwarded: not-needed
+
+---
+ bin/jscoverage | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/bin/jscoverage
++++ b/bin/jscoverage
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env node
++#!/usr/bin/nodejs
+ /**
+ * [argv description]
+ * * @usage
diff --git a/debian/patches/0002-bundle_xfs_module.patch b/debian/patches/0002-bundle_xfs_module.patch
new file mode 100644
index 0000000..801da04
--- /dev/null
+++ b/debian/patches/0002-bundle_xfs_module.patch
@@ -0,0 +1,776 @@
+Description: Adding module xfs bounded as patch.
+ Module xfs is really related to jscoverage and actually
+ seems to have really few modules which depend on.
+Author: Leo Iannacone <l3on at ubuntu.com>
+Forwarded: not-needed
+
+---
+ node_modules/xfs/.jshintrc | 43 +++++++
+ node_modules/xfs/.npmignore | 3
+ node_modules/xfs/.travis.yml | 5
+ node_modules/xfs/.jshintrc | 43 +++++++
+ node_modules/xfs/.npmignore | 3
+ node_modules/xfs/.travis.yml | 5
+ node_modules/xfs/Makefile | 11 +
+ node_modules/xfs/README.md | 52 +++++++++
+ node_modules/xfs/index.js | 60 ++++++++++
+ node_modules/xfs/lib/async.js | 226 +++++++++++++++++++++++++++++++++++++++++
+ node_modules/xfs/lib/sync.js | 61 +++++++++++
+ node_modules/xfs/package.json | 40 +++++++
+ node_modules/xfs/test/index.js | 221 ++++++++++++++++++++++++++++++++++++++++
+ 10 files changed, 722 insertions(+)
+
+--- /dev/null
++++ b/node_modules/xfs/.jshintrc
+@@ -0,0 +1,43 @@
++{
++ "node": true,
++ "predef": [
++ "document",
++ "module",
++ "require",
++ "__dirname",
++ "process",
++ "console",
++ "it",
++ "xit",
++ "describe",
++ "xdescribe",
++ "before",
++ "beforeEach",
++ "after",
++ "afterEach",
++ "expect",
++ ],
++ "bitwise": true,
++ "curly": true,
++ "eqeqeq": true,
++ "forin": false,
++ "immed": true,
++ "latedef": true,
++ "newcap": true,
++ "noarg": true,
++ "noempty": true,
++ "nonew": true,
++ "plusplus": false,
++ "undef": true,
++ "strict": false,
++ "trailing": false,
++ "globalstrict": true,
++ "nonstandard": true,
++ "white": true,
++ "indent": 2,
++ "expr": true,
++ "multistr": true,
++ "onevar": false,
++ "unused": "vars",
++ "sub": true
++}
+--- /dev/null
++++ b/node_modules/xfs/.npmignore
+@@ -0,0 +1,3 @@
++/node_modules/
++/test/tdir
++/test/walk
+--- /dev/null
++++ b/node_modules/xfs/.travis.yml
+@@ -0,0 +1,5 @@
++language: node_js
++node_js:
++ - "0.11"
++ - "0.10"
++ - "0.8"
+--- /dev/null
++++ b/node_modules/xfs/Makefile
+@@ -0,0 +1,11 @@
++MOCHA = ./node_modules/.bin/mocha
++
++init: install test
++
++install:
++ @npm install
++
++test: install
++ @$(MOCHA) ./test --coverage
++
++.PHONY: instal test
+--- /dev/null
++++ b/node_modules/xfs/README.md
+@@ -0,0 +1,52 @@
++xfs
++======
++
++xfs is a module extends builded-in fs module, let file manipulate easily
++
++[![Build Status](https://secure.travis-ci.org/fishbar/xfs.png)](http://travis-ci.org/fishbar/xfs)
++
++
++xfs extends the following functions :
++
++## async functions
++ * mkdir(path,cb) make directories and their contents recursively
++ * rmdir(path,cb) remove directories and their contents recursively
++ * rename(src,dest,cb) rename file across two different devices
++ * walk(dir, expr, each, done); walk through dir, each file will pass to each() , when walk done, done() called
++
++```js
++// walk traverse through files in the dir one by one
++// get only js files in dir
++fs.walk(dir, /\.js$/, function (err, file, done) {
++ // your code here
++
++ // in the end , must call done()
++ done();
++}, function (err) {
++ // your code
++});
++```
++
++## sync functions
++
++ * rm(path)
++ * mkdir(path)
++ * save(path, data[, options|encoding])
++
++```js
++var sync = xfs.sync();
++// shell > rm -r path
++sync.rm(path);
++// shell > mkdir -p path
++sync.mkdir(path);
++// save file auto create dir if not exist
++// node >= v0.10.0
++sync.save(path, data, option); // when node >= v0.10.0, the last param is option
++sync.save(path, data, encoding); // when node < v0.10.0, the last param is encoding
++
++```
++ ... to be contine
++
++## License
++
++ MIT
+--- /dev/null
++++ b/node_modules/xfs/index.js
+@@ -0,0 +1,60 @@
++var Fs = require('fs');
++var fAsync = require('./lib/async');
++var fSync = require('./lib/sync');
++
++var syncFunc = {};
++/**
++ * extends function from Fs, exclude override
++ */
++for (var i in Fs) {
++ if (Fs.hasOwnProperty(i)) {
++ exports[i] = Fs[i];
++ if (i.indexOf('Sync') !== -1) {
++ syncFunc[i] = Fs[i];
++ }
++ }
++}
++
++syncFunc.save = fSync.writeFile;
++syncFunc.mkdir = fSync.mkdir;
++syncFunc.rmdir = fSync.rm;
++syncFunc.rm = fSync.rm;
++
++/**
++ * rmdir 递归删除目录,异步回调
++ * 支持dir / file删除, 如果文件不存在,则默认删除成功
++ * @param path file path
++ * @param callback
++ */
++exports.rmdir = fAsync.rm;
++exports.rm = fAsync.rm;
++/**
++ * mkdir 递归的创建目录,异步回调
++ * 如果文件目录存在,则默认返回成功
++ * @param path
++ * @param callback
++ */
++exports.mkdir = fAsync.mkdir;
++/**
++ * rename 移动文件,异步回调,支持跨device移动
++ * @param {path} src
++ * @param {path} dest
++ * @param {function} cb
++ **/
++exports.rename = fAsync.mv;
++exports.mv = fAsync.mv;
++
++/**
++ * save 保存到文件,如果目录不存在自动创建
++ * @param {path} path
++ * @param {String|Buffer} data
++ * @param {Function} cb(err);
++ */
++exports.save = fAsync.writeFile;
++exports.writeFile = fAsync.writeFile;
++
++exports.walk = fAsync.walk;
++
++exports.sync = function () {
++ return syncFunc;
++};
+--- /dev/null
++++ b/node_modules/xfs/lib/async.js
+@@ -0,0 +1,226 @@
++var Fs = require('fs');
++var Path = require('path');
++
++exports.rm = rm;
++exports.mkdir = mkdir;
++exports.mv = mv;
++exports.save = writeFile;
++exports.writeFile = writeFile;
++exports.walk = walk;
++
++/**
++ * ========================================
++ * remove file/dir
++ * equal: rm -rf /a/b/c
++ * @param {String} path file or dir
++ * @param {Function} cb(err|null)
++ */
++function rm(path, cb) {
++
++ Fs.readdir(path, function (e, files) {
++ if (e) {
++ if (e.code === 'ENOENT') {
++ cb(null);
++ } else if (e.code === 'ENOTDIR') {
++ Fs.unlink(path, cb);
++ } else {
++ cb(e);
++ }
++ return;
++ }
++ var len = files.length;
++
++ if (!len) {
++ return Fs.rmdir(path, cb);
++ }
++ var count = 0;
++ var tmp_path = Path.join(path, files[count]);
++ _delFile(tmp_path, function _delcb(err) {
++ if (err) {
++ return cb(err);
++ }
++ count ++;
++ if (count === len) {
++ //finish dir child delete , then delete dir itself
++ Fs.rmdir(path, function (err) {
++ if (err && err.code === 'ENOENT') {
++ return cb(null);
++ }
++ cb(err);
++ });
++ return;
++ }
++ tmp_path = Path.join(path, files[count]);
++ _delFile(tmp_path, _delcb);
++ });
++ });
++ function _delFile(path, cb) {
++ Fs.stat(path, function (e, st) {
++ if (e) {
++ return cb(e);
++ }
++ if (st.isDirectory()) {
++ rm(path, cb);
++ } else if (st.isFile()) {
++ Fs.unlink(path, function (err) {
++ if (err && err.code === 'ENOENT') {
++ return cb(null);
++ }
++ cb(err);
++ });
++ }
++ });
++ }
++}
++/**
++ * mkdir
++ * ================================
++ * equal mkdir -p path
++ * @return {[type]} [description]
++ */
++function mkdir(path, mode, callback) {
++ if (callback === undefined) {
++ callback = mode;
++ mode = 0755;
++ }
++ if (!path) {
++ return callback(new Error('path not found'));
++ }
++ // take of ../ ./
++ path = Path.normalize(path);
++ path = path.replace(/\\/g, '/').replace(/\/$/, '');
++
++ var arr = [];
++ _test(path, function (err, arr) {
++ if (err) {
++ callback(err);
++ } else if (arr.length) {
++ _mk(arr, arr.length - 1, callback);
++ } else {
++ callback();
++ }
++ });
++ //check path
++ function _test(path, cb) {
++ Fs.stat(path, function (err, stat) {
++ if (err) {
++ if (err.code === 'ENOENT') {
++ arr.push(path);
++ path = Path.dirname(path);
++ if (path == '.' || path == '..') {
++ return cb(null, arr);
++ }
++ _test(path, cb);
++ } else {
++ cb(err);
++ }
++ } else if (stat.isFile()) {
++ cb(new Error('file with same name alrady exist!', path));
++ } else {
++ cb(null, arr);
++ }
++ });
++ }
++ function _mk(arr, i, cb) {
++ var p = arr[i];
++ Fs.mkdir(p, mode, function (err) {
++ if (err && err.code !== 'EEXIST') {
++ cb(err);
++ } else {
++ if (i === 0) return cb(null);
++ i --;
++ _mk(arr, i, cb);
++ }
++ });
++ }
++}
++/**
++ * move file cross different device
++ * @param {[type]} src [description]
++ * @param {[type]} dest [description]
++ * @param {Function} cb [description]
++ * @return {[type]} [description]
++ */
++function mv(src, dest, cb) {
++ Fs.rename(src, dest, function (err) {
++ if (err) {
++ // test if err is called by cross device rename
++ if (err.code === "UNKNOW" || err.code === "ENOENT" || err.code === "EXDEV") {
++ var _src, _dest;
++ try {
++ _src = Fs.createReadStream(src);
++ _dest = Fs.createWriteStream(dest);
++ } catch (e) {
++ return cb(e);
++ }
++ _src.on('end', function () {
++ Fs.unlink(src, function (err) {
++ cb(err);
++ });
++ });
++ _src.pipe(_dest);
++ } else {
++ cb(err);
++ }
++ } else {
++ cb(null);
++ }
++ });
++}
++
++function writeFile(path, data, cb) {
++ var dir = Path.dirname(path);
++ mkdir(dir, function (err) {
++ if (err) {
++ cb(err);
++ } else {
++ Fs.writeFile(path, data, cb);
++ }
++ });
++}
++/**
++ * [walk description]
++ * @param {Path} path [description]
++ * @param {RegExp} expr file match this expr will pass to
++ * @param {Function} cb (err, stat, done)
++ * @return {[type]} [description]
++ */
++function walk(path, expr, cb, done, _each) {
++ if (typeof expr === 'function') {
++ done = cb;
++ cb = expr;
++ expr = null;
++ }
++ Fs.stat(path, function (err, stat) {
++ if (err) {
++ return cb(err, null, _each ? _each : function () {});
++ }
++ if (stat.isDirectory()) {
++ Fs.readdir(path, function (err, flist) {
++ if (err) {
++ return cb(err);
++ }
++ var len = flist.length;
++ var count = 0;
++ function each() {
++ if (count >= len) {
++ return done();
++ }
++ walk(Path.join(path, flist[count]), expr, cb, done, each);
++ count ++;
++ }
++ each();
++ });
++ } else if(stat.isFile()) {
++ if (expr) {
++ if (expr.test(path)) {
++ cb(null, path, _each);
++ } else {
++ _each();
++ }
++ } else {
++ cb(null, path, _each);
++ }
++ }
++ });
++}
+--- /dev/null
++++ b/node_modules/xfs/lib/sync.js
+@@ -0,0 +1,61 @@
++var fs = require('fs');
++var path = require('path');
++
++/**
++ * [writeFile description]
++ * @param {String} fpath filepath
++ * @param {String} data write to file
++ * @param {Object} [option] file option
++ */
++exports.writeFile = function (fpath, data, option) {
++ var dir = path.dirname(fpath);
++ this.mkdir(dir);
++ fs.writeFileSync(fpath, data, option);
++};
++
++exports.rm = function (fpath) {
++ var p = [];
++ var self = this;
++ while (1) {
++ var ff;
++ try {
++ ff = fs.readdirSync(fpath);
++ } catch (e) {
++ if (e.code === 'ENOENT') {
++ return;
++ } else if (e.code === 'ENOTDIR') {
++ fs.unlinkSync(fpath);
++ return;
++ } else {
++ throw e;
++ }
++ }
++ if (ff.length <= 0) {
++ return fs.rmdirSync(fpath);
++ }
++ ff.forEach(function (v) {
++ self.rm(path.join(fpath, v));
++ });
++ }
++};
++
++exports.mkdir = function (fpath, mode) {
++ var p = [];
++ while (1) {
++ try {
++ fs.mkdirSync(fpath);
++ } catch (e) {
++ if (e.code === 'EEXIST') {
++ break;
++ } else if (e.code === 'ENOENT') {
++ p.unshift(fpath);
++ fpath = path.dirname(fpath);
++ } else {
++ throw e;
++ }
++ }
++ }
++ p.forEach(function (v) {
++ fs.mkdirSync(v, mode);
++ });
++};
+\ No newline at end of file
+--- /dev/null
++++ b/node_modules/xfs/package.json
+@@ -0,0 +1,40 @@
++{
++ "author": {
++ "name": "fish",
++ "email": "zhengxinlin at gmail.com",
++ "url": "https://github.com/fishbar"
++ },
++ "name": "xfs",
++ "description": "extends fs module, easy way to manipulate file system, support both sync functions and async functions",
++ "version": "0.1.7",
++ "homepage": "https://github.com/fishbar/xfs",
++ "repository": {
++ "type": "git",
++ "url": "git://github.com/fishbar/xfs.git"
++ },
++ "main": "index.js",
++ "scripts": {
++ "test": "mocha test --coverage"
++ },
++ "engines": {
++ "node": ">=0.6.0"
++ },
++ "dependencies": {},
++ "devDependencies": {
++ "jscoverage": "*",
++ "mocha": "*",
++ "expect.js": "*"
++ },
++ "optionalDependencies": {},
++ "readme": "xfs\n======\n\nxfs is a module extends builded-in fs module, let file manipulate easily\n\n[![Build Status](https://secure.travis-ci.org/fishbar/xfs.png)](http://travis-ci.org/fishbar/xfs)\n\n\nxfs extends the following functions :\n\n## async functions\n * mkdir(path,cb) make directories and their contents recursively\n * rmdir(path,cb) remove directories and their contents recursively\n * rename(src,dest,cb) rename file across two different devices\n * walk(dir, expr, [...]
++ "readmeFilename": "README.md",
++ "bugs": {
++ "url": "https://github.com/fishbar/xfs/issues"
++ },
++ "_id": "xfs at 0.1.7",
++ "dist": {
++ "shasum": "b00e3f138e77a9bb981572ec1d7eee8b64374ee8"
++ },
++ "_from": "xfs at 0.1.7",
++ "_resolved": "https://registry.npmjs.org/xfs/-/xfs-0.1.7.tgz"
++}
+--- /dev/null
++++ b/node_modules/xfs/test/index.js
+@@ -0,0 +1,221 @@
++var jsc = require('jscoverage');
++require = jsc.mock(module);
++var expect = require('expect.js');
++require('../lib/async', true);
++require('../lib/sync', true);
++var xfs = require('../index', true);
++var fs = require('fs');
++
++process.on('exit', function () {
++ jsc.coverage();
++});
++
++process.chdir(__dirname);
++
++describe('xfs.mkdir', function () {
++ it('should be ok when dir not exit', function (done) {
++ xfs.mkdir('tdir/a/b', function () {
++ xfs.stat('tdir/a/b', function (err) {
++ expect(err).to.not.be.ok();
++ done();
++ });
++ });
++ });
++ it('should be ok when part of the path is exist', function (done) {
++ xfs.mkdir('tdir/a/c', function () {
++ xfs.stat('tdir/a/c', function (err) {
++ expect(err).to.not.be.ok();
++ done();
++ });
++ });
++ });
++ it('should be ok when path already exist', function (done) {
++ xfs.mkdir('tdir/a/c', function () {
++ xfs.stat('tdir/a/c', function (err) {
++ expect(err).to.not.be.ok();
++ done();
++ });
++ });
++ });
++ it('should be failed when path EACCES', function (done) {
++ fs.mkdir('tdir/eaccess', 0644, function () {
++ xfs.mkdir('tdir/eaccess/a', function (err) {
++ expect(err.code).to.be('EACCES');
++ done();
++ });
++ });
++ });
++});
++
++describe('xfs.rmdir()', function () {
++ it('should be ok when rm an empty dir', function (done) {
++ xfs.rmdir('tdir/a/b', function (err) {
++ expect(err).to.be(null);
++ done();
++ });
++ });
++ it('should be ok when rm an dir with an dir', function (done) {
++ xfs.mkdir('tdir/a/b/c/d', function () {
++ xfs.rmdir('tdir/a', function (err) {
++ expect(err).to.be(null);
++ done();
++ });
++ });
++ });
++ it('should be ok when rm an dir with dir and file', function (done) {
++ xfs.writeFile('tdir/a/b/c/test.txt', 'asdf', function () {
++ xfs.rmdir('tdir/a', function (err) {
++ expect(err).to.be(null);
++ done();
++ });
++ });
++ });
++ it('should be ok when rm an no exist path', function (done) {
++ xfs.rmdir('tdir/d', function (err) {
++ expect(err).to.be(null);
++ done();
++ });
++ });
++ it('should be ok when rm an dir with dir and file', function (done) {
++ xfs.writeFile('tdir/a/b/c/test.txt', 'asdf', function () {
++ xfs.rmdir('tdir/a/b/c/test.txt', function (err) {
++ expect(err).to.be(null);
++ fs.stat('tdir/a/b/c/test.txt', function (err, data) {
++ expect(err.code).to.be('ENOENT');
++ done();
++ });
++ });
++ });
++ });
++});
++
++describe("xfs.rename()", function () {
++ it('should be ok when move file', function (done) {
++ xfs.writeFileSync('/tmp/test.txt', 'hello');
++ xfs.rename('/tmp/test.txt', './test.txt', function (err) {
++ expect(err).to.be(null);
++ xfs.stat('/tmp/test.txt', function (err) {
++ expect(err.code).to.be('ENOENT');
++ expect(xfs.readFileSync('./test.txt').toString()).to.be('hello');
++ xfs.unlink('./test.txt', function () {
++ done();
++ });
++ });
++ });
++ });
++ it('should be ok when fs.rename error', function (done) {
++ xfs.writeFileSync('/tmp/test.txt', 'hello');
++ var orig_rename = fs.rename;
++ fs.rename = function (a, b, cb) {
++ var e = new Error('mock')
++ e.code = 'EXDEV';
++ cb(e);
++ };
++ xfs.rename('/tmp/test.txt', './test.txt', function (err) {
++ expect(err).to.be(null);
++ xfs.stat('/tmp/test.txt', function (err) {
++ expect(err.code).to.be('ENOENT');
++ expect(xfs.readFileSync('./test.txt').toString()).to.be('hello');
++ xfs.unlink('./test.txt', function () {
++ fs.rename = orig_rename;
++ done();
++ });
++ });
++ });
++ });
++
++ it('should ok when walk through dir', function (done) {
++ xfs.sync().save('./walk/a.js', '');
++ xfs.sync().save('./walk/b/c.js', '');
++ var arr = [];
++ xfs.walk('./walk', function (err, file, done) {
++ arr.push(file);
++ done();
++ }, function () {
++ expect(arr.length).to.be(3);
++ expect(arr[0]).to.match(/a\.js/);
++ expect(arr[1]).to.match(/c\.js/);
++ done();
++ });
++ });
++
++ it('should ok when walk through dir with filter', function (done) {
++ xfs.sync().save('./walk/a.js', '');
++ xfs.sync().save('./walk/b/c.js', '');
++ xfs.sync().save('./walk/b/d.css', '');
++ var arr = [];
++ xfs.walk('./walk', /\.js/, function (err, file, done) {
++ arr.push(file);
++ done();
++ }, function () {
++ expect(arr.length).to.be(2);
++ expect(arr[0]).to.match(/a\.js/);
++ expect(arr[1]).to.match(/c\.js/);
++ done();
++ });
++ });
++});
++
++describe('xfs.sync()', function () {
++ before(function (done) {
++ xfs.sync().rm('./tdir/sync');
++ done();
++ });
++ describe('save', function () {
++ it('should ok when save file to exists path', function () {
++ xfs.sync().save('./tdir/sync/test.txt', 'abc');
++ expect(xfs.readFileSync('./tdir/sync/test.txt').toString()).to.be('abc');
++ });
++ if (compareVersion(process.version, 'v0.10.0')) {
++ it('should ok when save file with option to exist file', function() {
++ xfs.sync().save('./tdir/sync/test.txt', 'def', {flag: 'a'});
++ expect(xfs.readFileSync('./tdir/sync/test.txt').toString()).to.be('abcdef');
++ });
++ }
++ it('should ok when save file to un-exists path', function () {
++ xfs.sync().save('./tdir/sync/a/b/c/d.txt', 't');
++ expect(xfs.readFileSync('./tdir/sync/a/b/c/d.txt').toString()).to.be('t');
++ });
++ });
++ describe('mkdir', function () {
++ it('should be ok when path not exist', function (){
++ var path = './tdir/sync/test';
++ xfs.sync().mkdir(path);
++ var stat = xfs.statSync(path);
++ expect(stat.isDirectory()).to.be(true);
++ });
++ it('should be ok when path already exists', function () {
++ var path = './tdir/sync/test';
++ xfs.sync().mkdir(path);
++ var stat = xfs.statSync(path);
++ expect(stat.isDirectory()).to.be(true);
++ });
++ });
++ describe('rm', function () {
++ it('should be ok when rm un-exists file', function () {
++ xfs.sync().rm('./tdir/undefined/abc/');
++ });
++ });
++});
++
++function compareVersion(v0, v1) {
++ v0 = v0.split('.');
++ v1 = v1.split('.');
++ if (v0[0] > v1[0]) {
++ return true;
++ } else if (v0[0] < v1[1]) {
++ return false;
++ }
++ var tmp = parseInt(v0[1], 10) - parseInt(v1[1], 10);
++ if (tmp > 0) {
++ return true;
++ } else if (tmp < 0){
++ return false;
++ }
++ tmp = parseInt(v0[2], 10) - parseInt(v1[2], 10);
++ if (tmp >= 0) {
++ return true;
++ } else {
++ return false;
++ }
++}
+\ No newline at end of file
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..b587cb6
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1,2 @@
+0001-fix_nodejs_shebang.path
+0002-bundle_xfs_module.patch
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000..6cf3abe
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,18 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+%:
+ dh $@
+
+#override_dh_auto_build:
+
+#override_dh_auto_test:
+
+override_dh_auto_install:
+ chmod -x index.js lib/*.js
+ dh_auto_install
+
+
diff --git a/debian/source/format b/debian/source/format
new file mode 100644
index 0000000..163aaf8
--- /dev/null
+++ b/debian/source/format
@@ -0,0 +1 @@
+3.0 (quilt)
diff --git a/debian/watch b/debian/watch
new file mode 100644
index 0000000..48c3b3e
--- /dev/null
+++ b/debian/watch
@@ -0,0 +1,7 @@
+# using npm2deb.debian.net service until this issue stay open
+# https://github.com/fishbar/jscoverage/issues/20
+version=3
+opts=\
+filenamemangle=s/.*([\d\.\-\~]+)\.tgz/node-jscoverage-$1.tar.gz/,\
+uversionmangle=s/(\d)[_\.\-\+]?((RC|rc|pre|dev|beta|alpha)\d*)$/$1~$2/ \
+ http://npm2deb.debian.net/watch?module=jscoverage .*/jscoverage-(.*).tgz
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-jscoverage.git
More information about the Pkg-javascript-commits
mailing list