Skip to content

Commit

Permalink
use gulp-util
Browse files Browse the repository at this point in the history
  • Loading branch information
Contra committed Jul 6, 2013
1 parent 402bee4 commit f72878d
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 26 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ Tips:

1. file.contents should always be a Buffer
2. Use the `clone` module to clone options and copy the file object. Do not mutate the file object then pass it! Clone it then mutate it.
3. Make use of the gulp-util library. Do you need to change a file's extension or do something tedious? Try looking if it's there first.

```javascript
var es = require('event-stream'),
Expand Down
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module.exports = gulp = {
files: require('./lib/createFilesStream'),
file: require('./lib/createFileStream'),
folder: require('./lib/createFolderStream'),

createGlobStream: require('glob-stream').create,
readFile: require('./lib/readFile'),
realBase: require('./lib/realBase')
readFile: require('./lib/readFile')
};
2 changes: 1 addition & 1 deletion lib/createFileStream.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var es = require('event-stream'),
readFile = require('./readFile'),
dirname = require('path').dirname,
realBase = require('./realBase');
realBase = require('gulp-util').realBase;

module.exports = function(path, opt) {
if (!opt) opt = {};
Expand Down
2 changes: 1 addition & 1 deletion lib/readFile.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var fs = require('fs'),
realBase = require('./realBase');
realBase = require('gulp-util').realBase;

module.exports = function (file, cb) {
fs.readFile(file.path, function (err, data) {
Expand Down
9 changes: 0 additions & 9 deletions lib/realBase.js

This file was deleted.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"event-stream":"3.0.15",
"glob-stream":"0.0.3",
"mkdirp":"0.3.5",
"optimist":"0.6.0"
"optimist":"0.6.0",
"gulp-util":"*"
},
"devDependencies":{
"mocha":"1.12.0",
Expand Down
12 changes: 0 additions & 12 deletions test/file-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,4 @@ describe('gulp file utilities', function() {
});
});
});

describe('realBase()', function() {
it('should return a valid shortened name', function(done) {
var fname = join(__dirname, "./fixtures/test.coffee");
var dname = join(__dirname, "./fixtures/");
var shortened = gulp.realBase(dname, fname);
should.exist(shortened);
shortened.should.equal("test.coffee");
done();
});
});

});

0 comments on commit f72878d

Please sign in to comment.