Last active
March 25, 2019 15:37
-
-
Save sinpaout/04fecac681870720574e93bb6b3c381a to your computer and use it in GitHub Desktop.
auto rsync with gulp task over ssh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// gulpfile.js | |
var gulp = require( 'gulp' ); | |
var rsync = require( 'gulp-rsync' ); | |
var rsyncHost = process.env.RSYNC_HOST || '0.0.0.0'; | |
var rsyncPort = process.env.RSYNC_PORT || 22; | |
gulp.task( 'watch', function() { | |
var targets = [ | |
'./js/**' | |
]; | |
var watcher = gulp.watch( targets, ['sync']); | |
watcher.on( 'change', function( evt ) { | |
// debug | |
console.log( 'file: ' + evt.path + ', ' + 'type: ' + evt.type ); | |
}); | |
}); | |
// test_sshd is setup in ~/.ssh/config | |
gulp.task( 'sync', function() { | |
return gulp.src( 'js/**' ) | |
.pipe( rsync({ | |
hostname: 'test_sshd', | |
destination: '~/app/' | |
})); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment