gulp-rev-all
Advanced tools
Comparing version 0.9.2 to 0.9.3
@@ -62,3 +62,3 @@ var Through = require('through2'); | ||
this.emit('error', new PluginError(PLUGIN_NAME, 'revision() must be called first!')); | ||
return callback('abc'); | ||
return callback(); | ||
} | ||
@@ -96,3 +96,3 @@ | ||
}); | ||
}); | ||
@@ -99,0 +99,0 @@ } |
{ | ||
"name": "gulp-rev-all", | ||
"version": "0.9.2", | ||
"version": "0.9.3", | ||
"description": "Static asset revisioning by appending content hash to filenames: unicorn.css => unicorn.098f6bcd.css, also re-writes references in each file to new reved name.", | ||
@@ -13,3 +13,4 @@ "main": "index.js", | ||
"devDependencies": { | ||
"gulp": "~3.5.5", | ||
"event-stream": "^3.3.4", | ||
"gulp": "~3.9.1", | ||
"gulp-jshint": "~1.5.1", | ||
@@ -16,0 +17,0 @@ "gulp-mocha": "~2.2.0", |
@@ -85,3 +85,3 @@ # [gulp](https://github.com/wearefractal/gulp)-rev-all [![Build Status](https://travis-ci.org/smysnk/gulp-rev-all.png?branch=master)](https://travis-ci.org/smysnk/gulp-rev-all) | ||
### .revision() | ||
### .revision({ options }) | ||
Returns a transform function that can be used to pipe files through so that they may be revisioned, also corrects refererences to said files. | ||
@@ -88,0 +88,0 @@ |
@@ -84,9 +84,13 @@ var Gutil = require('gulp-util'); | ||
return new Gutil.File({ | ||
var file = new Gutil.File({ | ||
cwd: this.pathCwd, | ||
base: this.pathBase, | ||
path: Path.join(this.pathBase, this.options.fileNameVersion), | ||
contents: new Buffer(JSON.stringify(out, null, 2)) | ||
contents: new Buffer(JSON.stringify(out, null, 2)), | ||
revisioner: this | ||
}); | ||
file.revisioner = this; | ||
return file; | ||
}; | ||
@@ -96,9 +100,12 @@ | ||
return new Gutil.File({ | ||
var file = new Gutil.File({ | ||
cwd: this.pathCwd, | ||
base: this.pathBase, | ||
path: Path.join(this.pathBase, this.options.fileNameManifest), | ||
contents: new Buffer(JSON.stringify(this.manifest, null, 2)) | ||
contents: new Buffer(JSON.stringify(this.manifest, null, 2)), | ||
}); | ||
file.revisioner = this; | ||
return file; | ||
}; | ||
@@ -105,0 +112,0 @@ |
53
test.js
@@ -7,2 +7,3 @@ var RevAll = require('./index'); | ||
var Gutil = require('gulp-util'); | ||
var es = require('event-stream'); | ||
@@ -27,2 +28,54 @@ require('should'); | ||
describe('basic usage', function () { | ||
it('should be able to call all methods', function (done) { | ||
gulp | ||
.src(['test/fixtures/config1/**']) | ||
.pipe(RevAll.revision()) | ||
.pipe(RevAll.versionFile()) | ||
.pipe(es.map(function(file, callback) { | ||
Path.basename(file.path).should.equal('rev-version.json'); | ||
return callback(null, file); | ||
})) | ||
.pipe(RevAll.manifestFile()) | ||
.pipe(es.map(function(file, callback) { | ||
Path.basename(file.path).should.equal('rev-manifest.json'); | ||
done(); | ||
return callback(null, file); | ||
})); | ||
}); | ||
it('should throw an error when versionFile() is called before revision()', function (done) { | ||
gulp | ||
.src(['test/fixtures/config1/**']) | ||
.pipe(RevAll.versionFile()) | ||
.on('error', function(err) { | ||
err.message.should.equal('revision() must be called first!'); | ||
done(); | ||
}) | ||
.pipe(es.map(function(file, callback) { | ||
done('shouldnt get here'); | ||
})); | ||
}); | ||
it('should throw an error when manifestFile() is called before revision()', function (done) { | ||
gulp | ||
.src(['test/fixtures/config1/**']) | ||
.pipe(RevAll.manifestFile()) | ||
.on('error', function(err) { | ||
err.message.should.equal('revision() must be called first!'); | ||
done(); | ||
}) | ||
.pipe(es.map(function(file, callback) { | ||
done('shouldnt get here'); | ||
})); | ||
}); | ||
}); | ||
describe('resource hash calculation', function () { | ||
@@ -29,0 +82,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
732382
1771
6