/
gulpfile.js
39 lines (33 loc) · 1.05 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/* jshint node: true */
'use strict';
var gulp = require( 'gulp' );
var minimist = require( 'minimist' );
var rsync = require( 'rsyncwrapper' ).rsync;
var defaults = {
sshkey: null,
user: 'root',
host: 'files-02.gohone.com',
target: '/home/node/files/sdk/'
};
var options = minimist( process.argv.slice( 2 ), {
default: defaults
} );
gulp.task( 'publish', function( next ) {
if ( !options.sshkey ) {
throw new Error( 'You must specify an ssh key for publishing.' );
}
rsync( {
src: 'build/',
dest: options.user + '@' + options.host + ':' + options.target,
ssh: true,
recursive: true,
privateKey: options.sshkey,
onStdout: process.stdout.write.bind( process.stdout ),
onStderr: process.stderr.write.bind( process.stderr ),
args: [ '--progress' ]
}, function( error ) {
var log = error ? process.stdout.write.bind( process.stdout ) : process.stderr.write.bind( process.stderr );
log( 'Done\n' );
next( error );
} );
} );