-
-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #151 from gulpjs/blaine-feature-metadata-refactor
Feature metadata refactor
- Loading branch information
Showing
26 changed files
with
2,251 additions
and
702 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
sudo: false | ||
sudo: required | ||
language: node_js | ||
node_js: | ||
- 'stable' | ||
- '4.1' | ||
- '4.0' | ||
- '4' | ||
- '0.12' | ||
- '0.10' | ||
before_script: | ||
- find test -type d -exec chmod g+s {} \; | ||
- sudo chown root test/not-owned/ | ||
- sudo chown root test/not-owned/not-owned.txt | ||
after_script: | ||
- npm run coveralls |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# http://www.appveyor.com/docs/appveyor-yml | ||
# http://www.appveyor.com/docs/lang/nodejs-iojs | ||
|
||
environment: | ||
matrix: | ||
# node.js | ||
- nodejs_version: "0.10" | ||
- nodejs_version: "0.12" | ||
- nodejs_version: "4" | ||
- nodejs_version: "5" | ||
|
||
install: | ||
- ps: Install-Product node $env:nodejs_version | ||
- npm install | ||
|
||
test_script: | ||
- node --version | ||
- npm --version | ||
- cmd: npm test | ||
|
||
build: off | ||
|
||
# build version format | ||
version: "{build}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,26 @@ | ||
'use strict'; | ||
|
||
var fs = require('graceful-fs'); | ||
var fo = require('../../fileOperations'); | ||
|
||
var futimes = require('../../futimes'); | ||
function writeBuffer(writePath, file, written) { | ||
var opt = { | ||
mode: file.stat.mode, | ||
flag: file.flag, | ||
}; | ||
|
||
function writeBuffer(writePath, file, cb) { | ||
var stat = file.stat; | ||
fo.writeFile(writePath, file.contents, opt, onWriteFile); | ||
|
||
fs.open(writePath, file.flag, stat.mode, function(err, fd) { | ||
if (err) { | ||
return cb(err); | ||
function onWriteFile(writeErr, fd) { | ||
if (writeErr) { | ||
return fo.closeFd(writeErr, fd, written); | ||
} | ||
|
||
fs.write(fd, file.contents, 0, file.contents.length, 0, function(error) { | ||
if (error) { | ||
return complete(error); | ||
} | ||
futimes(fd, stat, complete); | ||
}); | ||
fo.updateMetadata(fd, file, onUpdate); | ||
} | ||
|
||
// Cleanup | ||
function complete(err1) { | ||
fs.close(fd, function(err2) { | ||
cb(err1 || err2); | ||
}); | ||
} | ||
}); | ||
function onUpdate(statErr, fd) { | ||
fo.closeFd(statErr, fd, written); | ||
} | ||
} | ||
|
||
module.exports = writeBuffer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,53 @@ | ||
'use strict'; | ||
|
||
var fs = require('graceful-fs'); | ||
var mkdirp = require('mkdirp'); | ||
|
||
function writeDir(writePath, file, cb) { | ||
mkdirp(writePath, file.stat.mode, cb); | ||
var fo = require('../../fileOperations'); | ||
|
||
function writeDir(writePath, file, written) { | ||
var mkdirpOpts = { | ||
mode: file.stat.mode, | ||
fs: fs, | ||
}; | ||
mkdirp(writePath, mkdirpOpts, onMkdirp); | ||
|
||
function onMkdirp(mkdirpErr) { | ||
if (mkdirpErr) { | ||
return written(mkdirpErr); | ||
} | ||
|
||
fs.open(writePath, 'r', onOpen); | ||
} | ||
|
||
function onOpen(openErr, fd) { | ||
// If we don't have access, just move along | ||
if (isInaccessible(openErr)) { | ||
return fo.closeFd(null, fd, written); | ||
} | ||
|
||
if (openErr) { | ||
return fo.closeFd(openErr, fd, written); | ||
} | ||
|
||
fo.updateMetadata(fd, file, onUpdate); | ||
} | ||
|
||
function onUpdate(statErr, fd) { | ||
fo.closeFd(statErr, fd, written); | ||
} | ||
} | ||
|
||
function isInaccessible(err) { | ||
if (!err) { | ||
return false; | ||
} | ||
|
||
if (err.code === 'EACCES') { | ||
return true; | ||
} | ||
|
||
return false; | ||
} | ||
|
||
module.exports = writeDir; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.