Skip to content

Commit

Permalink
Folders should maintian the directory structure for src/**/*.coffee
Browse files Browse the repository at this point in the history
  • Loading branch information
simianhacker committed Jul 9, 2013
1 parent fb21e07 commit 1480b38
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion lib/createFolderStream.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ module.exports = function(folder, opt) {

function saveFile (file, cb) {
var writePath = path.join(folder, file.shortened);
var writeFolder = path.dirname(writePath);

mkdirp(folder, function(err){
mkdirp(writeFolder, function(err){
if (err) return cb(err);
fs.writeFile(writePath, file.contents, function(err){
if (err) return cb(err);
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions test/folder.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('gulp file collection', function() {
var outpath = join(__dirname, "./out-fixtures");
rimraf(outpath, function(err){
should.not.exist(err);
var instream = gulp.files(join(__dirname, "./fixtures/*.coffee"));
var instream = gulp.files(join(__dirname, "./fixtures/**/*.txt"));
var outstream = gulp.folder(outpath);
instream.pipe(outstream);

Expand All @@ -28,11 +28,11 @@ describe('gulp file collection', function() {
should.exist(file);
should.exist(file.path);
should.exist(file.contents);
file.path.should.equal(join(__dirname, "./fixtures/test.coffee"));
file.path.should.equal(join(__dirname, "./fixtures/copy/example.txt"));
String(file.contents).should.equal("this is a test");
});
outstream.on('end', function() {
fs.readFile(join(outpath, "test.coffee"), function(err, contents){
fs.readFile(join(outpath, "copy", "example.txt"), function(err, contents){
should.not.exist(err);
should.exist(contents);
String(contents).should.equal("this is a test");
Expand Down
1 change: 1 addition & 0 deletions test/out-fixtures/copy/example.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
this is a test

0 comments on commit 1480b38

Please sign in to comment.