teambition / gulp-ssh

SSH and SFTP tasks for gulp
184 stars 38 forks source link

dest command transfer all folders to remote? #44

Closed csonlai closed 8 years ago

csonlai commented 8 years ago
  return gulp
    .src(paths.dist.dir + '*.html')
    .pipe(gulpSSH.dest(paths.build.htmlDir));

as result,it transfer all folders to remote, not just the html files, for example: [17:33:40] Finished writing '/xx/x/remote_dir/d:/project/src/xx.html

how could i only transfer the html files to remote? thx

csonlai commented 8 years ago

this bug only happen in windows file system,i think this will fix it:

getSftp(function (err, sftp) {
  if (err) return end(err, callback)

  file.base = file.base.replace(/\\/g,'/'); //add to fix bug in windows

  var baseRegexp = new RegExp('^' + file.base.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&'))
  var outPath = path.join(destDir, file.path.replace(baseRegexp, '')).replace(/\\/g, '/')
  ..........
zensh commented 8 years ago

You can try to add a filter stream between src and dest

gulp.src(htmlPath).pipe(filterStream).pipe(sshStream)

csonlai commented 8 years ago

can filter stream change the file.base?