From 219de2e2c51d8f16bed9fe7889fc87d7f53f4c30 Mon Sep 17 00:00:00 2001 From: greenkeeperio-bot Date: Fri, 16 Oct 2015 19:24:25 -0400 Subject: [PATCH 1/2] chore(package): update eslint-config-mongodb-js to version 1.0.3 http://greenkeeper.io/ --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 344efbc..7589e6c 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ ], "devDependencies": { "coveralls": "^2.11.4", - "eslint-config-mongodb-js": "^0.1.6", + "eslint-config-mongodb-js": "^1.0.3", "istanbul": "^0.4.0", "mocha": "~2.3.3", "mongodb-js-fmt": "0.0.3", From b8a2716c4ea917534df9c2329b7fa419872a5638 Mon Sep 17 00:00:00 2001 From: Matt Kangas Date: Mon, 19 Oct 2015 20:50:28 -0400 Subject: [PATCH 2/2] :shirt: for eslint-config-mongodb-js-1.0.3 extract.unzip is disabled due to nonfunctional code --- bin/m.js | 5 +++-- index.js | 7 ++++--- lib/config.js | 6 +++--- lib/download.js | 5 ++++- lib/extract.js | 48 ++++++++++++++++++++++++---------------------- package.json | 1 - test/index.test.js | 1 + 7 files changed, 40 insertions(+), 33 deletions(-) diff --git a/bin/m.js b/bin/m.js index add87c5..96cbe26 100755 --- a/bin/m.js +++ b/bin/m.js @@ -1,6 +1,6 @@ #!/usr/bin/env node -/* eslint no-sync:0 no-octal-escape:0, no-path-concat:0 */ +/* eslint no-sync:0, no-console:0, no-octal-escape:0, no-path-concat:0 */ var fs = require('fs'); var docopt = require('docopt').docopt; var pkg = require('../package.json'); @@ -39,7 +39,7 @@ var abortIfError = function(err) { console.error(chalk.bold.red(figures.cross), ' Error:', chalk.bold.red(err.message)); - console.error('We apologize for this issue and welcome your bug reports.') + console.error('We apologize for this issue and welcome your bug reports.'); console.error('Please visit: https://github.com/mongodb-js/version-manager/issues'); console.error(); console.error('Try running your command again with debugging on:'); @@ -86,6 +86,7 @@ var commands = { }; mvm.installed(function(err, installed) { + /* eslint no-shadow:0 */ abortIfError(err); mvm.available(opts, function(err, versions) { diff --git a/index.js b/index.js index a405266..ae364a5 100644 --- a/index.js +++ b/index.js @@ -92,11 +92,12 @@ module.exports.is = function(s, done) { }; module.exports.current = function(fn) { - which('mongod', function(err, mongod_bin) { - if (err || !mongod_bin) { + which('mongod', function(err, mongodBin) { + /* eslint no-shadow:0 */ + if (err || !mongodBin) { return fn(null); } - exec(mongod_bin + ' --version', function(err, stdout) { + exec(mongodBin + ' --version', function(err, stdout) { if (err) return fn(err); var shellVersion = stdout diff --git a/lib/config.js b/lib/config.js index 660a727..4eaf13e 100644 --- a/lib/config.js +++ b/lib/config.js @@ -5,15 +5,15 @@ var untildify = require('untildify'); module.exports = {}; var dest; -var module_path = path.join(process.cwd(), 'node_modules', 'mongodb-version-manager'); +var modulePath = path.join(process.cwd(), 'node_modules', 'mongodb-version-manager'); if (process.env.MONGODB_VERSIONS) { dest = untildify(process.env.MONGODB_VERSIONS); } else { try { /* eslint no-sync:0 */ - isLocal = fs.statSync(module_path).isDirectory(); + var isLocal = fs.statSync(modulePath).isDirectory(); if (isLocal) { - dest = path.join(module_path, '.mongodb'); + dest = path.join(modulePath, '.mongodb'); } else { dest = untildify('~/.mongodb/versions'); } diff --git a/lib/download.js b/lib/download.js index c823bc0..3902025 100644 --- a/lib/download.js +++ b/lib/download.js @@ -21,13 +21,15 @@ function progressbar(pkg, res, totalSize) { bar.tick(chunk.length); }); } -/* eslint no-sync:0 */ + +// @todo (kangas): Needs cleanup module.exports = function(pkg, fn) { var dest = path.artifact(pkg); var url = pkg.url; var version = pkg.version; fs.mkdirs(path.artifacts(), function(err) { + /* eslint no-console:0, no-shadow:0 */ if (err) { return fn(err); } @@ -41,6 +43,7 @@ module.exports = function(pkg, fn) { debug('downloading artifact from `%s` to `%s`...', url, tildify(dest)); var out = fs.createWriteStream(dest); + var onFinish; var onError = function(err) { out.removeListener('finish', onFinish); debug('removing incomplete artifact from `%s`', dest); diff --git a/lib/extract.js b/lib/extract.js index 04d9453..36d0dca 100644 --- a/lib/extract.js +++ b/lib/extract.js @@ -1,38 +1,40 @@ var fs = require('fs-extra'); var zlib = require('zlib'); -var unzip = require('unzip'); var tar = require('tar'); var path = require('./path'); var tildify = require('tildify'); var debug = require('debug')('mongodb-version-manager::extract'); -function unzip(src, dest, done) { - var extractor = unzip.Extract({ - path: dest - }); +// @todo (kangas): this is broken +function unzipWrapper(src, dest, done) { + return done(new Error('unzipWrapper not implemented')); - var onSuccess = function() { - debug('unzipped `%s`', tildify(dest)); - var full = path.join(dest, nodePath.basename(pkg.artifact, '.zip')); - fs.move(full, dest, function(err) { - if (err) { - return done(err, null); - } - done(null, dest); - }); - }; + // var extractor = unzip.Extract({ + // path: dest + // }); - src.pipe(extractor); - extractor.once('close', onSuccess); - extractor.once('error', function(err) { - extractor.removeListener('close', onSuccess); - done(err); - }); + // var onSuccess = function() { + // debug('unzipped `%s`', tildify(dest)); + // var full = path.join(dest, nodePath.basename(pkg.artifact, '.zip')); + // fs.move(full, dest, function(err) { + // if (err) { + // return done(err, null); + // } + // done(null, dest); + // }); + // }; + + // src.pipe(extractor); + // extractor.once('close', onSuccess); + // extractor.once('error', function(err) { + // extractor.removeListener('close', onSuccess); + // done(err); + // }); } function untar(src, dest, done) { var ungzip = zlib.createGunzip(); - extractor = tar.Extract({ + var extractor = new tar.Extract({ path: dest, strip: 1 }); @@ -74,7 +76,7 @@ module.exports = function extract(pkg, done) { debug('reading %s', tildify(archive)); var src = fs.createReadStream(archive); - var transform = archive.indexOf('zip') > -1 ? unzip : untar; + var transform = archive.indexOf('zip') > -1 ? unzipWrapper : untar; transform(src, dest, function(err) { if (err) { return onError(err); diff --git a/package.json b/package.json index 7589e6c..088a3f2 100644 --- a/package.json +++ b/package.json @@ -52,7 +52,6 @@ "tar": "~2.2.1", "tildify": "~1.1.2", "untildify": "~2.1.0", - "unzip": "~0.1.11", "which": "~1.2.0" }, "license": "Apache-2.0" diff --git a/test/index.test.js b/test/index.test.js index 5413619..f346c82 100644 --- a/test/index.test.js +++ b/test/index.test.js @@ -14,6 +14,7 @@ debug('path to m bin is %s', M); debug('path to node bin is %s', NODE); var run = function(args, done) { + /* eslint no-sync:0 no-console:0 */ if (typeof args === 'function') { done = args; args = '';