Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

added istanbul code coverage and bumped deps

  • Loading branch information...
commit 72a8d2ef2d7f6c88e6cba3c1938a4d4f8dc0fae7 1 parent 6644467
@twobit twobit authored
View
4 .gitignore
@@ -1,2 +1,4 @@
node_modules
-testing
+testing
+lib-cov
+html-report
View
16 Makefile
@@ -1,4 +1,6 @@
-all: bootstrap test
+BIN = ./node_modules/.bin
+
+all: bootstrap test coverage
bootstrap:
node bootstrap.js
@@ -6,4 +8,16 @@ bootstrap:
test:
npm test
+coverage: lib-cov
+ @COVER=1 $(BIN)/mocha --require should --reporter mocha-istanbul
+
+lib-cov:
+ @$(BIN)/istanbul instrument --output lib-cov --no-compact --variable global.__coverage__ lib
+
+clean: clean-coverage
+
+clean-coverage:
+ -rm -rf lib-cov
+ -rm -rf html-report
+
.PHONY: test
View
2  index.js
@@ -4,7 +4,7 @@
* See the accompanying LICENSE file for terms.
*/
var fs = require('fs'),
- path = __dirname + '/lib/',
+ path = __dirname + (process.env.COVER ? '/lib-cov/' : '/lib/'),
tasks = fs.readdirSync(path).filter(function(file) {return file.substr(-3) === '.js';});
tasks.forEach(function(task) {
View
10 lib/s3.js
@@ -4,11 +4,10 @@
* See the accompanying LICENSE file for terms.
*/
var knox = require('knox'),
- Crypto = require('crypto'),
mime = require('mime');
/**
- * Send blob to S3 with an optional checksum in the filename.
+ * Send blob to S3.
*
* @param options {Object} S3 task options.
* @param options.name {String} Resource name.
@@ -21,18 +20,11 @@ var s3 = exports.s3 = function s3(options, blob, done) {
name = options.name,
result,
client,
- checksum,
req;
result = blob.result;
client = knox.createClient(options.client);
- if (name.indexOf('{checksum}') > -1) { // Replace {checksum} with md5 string
- checksum = Crypto.createHash('md5');
- checksum.update(result);
- name = name.replace('{checksum}', checksum.digest('hex'));
- }
-
req = client.put(name, {'Content-Length': result.length, 'Content-Type': mime.lookup(name)});
req.on('response', function (res) {
View
16 package.json
@@ -1,6 +1,6 @@
{
"name": "gear-lib",
- "version": "0.8.7",
+ "version": "0.8.8",
"description": "Collection of common Gear.js tasks",
"author": "Stephen Murphy <stephen@hypernaut.com>",
"keywords": ["gear", "task", "build"],
@@ -13,17 +13,19 @@
"dependencies": {
"gear": ">= 0.8.x",
"jslint": "0.1.x",
- "uglify-js": "1.2.x",
+ "uglify-js": "1.3.x",
"csslint": "0.9.x",
- "less": "1.2.x",
+ "less": "1.3.x",
"handlebars": "1.0.x",
"mime": "1.2.x",
- "knox": "0.0.x",
- "async": "0.1.x",
+ "knox": "0.5.x",
+ "async": "0.2.x",
"glob": "3.1.x"
},
"devDependencies": {
- "should": "1.2.x",
- "mocha": "1.7.x"
+ "should": "*",
+ "mocha": "*",
+ "mocha-istanbul": "*",
+ "istanbul": "*"
}
}
View
2  test/csslint.js
@@ -1,6 +1,6 @@
var should = require('should'),
Blob = require('gear').Blob,
- csslint = require('../lib/csslint').csslint,
+ csslint = require('..').csslint,
fixtures = {
invalid: new Blob('%%%%'),
options: new Blob('.foo {width: 0; width: 0;}')
View
4 test/cssminify.js
@@ -1,6 +1,6 @@
var Blob = require('gear').Blob,
- cssminify = require('../lib/cssminify').cssminify,
- less = require('../lib/cssminify').less,
+ cssminify = require('..').cssminify,
+ less = require('..').less,
fixtures = {
css: new Blob(' .bar { display: none; } '),
min: '.bar{display:none;}\n',
View
2  test/glob.js
@@ -1,7 +1,7 @@
var should = require('should'),
Queue = require('gear').Queue,
Registry = require('gear').Registry,
- glob = require('../lib/glob').glob,
+ glob = require('..').glob,
fixtures = {
options: {pattern: 'ind*.js'},
expected: 'index.js'
View
2  test/handlebars.js
@@ -1,5 +1,5 @@
var Blob = require('gear').Blob,
- handlebars = require('../lib/handlebars').handlebars,
+ handlebars = require('..').handlebars,
fixtures = {
tmpl: new Blob('test:{{test}}')
};
View
2  test/jslint.js
@@ -1,5 +1,5 @@
var Blob = require('gear').Blob,
- jslint = require('../lib/jslint').jslint,
+ jslint = require('..').jslint,
fixtures = {
invalid: new Blob('^^^^'),
options: new Blob('function _blah() {}')
View
2  test/jsminify.js
@@ -1,5 +1,5 @@
var Blob = require('gear').Blob,
- jsminify = require('../lib/jsminify').jsminify,
+ jsminify = require('..').jsminify,
fixtures = {
js: new Blob('function test( x ) {console.log(x);;;;}'),
min: 'function test(x){console.log(x);}\n',
View
2  test/replace.js
@@ -1,5 +1,5 @@
var Blob = require('gear').Blob,
- replace = require('../lib/replace').replace,
+ replace = require('..').replace,
fixtures = {
js: new Blob("function (x) { Y.log('REMOVEME');}"),
replaced: "function (x) { }",
View
13 test/s3.js
@@ -1,5 +1,6 @@
var Blob = require('gear').Blob,
- s3 = require('../lib/s3').s3,
+ s3 = require('..').s3,
+ should = require('should'),
fixtures = {
options: {
name: 'test.js',
@@ -12,15 +13,11 @@ var Blob = require('gear').Blob,
js: new Blob('function test( x ) {console.log(x);;;;}')
};
-/*
describe('s3()', function() {
- // Travis CI can't write to S3
it('should deploy to s3', function(done) {
s3(fixtures.options, fixtures.js, function(err, results) {
- done(err);
+ should.exist(err); // Travis CI can't write to S3
+ done();
});
});
-
- it('should replace {checksum} in filename');
-});
-*/
+});
View
2  test/stamp.js
@@ -1,5 +1,5 @@
var Blob = require('gear').Blob,
- stamp = require('../lib/stamp').stamp,
+ stamp = require('..').stamp,
fixtures = {
prefix: 'function() {\n',
postfix: '\n}\n',
Please sign in to comment.
Something went wrong with that request. Please try again.