-
-
Notifications
You must be signed in to change notification settings - Fork 157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature metadata refactor #151
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
35e9b3a
Use filedescriptors where possible, refactor handling of stats metada…
piranna 90a1189
Make the tests pass again, some more refactoring of metadata handling
erikkemperman 84cf3c2
refactor and lots of tests for updating of metadata
phated 011320b
add appveyor to test on windows & get tests to actually pass
phated 6f4c2eb
`sourcemaps` is not a valid option to gulp-sourcemaps
phated 8d55978
skip broken tests that were not testing the right thing
phated 550edd5
test on latest node 4 instead of old ones
phated 0cd8f22
add docs for changes
phated File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this wasn't a valid option for gulp-sourcemaps so I snuck it in