mirror of
https://github.com/scratchfoundation/gh-pages.git
synced 2024-11-25 00:38:07 -05:00
Merge pull request #31 from tschaub/lint
Updated linter and assorted dependencies.
This commit is contained in:
commit
54d0b0c6fc
8 changed files with 27 additions and 122 deletions
20
.jshintrc
20
.jshintrc
|
@ -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
|
||||
}
|
||||
}
|
|
@ -8,7 +8,6 @@ var fs = require('q-io/fs');
|
|||
var git = 'git';
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @param {number} code Error code.
|
||||
|
|
|
@ -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') {
|
||||
|
|
|
@ -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 = [];
|
||||
|
|
25
package.json
25
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"
|
||||
}
|
||||
}
|
||||
|
|
56
tasks.js
56
tasks.js
|
@ -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);
|
|
@ -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
|
||||
}
|
||||
}
|
|
@ -1,3 +1,4 @@
|
|||
/* eslint-env mocha */
|
||||
var path = require('path');
|
||||
|
||||
var assert = require('../helper').assert;
|
||||
|
|
Loading…
Reference in a new issue