gulp-rsync
gulp-rsync copied to clipboard
cwrsync not creating folders on server
I've gotten the following gulp task to transfer files from a Windows 10 machine to a remote Linux server. However, files are being copied with a backslash "" vice forward slash "/" resulting in long file names like "js\myjs.js" instead of creating a folder called "js" with "myjs.js" in it. I haven't found an option or switch to fix the problem. Any ideas what I'm doing wrong?
gulp.task('deploy', function() { return gulp.src('dist/*/') .pipe(rsync({ options: { chmod: 'ugo=rwX', 'r': true, 'v': true, 'delete': true, 'verbose': true, 'progress': true }, username: "user", password: "pass", hostname: 'host.com', destination: '~/test/', recursive: true, root: "dist/" })); });
@reggie3 I've got the same problem and have battling with all day.
In gulp-rsync index.js
change:
source: sources.map(function(source) {
return path.relative(cwd, source.path) || '.';
}),
to:
source: sources.map(function(source) {
var file_path = (path.relative(cwd, source.path) || '.').replace( /\\/g, '/')
// console.log( 'gulp-rsync source:', source.path, ', ret: ', file_path );
return file_path
}),
path.relative()
is the culprit.
There may be a better solution and I'll continue looking at it tomorrow,
@reggie3 The fork mentioned https://github.com/jerrysu/gulp-rsync/pull/28 resolves this issue. However the same dev has created rsync-slim https://github.com/stcruy/rsync-slim which I suggest folks use.