teambition / gulp-ssh

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

Copy an entire folder from local to remote #48

Closed caneta closed 8 years ago

caneta commented 8 years ago

Hi. I'm tryingo to copy a local folder to a remote server with the following syntax:

gulp.task('deploy:bootstrap', () =>
  gulp.src(['./dist/bootstrap-2.3.2/'])
    .pipe(gulpSSH.dest('/home/user/dest/'))
);

But I get the following:

user@host:$ gulp deploy:bootstrap
[11:47:29] Using gulpfile /home/user/project/gulpfile.js
[11:47:29] Starting 'deploy:bootstrap'...
[11:47:29] "/home/user/project/dist/bootstrap-2.3.2" has no content. Skipping.
[11:47:29] Finished 'deploy:bootstrap' after 22 ms

My folder structure is:

bootstrap-2.3.2/
├── css
│   ├── bootstrap.min.css
│   └── bootstrap-responsive.min.css
├── img
│   ├── glyphicons-halflings.png
│   └── glyphicons-halflings-white.png
└── js
    └── bootstrap.min.js

Why it is treated as it were empty?

Thank you.

zensh commented 8 years ago

please return your gulp stream!

return gulp.src(..).pipe(...)

caneta commented 8 years ago

I've written it in ES2015...this:

gulp.task('deploy:bootstrap', () =>
  gulp.src(['./dist/bootstrap-2.3.2/'])
    .pipe(gulpSSH.dest('/home/user/dest/'))
);

is equivalent to what you suggest:

gulp.task('deploy:bootstrap', function(){
  return gulp.src(['./dist/bootstrap-2.3.2/'])
    .pipe(gulpSSH.dest('/home/user/dest/'));
    }
);

But with the return statement I get the same result:

user@host:$ gulp deploy:bootstrap
[11:47:29] Using gulpfile /home/user/project/gulpfile.js
[11:47:29] Starting 'deploy:bootstrap'...
[11:47:29] "/home/user/project/dist/bootstrap-2.3.2" has no content. Skipping.
[11:47:29] Finished 'deploy:bootstrap' after 22 ms

I have another task written in ES2015, moving some CSS and this one works perfectly:

gulp.task('deploy:css', ['dist:css'], () =>
  gulp.src(['./dist/css/*.css'])
    .pipe(gulpSSH.dest('/home/user/dest/css/'))
);

So what is missing?

zensh commented 8 years ago

use gulp.src('./dist/bootstrap-2.3.2/**')

caneta commented 8 years ago

Ok, now it works! The complete working task is the following one:

gulp.task('deploy:bootstrap', () =>
  gulp.src(['./dist/bootstrap-2.3.2/**'])
    .pipe(gulpSSH.dest('/home/user/dest/bootstrap-2.3.2'))
);

Thak you so much!