[Pkg-javascript-commits] [node-mkdirp] 01/05: New upstream version 0.5.1

Bastien Roucariès rouca at moszumanska.debian.org
Mon Sep 18 09:17:11 UTC 2017


This is an automated email from the git hooks/post-receive script.

rouca pushed a commit to branch master
in repository node-mkdirp.

commit 418bfc6b65e49fe0d798a8c5e829702c1804d0fc
Author: Bastien ROUCARIÈS <roucaries.bastien at gmail.com>
Date:   Fri Sep 15 21:27:06 2017 +0200

    New upstream version 0.5.1
---
 .travis.yml          |  7 +++++--
 index.js             |  5 +++--
 package.json         |  8 ++++----
 test/chmod.js        |  9 ++++++---
 test/clobber.js      |  3 ++-
 test/mkdirp.js       |  6 ++++--
 test/opts_fs.js      |  6 ++++--
 test/opts_fs_sync.js |  6 ++++--
 test/perm.js         |  8 +++++---
 test/perm_sync.js    |  8 +++++---
 test/race.js         | 17 +++++++----------
 test/rel.js          |  6 ++++--
 test/root.js         |  3 ++-
 test/sync.js         |  6 ++++--
 test/umask.js        |  4 +++-
 test/umask_sync.js   |  4 +++-
 16 files changed, 65 insertions(+), 41 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index c693a93..74c57bf 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,5 +1,8 @@
 language: node_js
 node_js:
-  - 0.6
-  - 0.8
+  - "0.8"
   - "0.10"
+  - "0.12"
+  - "iojs"
+before_install:
+  - npm install -g npm@~1.4.6
diff --git a/index.js b/index.js
index a1742b2..6ce241b 100644
--- a/index.js
+++ b/index.js
@@ -1,5 +1,6 @@
 var path = require('path');
 var fs = require('fs');
+var _0777 = parseInt('0777', 8);
 
 module.exports = mkdirP.mkdirp = mkdirP.mkdirP = mkdirP;
 
@@ -16,7 +17,7 @@ function mkdirP (p, opts, f, made) {
     var xfs = opts.fs || fs;
     
     if (mode === undefined) {
-        mode = 0777 & (~process.umask());
+        mode = _0777 & (~process.umask());
     }
     if (!made) made = null;
     
@@ -60,7 +61,7 @@ mkdirP.sync = function sync (p, opts, made) {
     var xfs = opts.fs || fs;
     
     if (mode === undefined) {
-        mode = 0777 & (~process.umask());
+        mode = _0777 & (~process.umask());
     }
     if (!made) made = null;
 
diff --git a/package.json b/package.json
index e637980..863e860 100644
--- a/package.json
+++ b/package.json
@@ -1,9 +1,9 @@
 {
   "name": "mkdirp",
   "description": "Recursively mkdir, like `mkdir -p`",
-  "version": "0.5.0",
+  "version": "0.5.1",
   "author": "James Halliday <mail at substack.net> (http://substack.net)",
-  "main": "./index",
+  "main": "index.js",
   "keywords": [
     "mkdir",
     "directory"
@@ -19,8 +19,8 @@
     "minimist": "0.0.8"
   },
   "devDependencies": {
-    "tap": "~0.4.0",
-    "mock-fs": "~2.2.0"
+    "tap": "1",
+    "mock-fs": "2 >=2.7.0"
   },
   "bin": "bin/cmd.js",
   "license": "MIT"
diff --git a/test/chmod.js b/test/chmod.js
index 520dcb8..6a404b9 100644
--- a/test/chmod.js
+++ b/test/chmod.js
@@ -2,6 +2,9 @@ var mkdirp = require('../').mkdirp;
 var path = require('path');
 var fs = require('fs');
 var test = require('tap').test;
+var _0777 = parseInt('0777', 8);
+var _0755 = parseInt('0755', 8);
+var _0744 = parseInt('0744', 8);
 
 var ps = [ '', 'tmp' ];
 
@@ -13,20 +16,20 @@ for (var i = 0; i < 25; i++) {
 var file = ps.join('/');
 
 test('chmod-pre', function (t) {
-    var mode = 0744
+    var mode = _0744
     mkdirp(file, mode, function (er) {
         t.ifError(er, 'should not error');
         fs.stat(file, function (er, stat) {
             t.ifError(er, 'should exist');
             t.ok(stat && stat.isDirectory(), 'should be directory');
-            t.equal(stat && stat.mode & 0777, mode, 'should be 0744');
+            t.equal(stat && stat.mode & _0777, mode, 'should be 0744');
             t.end();
         });
     });
 });
 
 test('chmod', function (t) {
-    var mode = 0755
+    var mode = _0755
     mkdirp(file, mode, function (er) {
         t.ifError(er, 'should not error');
         fs.stat(file, function (er, stat) {
diff --git a/test/clobber.js b/test/clobber.js
index 0eb7099..2433b9a 100644
--- a/test/clobber.js
+++ b/test/clobber.js
@@ -2,6 +2,7 @@ var mkdirp = require('../').mkdirp;
 var path = require('path');
 var fs = require('fs');
 var test = require('tap').test;
+var _0755 = parseInt('0755', 8);
 
 var ps = [ '', 'tmp' ];
 
@@ -29,7 +30,7 @@ test('clobber-pre', function (t) {
 
 test('clobber', function (t) {
     t.plan(2);
-    mkdirp(file, 0755, function (err) {
+    mkdirp(file, _0755, function (err) {
         t.ok(err);
         t.equal(err.code, 'ENOTDIR');
         t.end();
diff --git a/test/mkdirp.js b/test/mkdirp.js
index 3b624dd..eaa8921 100644
--- a/test/mkdirp.js
+++ b/test/mkdirp.js
@@ -3,6 +3,8 @@ var path = require('path');
 var fs = require('fs');
 var exists = fs.exists || path.exists;
 var test = require('tap').test;
+var _0777 = parseInt('0777', 8);
+var _0755 = parseInt('0755', 8);
 
 test('woo', function (t) {
     t.plan(5);
@@ -12,13 +14,13 @@ test('woo', function (t) {
     
     var file = '/tmp/' + [x,y,z].join('/');
     
-    mkdirp(file, 0755, function (err) {
+    mkdirp(file, _0755, function (err) {
         t.ifError(err);
         exists(file, function (ex) {
             t.ok(ex, 'file created');
             fs.stat(file, function (err, stat) {
                 t.ifError(err);
-                t.equal(stat.mode & 0777, 0755);
+                t.equal(stat.mode & _0777, _0755);
                 t.ok(stat.isDirectory(), 'target not a directory');
             })
         })
diff --git a/test/opts_fs.js b/test/opts_fs.js
index f1fbeca..97186b6 100644
--- a/test/opts_fs.js
+++ b/test/opts_fs.js
@@ -2,6 +2,8 @@ var mkdirp = require('../');
 var path = require('path');
 var test = require('tap').test;
 var mockfs = require('mock-fs');
+var _0777 = parseInt('0777', 8);
+var _0755 = parseInt('0755', 8);
 
 test('opts.fs', function (t) {
     t.plan(5);
@@ -13,13 +15,13 @@ test('opts.fs', function (t) {
     var file = '/beep/boop/' + [x,y,z].join('/');
     var xfs = mockfs.fs();
     
-    mkdirp(file, { fs: xfs, mode: 0755 }, function (err) {
+    mkdirp(file, { fs: xfs, mode: _0755 }, function (err) {
         t.ifError(err);
         xfs.exists(file, function (ex) {
             t.ok(ex, 'created file');
             xfs.stat(file, function (err, stat) {
                 t.ifError(err);
-                t.equal(stat.mode & 0777, 0755);
+                t.equal(stat.mode & _0777, _0755);
                 t.ok(stat.isDirectory(), 'target not a directory');
             });
         });
diff --git a/test/opts_fs_sync.js b/test/opts_fs_sync.js
index 224b506..6c370aa 100644
--- a/test/opts_fs_sync.js
+++ b/test/opts_fs_sync.js
@@ -2,6 +2,8 @@ var mkdirp = require('../');
 var path = require('path');
 var test = require('tap').test;
 var mockfs = require('mock-fs');
+var _0777 = parseInt('0777', 8);
+var _0755 = parseInt('0755', 8);
 
 test('opts.fs sync', function (t) {
     t.plan(4);
@@ -13,12 +15,12 @@ test('opts.fs sync', function (t) {
     var file = '/beep/boop/' + [x,y,z].join('/');
     var xfs = mockfs.fs();
     
-    mkdirp.sync(file, { fs: xfs, mode: 0755 });
+    mkdirp.sync(file, { fs: xfs, mode: _0755 });
     xfs.exists(file, function (ex) {
         t.ok(ex, 'created file');
         xfs.stat(file, function (err, stat) {
             t.ifError(err);
-            t.equal(stat.mode & 0777, 0755);
+            t.equal(stat.mode & _0777, _0755);
             t.ok(stat.isDirectory(), 'target not a directory');
         });
     });
diff --git a/test/perm.js b/test/perm.js
index 2c97590..fbce44b 100644
--- a/test/perm.js
+++ b/test/perm.js
@@ -3,18 +3,20 @@ var path = require('path');
 var fs = require('fs');
 var exists = fs.exists || path.exists;
 var test = require('tap').test;
+var _0777 = parseInt('0777', 8);
+var _0755 = parseInt('0755', 8);
 
 test('async perm', function (t) {
     t.plan(5);
     var file = '/tmp/' + (Math.random() * (1<<30)).toString(16);
     
-    mkdirp(file, 0755, function (err) {
+    mkdirp(file, _0755, function (err) {
         t.ifError(err);
         exists(file, function (ex) {
             t.ok(ex, 'file created');
             fs.stat(file, function (err, stat) {
                 t.ifError(err);
-                t.equal(stat.mode & 0777, 0755);
+                t.equal(stat.mode & _0777, _0755);
                 t.ok(stat.isDirectory(), 'target not a directory');
             })
         })
@@ -22,7 +24,7 @@ test('async perm', function (t) {
 });
 
 test('async root perm', function (t) {
-    mkdirp('/tmp', 0755, function (err) {
+    mkdirp('/tmp', _0755, function (err) {
         if (err) t.fail(err);
         t.end();
     });
diff --git a/test/perm_sync.js b/test/perm_sync.js
index 327e54b..398229f 100644
--- a/test/perm_sync.js
+++ b/test/perm_sync.js
@@ -3,17 +3,19 @@ var path = require('path');
 var fs = require('fs');
 var exists = fs.exists || path.exists;
 var test = require('tap').test;
+var _0777 = parseInt('0777', 8);
+var _0755 = parseInt('0755', 8);
 
 test('sync perm', function (t) {
     t.plan(4);
     var file = '/tmp/' + (Math.random() * (1<<30)).toString(16) + '.json';
     
-    mkdirp.sync(file, 0755);
+    mkdirp.sync(file, _0755);
     exists(file, function (ex) {
         t.ok(ex, 'file created');
         fs.stat(file, function (err, stat) {
             t.ifError(err);
-            t.equal(stat.mode & 0777, 0755);
+            t.equal(stat.mode & _0777, _0755);
             t.ok(stat.isDirectory(), 'target not a directory');
         });
     });
@@ -23,7 +25,7 @@ test('sync root perm', function (t) {
     t.plan(3);
     
     var file = '/tmp';
-    mkdirp.sync(file, 0755);
+    mkdirp.sync(file, _0755);
     exists(file, function (ex) {
         t.ok(ex, 'file created');
         fs.stat(file, function (err, stat) {
diff --git a/test/race.js b/test/race.js
index 7c295f4..b0b9e18 100644
--- a/test/race.js
+++ b/test/race.js
@@ -3,9 +3,11 @@ var path = require('path');
 var fs = require('fs');
 var exists = fs.exists || path.exists;
 var test = require('tap').test;
+var _0777 = parseInt('0777', 8);
+var _0755 = parseInt('0755', 8);
 
 test('race', function (t) {
-    t.plan(6);
+    t.plan(10);
     var ps = [ '', 'tmp' ];
     
     for (var i = 0; i < 25; i++) {
@@ -15,24 +17,19 @@ test('race', function (t) {
     var file = ps.join('/');
     
     var res = 2;
-    mk(file, function () {
-        if (--res === 0) t.end();
-    });
+    mk(file);
     
-    mk(file, function () {
-        if (--res === 0) t.end();
-    });
+    mk(file);
     
     function mk (file, cb) {
-        mkdirp(file, 0755, function (err) {
+        mkdirp(file, _0755, function (err) {
             t.ifError(err);
             exists(file, function (ex) {
                 t.ok(ex, 'file created');
                 fs.stat(file, function (err, stat) {
                     t.ifError(err);
-                    t.equal(stat.mode & 0777, 0755);
+                    t.equal(stat.mode & _0777, _0755);
                     t.ok(stat.isDirectory(), 'target not a directory');
-                    if (cb) cb();
                 });
             })
         });
diff --git a/test/rel.js b/test/rel.js
index d1f175c..4ddb342 100644
--- a/test/rel.js
+++ b/test/rel.js
@@ -3,6 +3,8 @@ var path = require('path');
 var fs = require('fs');
 var exists = fs.exists || path.exists;
 var test = require('tap').test;
+var _0777 = parseInt('0777', 8);
+var _0755 = parseInt('0755', 8);
 
 test('rel', function (t) {
     t.plan(5);
@@ -15,14 +17,14 @@ test('rel', function (t) {
     
     var file = [x,y,z].join('/');
     
-    mkdirp(file, 0755, function (err) {
+    mkdirp(file, _0755, function (err) {
         t.ifError(err);
         exists(file, function (ex) {
             t.ok(ex, 'file created');
             fs.stat(file, function (err, stat) {
                 t.ifError(err);
                 process.chdir(cwd);
-                t.equal(stat.mode & 0777, 0755);
+                t.equal(stat.mode & _0777, _0755);
                 t.ok(stat.isDirectory(), 'target not a directory');
             })
         })
diff --git a/test/root.js b/test/root.js
index 97ad7a2..9e7d079 100644
--- a/test/root.js
+++ b/test/root.js
@@ -2,12 +2,13 @@ var mkdirp = require('../');
 var path = require('path');
 var fs = require('fs');
 var test = require('tap').test;
+var _0755 = parseInt('0755', 8);
 
 test('root', function (t) {
     // '/' on unix, 'c:/' on windows.
     var file = path.resolve('/');
 
-    mkdirp(file, 0755, function (err) {
+    mkdirp(file, _0755, function (err) {
         if (err) throw err
         fs.stat(file, function (er, stat) {
             if (er) throw er
diff --git a/test/sync.js b/test/sync.js
index 88fa432..8c8dc93 100644
--- a/test/sync.js
+++ b/test/sync.js
@@ -3,6 +3,8 @@ var path = require('path');
 var fs = require('fs');
 var exists = fs.exists || path.exists;
 var test = require('tap').test;
+var _0777 = parseInt('0777', 8);
+var _0755 = parseInt('0755', 8);
 
 test('sync', function (t) {
     t.plan(4);
@@ -13,7 +15,7 @@ test('sync', function (t) {
     var file = '/tmp/' + [x,y,z].join('/');
 
     try {
-        mkdirp.sync(file, 0755);
+        mkdirp.sync(file, _0755);
     } catch (err) {
         t.fail(err);
         return t.end();
@@ -23,7 +25,7 @@ test('sync', function (t) {
         t.ok(ex, 'file created');
         fs.stat(file, function (err, stat) {
             t.ifError(err);
-            t.equal(stat.mode & 0777, 0755);
+            t.equal(stat.mode & _0777, _0755);
             t.ok(stat.isDirectory(), 'target not a directory');
         });
     });
diff --git a/test/umask.js b/test/umask.js
index 82c393a..2033c63 100644
--- a/test/umask.js
+++ b/test/umask.js
@@ -3,6 +3,8 @@ var path = require('path');
 var fs = require('fs');
 var exists = fs.exists || path.exists;
 var test = require('tap').test;
+var _0777 = parseInt('0777', 8);
+var _0755 = parseInt('0755', 8);
 
 test('implicit mode from umask', function (t) {
     t.plan(5);
@@ -18,7 +20,7 @@ test('implicit mode from umask', function (t) {
             t.ok(ex, 'file created');
             fs.stat(file, function (err, stat) {
                 t.ifError(err);
-                t.equal(stat.mode & 0777, 0777 & (~process.umask()));
+                t.equal(stat.mode & _0777, _0777 & (~process.umask()));
                 t.ok(stat.isDirectory(), 'target not a directory');
             });
         })
diff --git a/test/umask_sync.js b/test/umask_sync.js
index e537fbe..11a7614 100644
--- a/test/umask_sync.js
+++ b/test/umask_sync.js
@@ -3,6 +3,8 @@ var path = require('path');
 var fs = require('fs');
 var exists = fs.exists || path.exists;
 var test = require('tap').test;
+var _0777 = parseInt('0777', 8);
+var _0755 = parseInt('0755', 8);
 
 test('umask sync modes', function (t) {
     t.plan(4);
@@ -23,7 +25,7 @@ test('umask sync modes', function (t) {
         t.ok(ex, 'file created');
         fs.stat(file, function (err, stat) {
             t.ifError(err);
-            t.equal(stat.mode & 0777, (0777 & (~process.umask())));
+            t.equal(stat.mode & _0777, (_0777 & (~process.umask())));
             t.ok(stat.isDirectory(), 'target not a directory');
         });
     });

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-mkdirp.git



More information about the Pkg-javascript-commits mailing list