mirror of
https://github.com/scratchfoundation/gh-pages.git
synced 2024-11-28 18:25:38 -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';
|
var git = 'git';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @constructor
|
* @constructor
|
||||||
* @param {number} code Error code.
|
* @param {number} code Error code.
|
||||||
|
|
18
lib/index.js
18
lib/index.js
|
@ -6,7 +6,6 @@ var wrench = require('wrench');
|
||||||
var _ = require('lodash');
|
var _ = require('lodash');
|
||||||
var glob = require('glob');
|
var glob = require('glob');
|
||||||
|
|
||||||
var pkg = require('../package.json');
|
|
||||||
var git = require('./git');
|
var git = require('./git');
|
||||||
|
|
||||||
var copy = require('./util').copy;
|
var copy = require('./util').copy;
|
||||||
|
@ -48,6 +47,9 @@ function getRepo(options) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Push a git branch to a remote (pushes gh-pages by default).
|
* 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) {
|
exports.publish = function publish(basePath, config, done) {
|
||||||
if (typeof config === 'function') {
|
if (typeof config === 'function') {
|
||||||
|
@ -179,14 +181,14 @@ exports.publish = function publish(basePath, config, done) {
|
||||||
var deferred = Q.defer();
|
var deferred = Q.defer();
|
||||||
git.tag(options.tag, options.clone)
|
git.tag(options.tag, options.clone)
|
||||||
.then(function() {
|
.then(function() {
|
||||||
return deferred.resolve();
|
return deferred.resolve();
|
||||||
})
|
})
|
||||||
.fail(function(error) {
|
.fail(function(error) {
|
||||||
// tagging failed probably because this tag alredy exists
|
// tagging failed probably because this tag alredy exists
|
||||||
log('Tagging failed, continuing');
|
log('Tagging failed, continuing');
|
||||||
options.logger(error);
|
options.logger(error);
|
||||||
return deferred.resolve();
|
return deferred.resolve();
|
||||||
});
|
});
|
||||||
return deferred.promise;
|
return deferred.promise;
|
||||||
} else {
|
} else {
|
||||||
return Q.resolve();
|
return Q.resolve();
|
||||||
|
|
|
@ -131,7 +131,7 @@ function makeDir(path, callback) {
|
||||||
* @param {string} dest Destination directory.
|
* @param {string} dest Destination directory.
|
||||||
* @return {Promise} A promise.
|
* @return {Promise} A promise.
|
||||||
*/
|
*/
|
||||||
var copy = exports.copy = function(files, base, dest) {
|
exports.copy = function(files, base, dest) {
|
||||||
var deferred = Q.defer();
|
var deferred = Q.defer();
|
||||||
|
|
||||||
var pairs = [];
|
var pairs = [];
|
||||||
|
|
25
package.json
25
package.json
|
@ -22,24 +22,29 @@
|
||||||
},
|
},
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "node tasks.js lint test"
|
"pretest": "eslint lib test",
|
||||||
|
"test": "mocha --recursive test"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"async": "0.2.9",
|
"async": "1.5.0",
|
||||||
"commander": "~2.8.1",
|
"commander": "2.9.0",
|
||||||
"glob": "~4.0.2",
|
"glob": "~4.0.2",
|
||||||
"graceful-fs": "2.0.1",
|
"graceful-fs": "4.1.2",
|
||||||
"lodash": "~2.4.1",
|
"lodash": "~2.4.1",
|
||||||
"q": "~1.0.1",
|
"q": "1.4.1",
|
||||||
"q-io": "~1.11.0",
|
"q-io": "1.13.2",
|
||||||
"wrench": "1.5.1"
|
"wrench": "1.5.8"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"mocha": "~1.18.2",
|
"chai": "^3.4.1",
|
||||||
"jshint": "~2.4.4",
|
"eslint": "^1.10.3",
|
||||||
"chai": "~1.9.1"
|
"eslint-config-tschaub": "^2.0.0",
|
||||||
|
"mocha": "^2.3.4"
|
||||||
},
|
},
|
||||||
"bin": {
|
"bin": {
|
||||||
"gh-pages": "bin/gh-pages"
|
"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 path = require('path');
|
||||||
|
|
||||||
var assert = require('../helper').assert;
|
var assert = require('../helper').assert;
|
||||||
|
|
Loading…
Reference in a new issue