Skip to content

Commit

Permalink
add appveyor to test on windows & get tests to actually pass
Browse files Browse the repository at this point in the history
  • Loading branch information
phated committed Feb 25, 2016
1 parent 84cf3c2 commit 011320b
Show file tree
Hide file tree
Showing 15 changed files with 858 additions and 556 deletions.
24 changes: 24 additions & 0 deletions appveyor.yml
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}"
6 changes: 5 additions & 1 deletion lib/dest/writeContents/writeDir.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ var mkdirp = require('mkdirp');
var fo = require('../../fileOperations');

function writeDir(writePath, file, written) {
mkdirp(writePath, file.stat.mode, onMkdirp);
var mkdirpOpts = {
mode: file.stat.mode,
fs: fs,
};
mkdirp(writePath, mkdirpOpts, onMkdirp);

function onMkdirp(mkdirpErr) {
if (mkdirpErr) {
Expand Down
1 change: 0 additions & 1 deletion lib/dest/writeContents/writeStream.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ function writeStream(writePath, file, written) {
var opt = {
mode: file.stat.mode,
flag: file.flag,
autoClose: false,
};

var outStream = fs.createWriteStream(writePath, opt);
Expand Down
12 changes: 11 additions & 1 deletion lib/fileOperations.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,18 @@ function getTimesDiff(fsStat, vinylStat) {
}

function isOwner(fsStat) {
var hasGetuid = (typeof process.getuid === 'function');
var hasGeteuid = (typeof process.geteuid === 'function');

// If we don't have either, assume we don't have permissions.
// This should only happen on Windows.
// Windows basically noops fchmod and errors on futimes called on directories.
if (!hasGeteuid && !hasGetuid) {
return false;
}

var uid;
if (typeof process.geteuid === 'function') {
if (hasGeteuid) {
uid = process.geteuid();
} else {
uid = process.getuid();
Expand Down
6 changes: 5 additions & 1 deletion lib/prepareWrite.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ function prepareWrite(outFolder, file, opt, cb) {
file.path = writePath;

// Mkdirp the folder the file is going in
mkdirp(writeFolder, options.dirMode, function(err) {
var mkdirpOpts = {
mode: options.dirMode,
fs: fs,
};
mkdirp(writeFolder, mkdirpOpts, function(err) {
if (err) {
return cb(err);
}
Expand Down
17 changes: 17 additions & 0 deletions lib/src/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use strict';

var path = require('path');
var assign = require('object-assign');
var through2 = require('through2');
var gs = require('glob-stream');
Expand All @@ -13,6 +14,21 @@ var isValidGlob = require('is-valid-glob');
var getContents = require('./getContents');
var resolveSymlinks = require('./resolveSymlinks');

function normalizePath(options) {

function normalize(globFile, enc, cb) {
// TODO: probably move this somewhere
// Ref https://github.com/gulpjs/vinyl/issues/80
var normalizedFile = assign({}, globFile, {
path: path.normalize(globFile.path),
});

cb(null, normalizedFile);
}

return through2.obj(options, normalize);
}

function createFile(globFile, enc, cb) {
cb(null, new File(globFile));
}
Expand All @@ -36,6 +52,7 @@ function src(glob, opt) {
var globStream = gs.create(glob, options);

var outputStream = globStream
.pipe(normalizePath(options))
.pipe(resolveSymlinks(options))
.pipe(through2.obj(opt, createFile));

Expand Down
Loading

0 comments on commit 011320b

Please sign in to comment.