diff --git a/.jshintrc b/.jshintrc deleted file mode 100644 index 3dbf635..0000000 --- a/.jshintrc +++ /dev/null @@ -1,20 +0,0 @@ -{ - "curly": true, - "eqeqeq": true, - "indent": 2, - "latedef": true, - "newcap": true, - "nonew": true, - "quotmark": "single", - "undef": true, - "trailing": true, - "maxlen": 80, - "globals": { - "Buffer": false, - "exports": true, - "module": false, - "process": false, - "require": false, - "__dirname": false - } -} \ No newline at end of file diff --git a/lib/git.js b/lib/git.js index ad96a1b..af3c8b7 100644 --- a/lib/git.js +++ b/lib/git.js @@ -8,7 +8,6 @@ var fs = require('q-io/fs'); var git = 'git'; - /** * @constructor * @param {number} code Error code. diff --git a/lib/index.js b/lib/index.js index 201ff81..61f7bef 100644 --- a/lib/index.js +++ b/lib/index.js @@ -6,7 +6,6 @@ var wrench = require('wrench'); var _ = require('lodash'); var glob = require('glob'); -var pkg = require('../package.json'); var git = require('./git'); var copy = require('./util').copy; @@ -48,6 +47,9 @@ function getRepo(options) { /** * Push a git branch to a remote (pushes gh-pages by default). + * @param {string} basePath The base path. + * @param {Object} config Publish options. + * @param {Function} done Callback. */ exports.publish = function publish(basePath, config, done) { if (typeof config === 'function') { @@ -179,14 +181,14 @@ exports.publish = function publish(basePath, config, done) { var deferred = Q.defer(); git.tag(options.tag, options.clone) .then(function() { - return deferred.resolve(); - }) + return deferred.resolve(); + }) .fail(function(error) { - // tagging failed probably because this tag alredy exists - log('Tagging failed, continuing'); - options.logger(error); - return deferred.resolve(); - }); + // tagging failed probably because this tag alredy exists + log('Tagging failed, continuing'); + options.logger(error); + return deferred.resolve(); + }); return deferred.promise; } else { return Q.resolve(); diff --git a/lib/util.js b/lib/util.js index c3742dd..f718045 100644 --- a/lib/util.js +++ b/lib/util.js @@ -131,7 +131,7 @@ function makeDir(path, callback) { * @param {string} dest Destination directory. * @return {Promise} A promise. */ -var copy = exports.copy = function(files, base, dest) { +exports.copy = function(files, base, dest) { var deferred = Q.defer(); var pairs = []; diff --git a/package.json b/package.json index 62906e5..3cdcddd 100644 --- a/package.json +++ b/package.json @@ -22,24 +22,29 @@ }, "main": "lib/index.js", "scripts": { - "test": "node tasks.js lint test" + "pretest": "eslint lib test", + "test": "mocha --recursive test" }, "dependencies": { - "async": "0.2.9", - "commander": "~2.8.1", + "async": "1.5.0", + "commander": "2.9.0", "glob": "~4.0.2", - "graceful-fs": "2.0.1", + "graceful-fs": "4.1.2", "lodash": "~2.4.1", - "q": "~1.0.1", - "q-io": "~1.11.0", - "wrench": "1.5.1" + "q": "1.4.1", + "q-io": "1.13.2", + "wrench": "1.5.8" }, "devDependencies": { - "mocha": "~1.18.2", - "jshint": "~2.4.4", - "chai": "~1.9.1" + "chai": "^3.4.1", + "eslint": "^1.10.3", + "eslint-config-tschaub": "^2.0.0", + "mocha": "^2.3.4" }, "bin": { "gh-pages": "bin/gh-pages" + }, + "eslintConfig": { + "extends": "tschaub" } } diff --git a/tasks.js b/tasks.js deleted file mode 100644 index 6afd7a3..0000000 --- a/tasks.js +++ /dev/null @@ -1,56 +0,0 @@ -var path = require('path'); - -var jshint = require('jshint/src/cli').run; -var glob = require('glob'); -var Mocha = require('mocha'); - - -/** - * Run the linter. - * @param {function(Error)} done Callback. - */ -exports.lint = function(done) { - var args = ['lib', 'test', 'tasks.js']; - var passed = jshint({args: args}); - process.nextTick(function() { - done(passed ? null : new Error('JSHint failed')); - }); -}; - - -/** - * Run the tests. - * @param {function(Error)} done Callback. - */ -exports.test = function(done) { - var mocha = new Mocha(); - mocha.reporter('spec'); - mocha.ui('bdd'); - mocha.files = glob.sync('test/**/*.spec.js').map(function(file) { - return path.resolve(file); - }); - mocha.run(function(failures) { - done(failures ? new Error('Mocha failures') : null); - }); -}; - - -var tasks = process.argv.slice(2); - -function run(current) { - var task = tasks[current]; - if (task) { - exports[task](function(err) { - if (err) { - process.stderr.write(err.message + '\n'); - process.exit(1); - } else { - ++current; - run(current); - } - }); - } else { - process.exit(0); - } -} -run(0); diff --git a/test/.jshintrc b/test/.jshintrc deleted file mode 100644 index ff66433..0000000 --- a/test/.jshintrc +++ /dev/null @@ -1,26 +0,0 @@ -{ - "curly": true, - "eqeqeq": true, - "indent": 2, - "latedef": true, - "newcap": true, - "nonew": true, - "quotmark": "single", - "undef": true, - "trailing": true, - "maxlen": 80, - "globals": { - "Buffer": false, - "exports": true, - "before": false, - "beforeEach": false, - "after": false, - "afterEach": false, - "describe": false, - "it": false, - "module": false, - "process": false, - "require": false, - "__dirname": false - } -} \ No newline at end of file diff --git a/test/lib/util.spec.js b/test/lib/util.spec.js index 2ec1b8d..f541c37 100644 --- a/test/lib/util.spec.js +++ b/test/lib/util.spec.js @@ -1,3 +1,4 @@ +/* eslint-env mocha */ var path = require('path'); var assert = require('../helper').assert;