Skip to content

Commit 011320b

Browse files
committed
add appveyor to test on windows & get tests to actually pass
1 parent 84cf3c2 commit 011320b

15 files changed

+858
-556
lines changed

appveyor.yml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# http://www.appveyor.com/docs/appveyor-yml
2+
# http://www.appveyor.com/docs/lang/nodejs-iojs
3+
4+
environment:
5+
matrix:
6+
# node.js
7+
- nodejs_version: "0.10"
8+
- nodejs_version: "0.12"
9+
- nodejs_version: "4"
10+
- nodejs_version: "5"
11+
12+
install:
13+
- ps: Install-Product node $env:nodejs_version
14+
- npm install
15+
16+
test_script:
17+
- node --version
18+
- npm --version
19+
- cmd: npm test
20+
21+
build: off
22+
23+
# build version format
24+
version: "{build}"

lib/dest/writeContents/writeDir.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ var mkdirp = require('mkdirp');
66
var fo = require('../../fileOperations');
77

88
function writeDir(writePath, file, written) {
9-
mkdirp(writePath, file.stat.mode, onMkdirp);
9+
var mkdirpOpts = {
10+
mode: file.stat.mode,
11+
fs: fs,
12+
};
13+
mkdirp(writePath, mkdirpOpts, onMkdirp);
1014

1115
function onMkdirp(mkdirpErr) {
1216
if (mkdirpErr) {

lib/dest/writeContents/writeStream.js

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ function writeStream(writePath, file, written) {
99
var opt = {
1010
mode: file.stat.mode,
1111
flag: file.flag,
12-
autoClose: false,
1312
};
1413

1514
var outStream = fs.createWriteStream(writePath, opt);

lib/fileOperations.js

+11-1
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,18 @@ function getTimesDiff(fsStat, vinylStat) {
6969
}
7070

7171
function isOwner(fsStat) {
72+
var hasGetuid = (typeof process.getuid === 'function');
73+
var hasGeteuid = (typeof process.geteuid === 'function');
74+
75+
// If we don't have either, assume we don't have permissions.
76+
// This should only happen on Windows.
77+
// Windows basically noops fchmod and errors on futimes called on directories.
78+
if (!hasGeteuid && !hasGetuid) {
79+
return false;
80+
}
81+
7282
var uid;
73-
if (typeof process.geteuid === 'function') {
83+
if (hasGeteuid) {
7484
uid = process.geteuid();
7585
} else {
7686
uid = process.getuid();

lib/prepareWrite.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,11 @@ function prepareWrite(outFolder, file, opt, cb) {
5454
file.path = writePath;
5555

5656
// Mkdirp the folder the file is going in
57-
mkdirp(writeFolder, options.dirMode, function(err) {
57+
var mkdirpOpts = {
58+
mode: options.dirMode,
59+
fs: fs,
60+
};
61+
mkdirp(writeFolder, mkdirpOpts, function(err) {
5862
if (err) {
5963
return cb(err);
6064
}

lib/src/index.js

+17
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
'use strict';
22

3+
var path = require('path');
34
var assign = require('object-assign');
45
var through2 = require('through2');
56
var gs = require('glob-stream');
@@ -13,6 +14,21 @@ var isValidGlob = require('is-valid-glob');
1314
var getContents = require('./getContents');
1415
var resolveSymlinks = require('./resolveSymlinks');
1516

17+
function normalizePath(options) {
18+
19+
function normalize(globFile, enc, cb) {
20+
// TODO: probably move this somewhere
21+
// Ref https://github.com/gulpjs/vinyl/issues/80
22+
var normalizedFile = assign({}, globFile, {
23+
path: path.normalize(globFile.path),
24+
});
25+
26+
cb(null, normalizedFile);
27+
}
28+
29+
return through2.obj(options, normalize);
30+
}
31+
1632
function createFile(globFile, enc, cb) {
1733
cb(null, new File(globFile));
1834
}
@@ -36,6 +52,7 @@ function src(glob, opt) {
3652
var globStream = gs.create(glob, options);
3753

3854
var outputStream = globStream
55+
.pipe(normalizePath(options))
3956
.pipe(resolveSymlinks(options))
4057
.pipe(through2.obj(opt, createFile));
4158

0 commit comments

Comments
 (0)